mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Brian Gerst <brgerst@gmail.com>
Cc: linux-kernel@vger.kernel.org, x86@kernel.org,
	Ingo Molnar <mingo@kernel.org>, "H . Peter Anvin" <hpa@zytor.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Borislav Petkov <bp@alien8.de>, Ard Biesheuvel <ardb@kernel.org>,
	Uros Bizjak <ubizjak@gmail.com>,
	Linus Torvalds <torvalds@linuxfoundation.org>,
	Andy Lutomirski <luto@kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH v2 00/11] Add a percpu subsection for cache hot data
Date: Wed, 26 Feb 2025 21:23:09 +0100	[thread overview]
Message-ID: <20250226202309.GB29387@noisy.programming.kicks-ass.net> (raw)
In-Reply-To: <20250226180531.1242429-1-brgerst@gmail.com>

On Wed, Feb 26, 2025 at 01:05:19PM -0500, Brian Gerst wrote:
> Add a new percpu subsection for data that is frequently accessed and
> exclusive to each processor.  This replaces the pcpu_hot struct on x86,
> and is available to all architectures and the core kernel.
> 
> ffffffff842fa000 D __per_cpu_hot_start
> ffffffff842fa000 D hardirq_stack_ptr
> ffffffff842fa008 D __ref_stack_chk_guard
> ffffffff842fa008 D __stack_chk_guard
> ffffffff842fa010 D const_cpu_current_top_of_stack
> ffffffff842fa010 D cpu_current_top_of_stack
> ffffffff842fa018 D const_current_task
> ffffffff842fa018 D current_task
> ffffffff842fa020 D __x86_call_depth
> ffffffff842fa028 D this_cpu_off
> ffffffff842fa030 D __preempt_count
> ffffffff842fa034 D cpu_number
> ffffffff842fa038 D __softirq_pending
> ffffffff842fa03a D hardirq_stack_inuse
> ffffffff842fa040 D __per_cpu_hot_end

The above is useful, but not quite as useful as looking at:

$ pahole -C pcpu_hot defconfig-build/vmlinux.o
struct pcpu_hot {
        union {
                struct {
                        struct task_struct * current_task; /*     0     8 */
                        int        preempt_count;        /*     8     4 */
                        int        cpu_number;           /*    12     4 */
                        u64        call_depth;           /*    16     8 */
                        long unsigned int top_of_stack;  /*    24     8 */
                        void *     hardirq_stack_ptr;    /*    32     8 */
                        u16        softirq_pending;      /*    40     2 */
                        bool       hardirq_stack_inuse;  /*    42     1 */
                };                                       /*     0    48 */
                u8                 pad[64];              /*     0    64 */
        };                                               /*     0    64 */

        /* size: 64, cachelines: 1, members: 1 */
};

A slightly more useful variant of your listing would be:

$ readelf -Ws defconfig-build/vmlinux | sort -k 2 | awk 'BEGIN {p=0} /__per_cpu_hot_start/ {p=1} { if (p) print $2 " " $3 " " $8 } /__per_cpu_hot_end/ {p=0}'
ffffffff834f5000 0 __per_cpu_hot_start
ffffffff834f5000 8 hardirq_stack_ptr
ffffffff834f5008 0 __ref_stack_chk_guard
ffffffff834f5008 8 __stack_chk_guard
ffffffff834f5010 0 const_cpu_current_top_of_stack
ffffffff834f5010 8 cpu_current_top_of_stack
ffffffff834f5018 0 const_current_task
ffffffff834f5018 8 current_task
ffffffff834f5020 8 __x86_call_depth
ffffffff834f5028 8 this_cpu_off
ffffffff834f5030 4 __preempt_count
ffffffff834f5034 4 cpu_number
ffffffff834f5038 2 __softirq_pending
ffffffff834f503a 1 hardirq_stack_inuse
ffffffff834f5040 0 __per_cpu_hot_end

as it also gets the size for each symbol. Allowing us to compute the
hole as 0x40-0x3b, or 5 bytes.



  parent reply	other threads:[~2025-02-26 20:23 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-26 18:05 Brian Gerst
2025-02-26 18:05 ` [PATCH v2 01/11] percpu: Introduce percpu hot section Brian Gerst
2025-02-26 19:36   ` Uros Bizjak
2025-02-27  2:09     ` Brian Gerst
2025-02-27 14:16   ` kernel test robot
2025-02-27 19:29   ` kernel test robot
2025-02-26 18:05 ` [PATCH v2 02/11] x86/percpu: Move pcpu_hot to " Brian Gerst
2025-02-26 18:05 ` [PATCH v2 03/11] x86/preempt: Move preempt count " Brian Gerst
2025-02-26 18:05 ` [PATCH v2 04/11] x86/smp: Move cpu number " Brian Gerst
2025-02-26 18:05 ` [PATCH v2 05/11] x86/retbleed: Move call depth " Brian Gerst
2025-02-26 18:05 ` [PATCH v2 06/11] x86/softirq: Move softirq_pending " Brian Gerst
2025-02-26 18:05 ` [PATCH v2 07/11] x86/irq: Move irq stacks " Brian Gerst
2025-02-26 20:25   ` Peter Zijlstra
2025-02-27  0:10     ` Brian Gerst
2025-02-26 18:05 ` [PATCH v2 08/11] x86/percpu: Move top_of_stack " Brian Gerst
2025-02-26 20:08   ` Uros Bizjak
2025-02-27  2:10     ` Brian Gerst
2025-02-26 18:05 ` [PATCH v2 09/11] x86/percpu: Move current_task " Brian Gerst
2025-02-26 18:05 ` [PATCH v2 10/11] x86/stackprotector: Move __stack_chk_guard " Brian Gerst
2025-02-26 18:05 ` [PATCH v2 11/11] x86/smp: Move this_cpu_off " Brian Gerst
2025-02-26 20:23 ` Peter Zijlstra [this message]
2025-02-27  1:29   ` [PATCH v2 00/11] Add a percpu subsection for cache hot data Brian Gerst
2025-02-27  1:52     ` Brian Gerst

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=20250226202309.GB29387@noisy.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=akpm@linux-foundation.org \
    --cc=ardb@kernel.org \
    --cc=bp@alien8.de \
    --cc=brgerst@gmail.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@kernel.org \
    --cc=mingo@kernel.org \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linuxfoundation.org \
    --cc=ubizjak@gmail.com \
    --cc=x86@kernel.org \
    /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

all inboxes | Powered by JetHome®