From: Ingo Molnar <mingo@kernel.org>
To: "Kirill A. Shutemov" <kirill@shutemov.name>
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org,
Andrew Morton <akpm@linux-foundation.org>,
Peter Zijlstra <peterz@infradead.org>,
Thomas Gleixner <tglx@linutronix.de>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
"David S. Miller" <davem@davemloft.net>,
Ard Biesheuvel <ardb@kernel.org>,
Josh Poimboeuf <jpoimboe@redhat.com>,
Jonathan Corbet <corbet@lwn.net>,
Al Viro <viro@zeniv.linux.org.uk>
Subject: Re: [PATCH 0000/2297] [ANNOUNCE, RFC] "Fast Kernel Headers" Tree -v1: Eliminate the Linux kernel's "Dependency Hell"
Date: Tue, 4 Jan 2022 11:54:55 +0100 [thread overview]
Message-ID: <YdQnfyD0JzkGIzEN@gmail.com> (raw)
In-Reply-To: <20220103135400.4p5ezn3ntgpefuan@box.shutemov.name>
\
* Kirill A. Shutemov <kirill@shutemov.name> wrote:
> On Sun, Jan 02, 2022 at 10:57:35PM +0100, Ingo Molnar wrote:
> > - As to testing & runtime behavior: while all of these patches are
> > intended to be bug-free, I did find a couple of semi-bugs in the kernel
> > where a specific order of headers guaranteed a particular code
> > generation outcome - and if that header order was disturbed, the kernel
> > would silently break and fail to boot ...
>
> Looks like you are doing a lot of uninlining. Do you see any runtime
> performance degradation with the patchset?
I haven't tested that yet - and it's pretty hard to performance test
uninlining patches directly.
But what I've done is that I basically looked at the context and tried to
make a judgement call based on generated code.
In all the uninlining patches where I thought it might not be clear whether
it's proper to uninline I added detailed analysis, such as this one:
commit d94530f1abcbfd2500e90e151e7c67ff48ab3259
Author: Ingo Molnar <mingo@kernel.org>
Date: Sat Nov 20 18:20:58 2021 +0100
headers/uninline: Uninline multi-use function: put_page()
Ever since the page_is_devmap_managed() logic was added to put_page() in:
07d802699528: ("mm: devmap: refactor 1-based refcounting for ZONE_DEVICE pages")
put_page() has become a much larger function of over 2 dozen instructions:
0000000000004d30 <put_page>:
4d30: e8 00 00 00 00 call 4d35 <put_page+0x5>
4d35: 55 push %rbp
4d36: 48 8b 47 08 mov 0x8(%rdi),%rax
4d3a: 48 8d 50 ff lea -0x1(%rax),%rdx
4d3e: a8 01 test $0x1,%al
4d40: 48 89 e5 mov %rsp,%rbp
4d43: 48 0f 45 fa cmovne %rdx,%rdi
4d47: 66 90 xchg %ax,%ax
4d49: f0 ff 4f 34 lock decl 0x34(%rdi)
4d4d: 74 27 je 4d76 <put_page+0x46>
4d4f: 5d pop %rbp
4d50: c3 ret
4d51: 48 8b 07 mov (%rdi),%rax
4d54: 48 c1 e8 33 shr $0x33,%rax
4d58: 83 e0 07 and $0x7,%eax
4d5b: 83 f8 04 cmp $0x4,%eax
4d5e: 75 e9 jne 4d49 <put_page+0x19>
4d60: 48 8b 47 08 mov 0x8(%rdi),%rax
4d64: 8b 40 68 mov 0x68(%rax),%eax
4d67: 83 e8 01 sub $0x1,%eax
4d6a: 83 f8 01 cmp $0x1,%eax
4d6d: 77 da ja 4d49 <put_page+0x19>
4d6f: e8 00 00 00 00 call 4d74 <put_page+0x44>
4d74: 5d pop %rbp
4d75: c3 ret
4d76: e8 00 00 00 00 call 4d7b <put_page+0x4b>
4d7b: 5d pop %rbp
4d7c: c3 ret
Uninline it.
To counter some of the runtime overhead of the extra function call,
inline the __put_page() instance into put_page() - this is now
possible without extra bloat.
There's a measurable improvement in vmlinux text size, on a distro
kernel build, by ~4 KB.
Doing so also decouples <linux/mm_api.h> from <linux/memremap.h>.
Signed-off-by: Ingo Molnar <mingo@kernel.org>
I think it's pretty much a given that we don't want to inline 2 dozen
instructions for every put_page() call and we don't need performance
testing.
Admittedly my 'judgement call' was colored by the overall goal to decouple
types and headers, so please do double check! None of the uninlining
patches are critical to this tree - there's various other ways headers can
be decoupled other than uninlining.
There's one happy exception though, all the uninlining patches that
uninline a single-call function are probably fine as-is:
ef1028c44345 headers/uninline: Uninline single-use function: mips: page_size_ftlb()
98bc89e85e3f headers/uninline: Uninline single-use function: set_page_links()
e368b54381e9 headers/uninline: Uninline single-use function: cpupid_to_nid()
36b59978a96d headers/uninline: Uninline single-use function: wb_domain_size_changed()
4c95e8f21924 headers/uninline: Uninline single-use function: skb_metadata_differs()
28195c3f7eba headers/uninline: Uninline single-use function: for_each_netdev_feature()
3c82b720eb01 headers/uninline: Uninline single-use function: SPI_STATISTICS_ADD_*()
e7c48e440df3 headers/uninline: Uninline single-use function: qdisc_run()
ba0bfe18c8cc headers/uninline: Uninline single-use function: dev_validate_header()
3443e75fd1f8 headers/uninline: Uninline single-use function: kobject_has_children()
0e15d2fb85f9 headers/uninline: Uninline single-use function: xfrm_dev_state_free()
45d5233e1f5f headers/uninline: Uninline single-use function: flow_dissector_init_keys()
7a897b0747b2 headers/uninline: Uninline single-use function: reqsk_alloc()
f9003f1bd834 headers/uninline: Uninline single-use function: skb_propagate_pfmemalloc()
54ea5750f484 headers/uninline: Uninline single-use function: syscall_tracepoint_update()
5a1dc0bca4a4 headers/uninline: Uninline single-use function: proc_sys_poll_event()
0af72df4042d headers/uninline: Uninline single-use function: ep_take_care_of_epollwakeup()
13a8bd09a93a headers/uninline: Uninline single-use function: ptrace_event_pid()
f2b8980d4178 headers/uninline: Uninline single-use function: itimerspec64_valid()
ec111205e6de headers/uninline: Uninline single-use function: sk_under_cgroup_hierarchy()
d623ba9eb252 headers/uninline: Uninline single-use function: wb_find_current() and wb_get_create_current()
Thanks,
Ingo
next prev parent reply other threads:[~2022-01-04 10:55 UTC|newest]
Thread overview: 58+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-02 21:57 [PATCH 0000/2297] [ANNOUNCE, RFC] "Fast Kernel Headers" Tree -v1: Eliminate the Linux kernel's "Dependency Hell" Ingo Molnar
2022-01-03 10:11 ` Greg Kroah-Hartman
2022-01-03 11:12 ` Ingo Molnar
2022-01-03 13:46 ` Greg Kroah-Hartman
2022-01-03 16:29 ` Ingo Molnar
2022-01-10 10:28 ` Peter Zijlstra
2022-01-04 14:10 ` [PATCH] per_task: Remove the PER_TASK_BYTES hard-coded constant Ingo Molnar
2022-01-04 15:14 ` Andy Shevchenko
2022-01-04 23:27 ` Ingo Molnar
2022-01-04 17:51 ` [PATCH 0000/2297] [ANNOUNCE, RFC] "Fast Kernel Headers" Tree -v1: Eliminate the Linux kernel's "Dependency Hell" Arnd Bergmann
2022-01-05 0:05 ` Ingo Molnar
2022-01-05 1:37 ` Arnd Bergmann
2022-01-05 9:37 ` Andy Shevchenko
2022-01-04 14:05 ` [PATCH] per_task: Implement single template to define 'struct task_struct_per_task' fields and offsets Ingo Molnar
2022-01-03 13:54 ` [PATCH 0000/2297] [ANNOUNCE, RFC] "Fast Kernel Headers" Tree -v1: Eliminate the Linux kernel's "Dependency Hell" Kirill A. Shutemov
2022-01-04 10:54 ` Ingo Molnar [this message]
2022-01-04 13:34 ` Greg Kroah-Hartman
2022-01-04 13:54 ` [PATCH] headers/uninline: Uninline single-use function: kobject_has_children() Ingo Molnar
2022-01-04 15:09 ` Greg Kroah-Hartman
2022-01-04 15:14 ` Greg Kroah-Hartman
2022-01-05 0:11 ` Ingo Molnar
2022-01-05 15:23 ` Greg Kroah-Hartman
2022-01-06 11:26 ` Ingo Molnar
2022-01-03 17:54 ` [PATCH 0000/2297] [ANNOUNCE, RFC] "Fast Kernel Headers" Tree -v1: Eliminate the Linux kernel's "Dependency Hell" Nathan Chancellor
2022-01-04 10:47 ` Ingo Molnar
2022-01-04 10:56 ` [DEBUG PATCH] DO NOT MERGE: Enable SHADOW_CALL_STACK on GCC builds, for build testing Ingo Molnar
2022-01-04 11:02 ` [PATCH] headers/deps: dcache: Move the ____cacheline_aligned attribute to the head of the definition Ingo Molnar
2022-01-04 15:05 ` kernel test robot
2022-01-04 15:05 ` kernel test robot
2022-01-04 17:51 ` Nathan Chancellor
2022-01-05 0:20 ` Ingo Molnar
2022-01-05 0:26 ` [PATCH] headers/deps: Attribute placement fixes for Clang & GCC Ingo Molnar
2022-01-04 11:19 ` [TREE] "Fast Kernel Headers" Tree WIP/development branch Ingo Molnar
2022-01-04 17:25 ` [PATCH 0000/2297] [ANNOUNCE, RFC] "Fast Kernel Headers" Tree -v1: Eliminate the Linux kernel's "Dependency Hell" Nick Desaulniers
2022-01-05 0:43 ` Ingo Molnar
2022-01-04 17:50 ` Nathan Chancellor
2022-01-05 0:35 ` [PATCH] x86/kbuild: Enable CONFIG_KALLSYMS_ALL=y in the defconfigs Ingo Molnar
2022-01-08 21:57 ` [tip: x86/build] " tip-bot2 for Ingo Molnar
2022-01-05 0:40 ` [PATCH 0000/2297] [ANNOUNCE, RFC] "Fast Kernel Headers" Tree -v1: Eliminate the Linux kernel's "Dependency Hell" Ingo Molnar
2022-01-05 1:07 ` Ingo Molnar
2022-01-05 5:20 ` [PATCH 0000/2297] [ANNOUNCE, RFC] "Fast Kernel Headers" Tree -v1: Eliminate the Linux kernel'\''s "Dependency Hell Paul Zimmerman
2022-01-05 21:42 ` [PATCH 0000/2297] [ANNOUNCE, RFC] "Fast Kernel Headers" Tree -v1: Eliminate the Linux kernel's "Dependency Hell" Nathan Chancellor
2022-01-08 10:32 ` [PATCH] headers/deps: Add header dependencies to .c files: <linux/ptrace_api.h> Ingo Molnar
2022-01-08 11:08 ` [PATCH] FIX: headers/deps: uapi/headers: Create usr/include/uapi symbolic link Ingo Molnar
2022-01-08 11:18 ` [PATCH 0000/2297] [ANNOUNCE, RFC] "Fast Kernel Headers" Tree -v1: Eliminate the Linux kernel's "Dependency Hell" Ingo Molnar
2022-01-08 11:38 ` [PATCH] x86/bitops: Remove unused __sw_hweight64() assembly implementation Ingo Molnar
2022-01-08 11:49 ` [PATCH 0000/2297] [ANNOUNCE, RFC] "Fast Kernel Headers" Tree -v1: Eliminate the Linux kernel's "Dependency Hell" Ingo Molnar
2022-01-08 12:17 ` Ingo Molnar
2022-01-10 20:03 ` Nathan Chancellor
2022-01-10 20:05 ` Nathan Chancellor
2022-01-05 22:33 ` Nathan Chancellor
2022-01-08 15:16 ` Ingo Molnar
2022-01-07 0:29 ` Nathan Chancellor
2022-01-08 11:54 ` Ingo Molnar
2022-01-04 12:36 ` Willy Tarreau
2022-01-04 16:05 ` Andy Shevchenko
2022-01-04 16:18 ` Andy Shevchenko
2022-01-15 0:42 ` Paul E. McKenney
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=YdQnfyD0JzkGIzEN@gmail.com \
--to=mingo@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=ardb@kernel.org \
--cc=corbet@lwn.net \
--cc=davem@davemloft.net \
--cc=gregkh@linuxfoundation.org \
--cc=jpoimboe@redhat.com \
--cc=kirill@shutemov.name \
--cc=linux-arch@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=peterz@infradead.org \
--cc=tglx@linutronix.de \
--cc=torvalds@linux-foundation.org \
--cc=viro@zeniv.linux.org.uk \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.