The patch titled Subject: mm/mmap.c: optimization of do_mmap_pgoff function has been added to the -mm tree. Its filename is mm-mmapc-optimization-of-do_mmap_pgoff-function.patch This patch should soon appear at http://ozlabs.org/~akpm/mmots/broken-out/mm-mmapc-optimization-of-do_mmap_pgoff-function.patch and later at http://ozlabs.org/~akpm/mmotm/broken-out/mm-mmapc-optimization-of-do_mmap_pgoff-function.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/SubmitChecklist when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: Piotr Kwapulinski <kwapulinski.piotr@xxxxxxxxx> Subject: mm/mmap.c: optimization of do_mmap_pgoff function The simple check for zero length memory mapping may be performed earlier. So 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.piotr@xxxxxxxxx> Acked-by: Michal Hocko <mhocko@xxxxxxx> Acked-by: Rik van Riel <riel@xxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- mm/mmap.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff -puN mm/mmap.c~mm-mmapc-optimization-of-do_mmap_pgoff-function mm/mmap.c --- a/mm/mmap.c~mm-mmapc-optimization-of-do_mmap_pgoff-function +++ a/mm/mmap.c @@ -1271,6 +1271,9 @@ unsigned long do_mmap_pgoff(struct file *populate = 0; + if (!len) + return -EINVAL; + /* * Does the application expect PROT_READ to imply PROT_EXEC? * @@ -1281,9 +1284,6 @@ unsigned long do_mmap_pgoff(struct file 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); _ Patches currently in -mm which might be from kwapulinski.piotr@xxxxxxxxx are mm-mmapc-optimization-of-do_mmap_pgoff-function.patch -- To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html