From: Oleg Nesterov <oleg@redhat.com>
To: Chen Gang <xili_gchen_5257@hotmail.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
"kirill.shutemov@linux.intel.com"
<kirill.shutemov@linux.intel.com>,
"riel@redhat.com" <riel@redhat.com>,
Michal Hocko <mhocko@suse.cz>,
"sasha.levin@oracle.com" <sasha.levin@oracle.com>,
"pfeiner@google.com" <pfeiner@google.com>,
"aarcange@redhat.com" <aarcange@redhat.com>,
"vishnu.ps@samsung.com" <vishnu.ps@samsung.com>,
Linux Memory <linux-mm@kvack.org>,
kernel mailing list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] mm/mmap.c: Remove redundent 'get_area' function pointer in get_unmapped_area()
Date: Mon, 7 Sep 2015 14:41:49 +0200 [thread overview]
Message-ID: <20150907124148.GB32668@redhat.com> (raw)
In-Reply-To: <COL130-W16C972B0457D5C7C9CB06B9560@phx.gbl>
On 09/05, Chen Gang wrote:
>
> From a1bf4726f71d6d0394b41309944646fc806a8a0c Mon Sep 17 00:00:00 2001
> From: Chen Gang <gang.chen.5i5j@gmail.com>
> Date: Sat, 5 Sep 2015 21:51:08 +0800
> Subject: [PATCH] mm/mmap.c: Remove redundent 'get_area' function pointer in
> get_unmapped_area()
>
> Call the function pointer directly, then let code a bit simpler.
^^^^^^^^^^^^^^^^^^
This is subjective you know ;)
I guess the author of this code added this variable to make the code
more readable. And to me it becomes less readable after your change.
I leave this to you and maintainers.
> Signed-off-by: Chen Gang <gang.chen.5i5j@gmail.com>
> ---
> mm/mmap.c | 12 ++++++------
> 1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/mm/mmap.c b/mm/mmap.c
> index 4db7cf0..39fd727 100644
> --- a/mm/mmap.c
> +++ b/mm/mmap.c
> @@ -2012,10 +2012,8 @@ unsigned long
> get_unmapped_area(struct file *file, unsigned long addr, unsigned long len,
> unsigned long pgoff, unsigned long flags)
> {
> - unsigned long (*get_area)(struct file *, unsigned long,
> - unsigned long, unsigned long, unsigned long);
> -
> unsigned long error = arch_mmap_check(addr, len, flags);
> +
> if (error)
> return error;
>
> @@ -2023,10 +2021,12 @@ get_unmapped_area(struct file *file, unsigned long addr, unsigned long len,
> if (len> TASK_SIZE)
> return -ENOMEM;
>
> - get_area = current->mm->get_unmapped_area;
> if (file && file->f_op->get_unmapped_area)
> - get_area = file->f_op->get_unmapped_area;
> - addr = get_area(file, addr, len, pgoff, flags);
> + addr = file->f_op->get_unmapped_area(file, addr, len,
> + pgoff, flags);
> + else
> + addr = current->mm->get_unmapped_area(file, addr, len,
> + pgoff, flags);
> if (IS_ERR_VALUE(addr))
> return addr;
>
> --
> 1.9.3
>
>
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2015-09-07 12:44 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-05 14:09 [PATCH] mm/mmap.c: Remove redundent 'get_area' function pointer in get_unmapped_area() Chen Gang
2015-09-07 12:41 ` Oleg Nesterov [this message]
[not found] ` <55EEEC18.10101@hotmail.com>
2015-09-08 14:09 ` Chen Gang
2015-09-08 23:23 ` David Rientjes
-- strict thread matches above, loose matches on Subject: below --
2015-09-03 4:14 gang.chen.5i5j
2015-09-10 22:32 ` Andrew Morton
2015-09-11 23:52 ` Chen Gang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20150907124148.GB32668@redhat.com \
--to=oleg@redhat.com \
--cc=aarcange@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=kirill.shutemov@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@suse.cz \
--cc=pfeiner@google.com \
--cc=riel@redhat.com \
--cc=sasha.levin@oracle.com \
--cc=vishnu.ps@samsung.com \
--cc=xili_gchen_5257@hotmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).