From: Chen Gang <xili_gchen_5257@hotmail.com>
To: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
"oleg@redhat.com" <oleg@redhat.com>,
"kirill.shutemov@linux.intel.com"
<kirill.shutemov@linux.intel.com>,
"dave@stgolabs.net" <dave@stgolabs.net>,
"aarcange@redhat.com" <aarcange@redhat.com>,
Linux Memory <linux-mm@kvack.org>,
kernel mailing list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] mm/mmap.c: Remove redundant local variables for may_expand_vm()
Date: Wed, 11 Nov 2015 06:22:25 +0800 [thread overview]
Message-ID: <BLU436-SMTP1713224CA79B39CADC86406B9140@phx.gbl> (raw)
In-Reply-To: <20151110013945.GA24497@hori1.linux.bs1.fc.nec.co.jp>
On 11/10/15 09:39, Naoya Horiguchi wrote:
> On Tue, Nov 10, 2015 at 05:41:08AM +0800, Chen Gang wrote:
>> diff --git a/mm/mmap.c b/mm/mmap.c
>> index 2ce04a6..a515260 100644
>> --- a/mm/mmap.c
>> +++ b/mm/mmap.c
>> @@ -2988,12 +2988,7 @@ out:
>> */
>> int may_expand_vm(struct mm_struct *mm, unsigned long npages)
>
> marking inline?
>
For me, inline is OK. But I guess, it depends on the members tastes: "It
is used at 5 areas within mm, inline will expand the binary size".
>> {
>> - unsigned long cur = mm->total_vm; /* pages */
>> - unsigned long lim;
>> -
>> - lim = rlimit(RLIMIT_AS) >> PAGE_SHIFT;
>> -
>> - if (cur + npages > lim)
>> + if (mm->total_vm + npages > (rlimit(RLIMIT_AS) >> PAGE_SHIFT))
>> return 0;
>> return 1;
>
> How about doing simply
>
> return mm->total_vm + npages <= (rlimit(RLIMIT_AS) >> PAGE_SHIFT);
>
For me, only one line is OK. But I guess, it also depends on the members
tastes: does it let code a little complex?
If we can use bool instead of int for may_epand_mm() return value, I
guess, one line implementation (your idea) will be OK to all members.
> ? These changes save some bytes :)
>
> text data bss dec hex filename
> 20566 2250 40 22856 5948 mm/mmap.o (before)
>
> text data bss dec hex filename
> 20542 2250 40 22832 5930 mm/mmap.o (after)
>
> Thanks,
> Naoya Horiguchi
>
Thanks.
--
Chen Gang (陈刚)
Open, share, and attitude like air, water, and life which God blessed
--
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-11-10 22:19 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-09 21:41 Chen Gang
2015-11-10 1:39 ` Naoya Horiguchi
2015-11-10 22:22 ` Chen Gang [this message]
2015-11-10 22:40 ` 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=BLU436-SMTP1713224CA79B39CADC86406B9140@phx.gbl \
--to=xili_gchen_5257@hotmail.com \
--cc=aarcange@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=dave@stgolabs.net \
--cc=kirill.shutemov@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=n-horiguchi@ah.jp.nec.com \
--cc=oleg@redhat.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