From: Cody P Schafer <cody@linux.vnet.ibm.com>
To: Dave Hansen <dave.hansen@linux.intel.com>
Cc: SeungHun Lee <waydi1@gmail.com>,
linux-mm@kvack.org,
KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>,
David Rientjes <rientjes@google.com>,
xinxing2zhou@gmail.com
Subject: Re: [PATCH 2/2] mm: page_alloc: Add unlikely for MAX_ORDER check
Date: Mon, 29 Jul 2013 17:36:47 -0700 [thread overview]
Message-ID: <51F70A9F.2000309@linux.vnet.ibm.com> (raw)
In-Reply-To: <51F6F087.9060109@linux.intel.com>
On 07/29/2013 03:45 PM, Dave Hansen wrote:
> On 07/28/2013 07:48 AM, SeungHun Lee wrote:
>> diff --git a/mm/page_alloc.c b/mm/page_alloc.c
>> index b8475ed..e644cf5 100644
>> --- a/mm/page_alloc.c
>> +++ b/mm/page_alloc.c
>> @@ -2408,7 +2408,7 @@ __alloc_pages_slowpath(gfp_t gfp_mask, unsigned int order,
>> * be using allocators in order of preference for an area that is
>> * too large.
>> */
>> - if (order >= MAX_ORDER) {
>> + if (unlikely(order >= MAX_ORDER)) {
>> WARN_ON_ONCE(!(gfp_mask & __GFP_NOWARN));
>> return NULL;
>> }
>
> What problem is this patch solving? I can see doing this in hot paths,
> or places where the compiler is known to be generating bad or suboptimal
> code. but, this costs me 512 bytes of text size:
>
> 898384 Jul 29 15:40 mm/page_alloc.o.nothing
> 898896 Jul 29 15:40 mm/page_alloc.o.unlikely
I took a look at this on my system.
With gcc version 4.6.3 (Ubuntu/Linaro 4.6.3-1ubuntu5):
-rw-rw-r-- 1 cody cody 841160 Jul 29 16:47 unlikely/mm/page_alloc.o
-rw-rw-r-- 1 cody cody 840584 Jul 29 16:59 normal/mm/page_alloc.o
text data bss dec hex filename
33799 1414 184 35397 8a45 unlikely/mm/page_alloc.o
33799 1414 184 35397 8a45 normal/mm/page_alloc.o
Well, where are are those extra bytes coming from, then?
Using readelf -S + `git diff --no-index --word-diff` shows:
.debug_info shrinks from 1e991 to 1e98f
.rela.debug_info shrinks from 33a80 to 33a68
.debug_loc grows from 15e1d to 15ecb
.rela.debug_loc grows from 26f40 to 270f0
.debug_line grows from 038eb to 038ed
.debug_str shrinks from 0adb6 to 0adb2
The sizes of all other sections are unchanged.
Also: comparing vmlinux sizes:
-rwxrwxr-x 1 cody cody 94121230 Jul 29 17:00 normal/vmlinux
-rwxrwxr-x 1 cody cody 94121294 Jul 29 16:51 unlikely/vmlinux
And the bzImage sizes:
-rw-rw-r-- 1 cody cody 2942240 Jul 29 16:51 unlikely/arch/x86/boot/bzImage
-rw-rw-r-- 1 cody cody 2942208 Jul 29 17:00 normal/arch/x86/boot/bzImage
I build this kernel with debug info built in though, what happens when
it is removed?
-rwxrwxr-x 1 cody cody 16392454 Jul 29 17:33 normal/vmlinux
-rwxrwxr-x 1 cody cody 16392454 Jul 29 17:33 unlikely/vmlinux
-rw-rw-r-- 1 cody cody 2942208 Jul 29 17:33 normal/arch/x86/boot/bzImage
-rw-rw-r-- 1 cody cody 2942208 Jul 29 17:33 unlikely/arch/x86/boot/bzImage
So, it looks like the only difference in size due to this patch is in
the debug info.
> I really don't think we should be adding these without having _concrete_
> reasons for it.
--
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:[~2013-07-30 0:36 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-28 14:48 [PATCH 2/2] mm: page_alloc: Add unlikely for MAX_ORDER check SeungHun Lee
2013-07-29 18:44 ` KOSAKI Motohiro
2013-07-29 22:11 ` David Rientjes
2013-07-29 22:26 ` zhouxinxing
2013-07-29 22:45 ` Dave Hansen
2013-07-30 0:36 ` Cody P Schafer [this message]
2013-07-30 0:41 ` Cody P Schafer
2013-07-30 1:20 ` Cody P Schafer
2013-07-30 16:43 ` Dave Hansen
2013-07-31 14:45 ` 이승훈
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=51F70A9F.2000309@linux.vnet.ibm.com \
--to=cody@linux.vnet.ibm.com \
--cc=dave.hansen@linux.intel.com \
--cc=kosaki.motohiro@jp.fujitsu.com \
--cc=linux-mm@kvack.org \
--cc=rientjes@google.com \
--cc=waydi1@gmail.com \
--cc=xinxing2zhou@gmail.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).