Re: [PATCH] mm/mmap.c: optimization of do_mmap_pgoff function
On 06/06/2015 05:54 AM, Piotr Kwapulinski wrote: > The simple check for zero length memory mapping may be performed > earlier. It causes that in case of zero length memory mapping some > unnecessary code is not executed at all. It does not make the code less > readable and saves some CPU cycles. > > Signed-off-by: Piotr Kwapulinski Acked-by: Rik van Riel -- All rights reversed -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] mm/mmap.c: optimization of do_mmap_pgoff function
On Sat 06-06-15 11:54:32, Piotr Kwapulinski wrote: > The simple check for zero length memory mapping may be performed > earlier. It causes that in case of zero length memory mapping some > unnecessary code is not executed at all. It does not make the code less > readable and saves some CPU cycles. > > Signed-off-by: Piotr Kwapulinski Acked-by: Michal Hocko > --- > mm/mmap.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/mm/mmap.c b/mm/mmap.c > index bb50cac..aa632ad 100644 > --- a/mm/mmap.c > +++ b/mm/mmap.c > @@ -1258,6 +1258,9 @@ unsigned long do_mmap_pgoff(struct file *file, unsigned > long addr, > > *populate = 0; > > + if (!len) > + return -EINVAL; > + > /* >* Does the application expect PROT_READ to imply PROT_EXEC? >* > @@ -1268,9 +1271,6 @@ unsigned long do_mmap_pgoff(struct file *file, unsigned > long addr, > if (!(file && (file->f_path.mnt->mnt_flags & MNT_NOEXEC))) > prot |= PROT_EXEC; > > - if (!len) > - return -EINVAL; > - > if (!(flags & MAP_FIXED)) > addr = round_hint_to_min(addr); > > -- > 2.3.7 > -- Michal Hocko SUSE Labs -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] mm/mmap.c: optimization of do_mmap_pgoff function
On Sat 06-06-15 11:54:32, Piotr Kwapulinski wrote: The simple check for zero length memory mapping may be performed earlier. It causes that in case of zero length memory mapping some unnecessary code is not executed at all. It does not make the code less readable and saves some CPU cycles. Signed-off-by: Piotr Kwapulinski kwapulinski.pi...@gmail.com Acked-by: Michal Hocko mho...@suse.cz --- mm/mmap.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mm/mmap.c b/mm/mmap.c index bb50cac..aa632ad 100644 --- a/mm/mmap.c +++ b/mm/mmap.c @@ -1258,6 +1258,9 @@ unsigned long do_mmap_pgoff(struct file *file, unsigned long addr, *populate = 0; + if (!len) + return -EINVAL; + /* * Does the application expect PROT_READ to imply PROT_EXEC? * @@ -1268,9 +1271,6 @@ unsigned long do_mmap_pgoff(struct file *file, unsigned long addr, if (!(file (file-f_path.mnt-mnt_flags MNT_NOEXEC))) prot |= PROT_EXEC; - if (!len) - return -EINVAL; - if (!(flags MAP_FIXED)) addr = round_hint_to_min(addr); -- 2.3.7 -- Michal Hocko SUSE Labs -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] mm/mmap.c: optimization of do_mmap_pgoff function
On 06/06/2015 05:54 AM, Piotr Kwapulinski wrote: The simple check for zero length memory mapping may be performed earlier. It causes that in case of zero length memory mapping some unnecessary code is not executed at all. It does not make the code less readable and saves some CPU cycles. Signed-off-by: Piotr Kwapulinski kwapulinski.pi...@gmail.com Acked-by: Rik van Riel r...@redhat.com -- All rights reversed -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] mm/mmap.c: optimization of do_mmap_pgoff function
The simple check for zero length memory mapping may be performed earlier. It causes that in case of zero length memory mapping some unnecessary code is not executed at all. It does not make the code less readable and saves some CPU cycles. Signed-off-by: Piotr Kwapulinski --- mm/mmap.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mm/mmap.c b/mm/mmap.c index bb50cac..aa632ad 100644 --- a/mm/mmap.c +++ b/mm/mmap.c @@ -1258,6 +1258,9 @@ unsigned long do_mmap_pgoff(struct file *file, unsigned long addr, *populate = 0; + if (!len) + return -EINVAL; + /* * Does the application expect PROT_READ to imply PROT_EXEC? * @@ -1268,9 +1271,6 @@ unsigned long do_mmap_pgoff(struct file *file, unsigned long addr, if (!(file && (file->f_path.mnt->mnt_flags & MNT_NOEXEC))) prot |= PROT_EXEC; - if (!len) - return -EINVAL; - if (!(flags & MAP_FIXED)) addr = round_hint_to_min(addr); -- 2.3.7 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] mm/mmap.c: optimization of do_mmap_pgoff function
The simple check for zero length memory mapping may be performed earlier. It causes that in case of zero length memory mapping some unnecessary code is not executed at all. It does not make the code less readable and saves some CPU cycles. Signed-off-by: Piotr Kwapulinski kwapulinski.pi...@gmail.com --- mm/mmap.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mm/mmap.c b/mm/mmap.c index bb50cac..aa632ad 100644 --- a/mm/mmap.c +++ b/mm/mmap.c @@ -1258,6 +1258,9 @@ unsigned long do_mmap_pgoff(struct file *file, unsigned long addr, *populate = 0; + if (!len) + return -EINVAL; + /* * Does the application expect PROT_READ to imply PROT_EXEC? * @@ -1268,9 +1271,6 @@ unsigned long do_mmap_pgoff(struct file *file, unsigned long addr, if (!(file (file-f_path.mnt-mnt_flags MNT_NOEXEC))) prot |= PROT_EXEC; - if (!len) - return -EINVAL; - if (!(flags MAP_FIXED)) addr = round_hint_to_min(addr); -- 2.3.7 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/