linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm/page_ext.c: Make page_ext_init a noop when CONFIG_PAGE_EXTENSION but nothing uses it
@ 2018-01-05 13:02 Oscar Salvador
  2018-01-12  0:43 ` Andrew Morton
  0 siblings, 1 reply; 2+ messages in thread
From: Oscar Salvador @ 2018-01-05 13:02 UTC (permalink / raw)
  To: linux-mm; +Cc: mhocko, vbabka, jaewon31.kim

static struct page_ext_operations *page_ext_ops[] always contains debug_guardpage_ops,

static struct page_ext_operations *page_ext_ops[] = {
        &debug_guardpage_ops,
 #ifdef CONFIG_PAGE_OWNER
        &page_owner_ops,
 #endif
...
}

but for it to work, CONFIG_DEBUG_PAGEALLOC must be enabled first.
If someone has CONFIG_PAGE_EXTENSION, but has none of its users,
eg: (CONFIG_PAGE_OWNER, CONFIG_DEBUG_PAGEALLOC, CONFIG_IDLE_PAGE_TRACKING), we can shrink page_ext_init()
to a simple retq.

$ size vmlinux  (before patch)
   text	   data	    bss	    dec	    hex	filename
14356698	5681582	1687748	21726028	14b834c	vmlinux

$ size vmlinux  (after patch)
   text	   data	    bss	    dec	    hex	filename
14356008	5681538	1687748	21725294	14b806e	vmlinux

On the other hand, it might does not even make sense, since if someone
enables CONFIG_PAGE_EXTENSION, I would expect him to enable also at least
one of its users, but I wanted to see what you guys think.

Signed-off-by: Oscar Salvador <osalvador@techadventures.net>
---
 mm/page_ext.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/mm/page_ext.c b/mm/page_ext.c
index 2c16216c29b6..5295ef331165 100644
--- a/mm/page_ext.c
+++ b/mm/page_ext.c
@@ -59,7 +59,9 @@
  */
 
 static struct page_ext_operations *page_ext_ops[] = {
+#ifdef CONFIG_DEBUG_PAGEALLOC
 	&debug_guardpage_ops,
+#endif
 #ifdef CONFIG_PAGE_OWNER
 	&page_owner_ops,
 #endif
-- 
2.13.5

--
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>

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] mm/page_ext.c: Make page_ext_init a noop when CONFIG_PAGE_EXTENSION but nothing uses it
  2018-01-05 13:02 [PATCH] mm/page_ext.c: Make page_ext_init a noop when CONFIG_PAGE_EXTENSION but nothing uses it Oscar Salvador
@ 2018-01-12  0:43 ` Andrew Morton
  0 siblings, 0 replies; 2+ messages in thread
From: Andrew Morton @ 2018-01-12  0:43 UTC (permalink / raw)
  To: Oscar Salvador; +Cc: linux-mm, mhocko, vbabka, jaewon31.kim

On Fri, 5 Jan 2018 14:02:35 +0100 Oscar Salvador <osalvador@techadventures.net> wrote:

> static struct page_ext_operations *page_ext_ops[] always contains debug_guardpage_ops,
> 
> static struct page_ext_operations *page_ext_ops[] = {
>         &debug_guardpage_ops,
>  #ifdef CONFIG_PAGE_OWNER
>         &page_owner_ops,
>  #endif
> ...
> }
> 
> but for it to work, CONFIG_DEBUG_PAGEALLOC must be enabled first.
> If someone has CONFIG_PAGE_EXTENSION, but has none of its users,
> eg: (CONFIG_PAGE_OWNER, CONFIG_DEBUG_PAGEALLOC, CONFIG_IDLE_PAGE_TRACKING), we can shrink page_ext_init()
> to a simple retq.
> 
> $ size vmlinux  (before patch)
>    text	   data	    bss	    dec	    hex	filename
> 14356698	5681582	1687748	21726028	14b834c	vmlinux
> 
> $ size vmlinux  (after patch)
>    text	   data	    bss	    dec	    hex	filename
> 14356008	5681538	1687748	21725294	14b806e	vmlinux
> 
> On the other hand, it might does not even make sense, since if someone
> enables CONFIG_PAGE_EXTENSION, I would expect him to enable also at least
> one of its users, but I wanted to see what you guys think.

Presumably the CONFIG_PAGE_EXTENSION users should `select'
CONFIG_PAGE_EXTENSION so the situation doesn't arise.

(or does it?  I have a vague memory that if CONFIG_A selects CONFIG_B
and you then set CONFIG_A=n, CONFIG_B remains enabled?)

--
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>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-01-12  0:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-05 13:02 [PATCH] mm/page_ext.c: Make page_ext_init a noop when CONFIG_PAGE_EXTENSION but nothing uses it Oscar Salvador
2018-01-12  0:43 ` Andrew Morton

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).