mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: yunhui cui <cuiyunhui@bytedance.com>
To: Thomas Gleixner <tglx@kernel.org>
Cc: pjw@kernel.org, palmer@dabbelt.com, aou@eecs.berkeley.edu,
	alex@ghiti.fr,  dennis@kernel.org, tj@kernel.org, cl@gentwo.org,
	ast@kernel.org,  daniel@iogearbox.net, andrii@kernel.org,
	martin.lau@linux.dev,  eddyz87@gmail.com, memxor@gmail.com,
	song@kernel.org, yonghong.song@linux.dev,  jolsa@kernel.org,
	bjorn@kernel.org, pulehui@huawei.com, puranjay@kernel.org,
	 thuth@redhat.com, ajones@ventanamicro.com,
	ben.dooks@codethink.co.uk,  rkrcmar@ventanamicro.com,
	samuel.holland@sifive.com, zong.li@sifive.com,
	 conor.dooley@microchip.com, debug@rivosinc.com,
	seanwascoding@gmail.com,  andybnac@gmail.com,
	menglong8.dong@gmail.com, cyrilbur@tenstorrent.com,
	 wangruikang@iscas.ac.cn, atishp@rivosinc.com,
	apatel@ventanamicro.com,  linux-riscv@lists.infradead.org,
	linux-kernel@vger.kernel.org,  linux-mm@kvack.org,
	bpf@vger.kernel.org, arnd@arndb.de, nathan@kernel.org,
	 nick.desaulniers+lkml@gmail.com, morbo@google.com,
	justinstitt@google.com,  qingfang.deng@siflower.com.cn,
	linux-arch@vger.kernel.org,  llvm@lists.linux.dev
Subject: Re: [External] Re: [PATCH v8 3/3] riscv: store percpu offset into thread_info
Date: Sun, 8 Nov 2026 16:27:42 +0800	[thread overview]
Message-ID: <CAEEQ3w=B4p-_4pg3ffrkSA_AXuz86FCd-w4FSB50HoijcSL74w@mail.gmail.com> (raw)
In-Reply-To: <87bjcnlrbv.ffs@fw13>

Hi Thomas,

On Sat, Jul 4, 2026 at 5:02 AM Thomas Gleixner <tglx@kernel.org> wrote:
>
> On Fri, Jul 03 2026 at 20:28, Yunhui Cui wrote:
> > +
> >  extern struct task_struct *__switch_to(struct task_struct *,
> >                                      struct task_struct *);
> >
> > @@ -122,6 +129,7 @@ do {                                                      \
> >       if (switch_to_should_flush_icache(__next))      \
> >               local_flush_icache_all();               \
> >       __switch_to_envcfg(__next);                     \
> > +     __switch_to_pcpu_offset(__next);                \
>
> Why do you want to go through the indirection of current:
>
> > +static inline void __switch_to_pcpu_offset(struct task_struct *next)
> > +{
> > +#ifdef CONFIG_SMP
> > +     next->thread_info.pcpu_offset = __my_cpu_offset;
> > +#endif
> > +}
>
> instead of using __prev->.....offset, which is right there available?
>

Agreed. current is __prev at this point, and both forms compile to the
same load/store sequence. Passing __prev explicitly is clearer, so I will
copy its pcpu_offset directly to __next.

Thanks,
Yunhui

  reply	other threads:[~2026-11-08  8:27 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-03 12:28 [PATCH v8 0/3] riscv: fix PIO helpers and add optimized percpu ops Yunhui Cui
2026-07-03 12:28 ` [PATCH v8 1/3] riscv: io: avoid null-pointer arithmetic in PIO helpers Yunhui Cui
2026-07-13 18:03   ` Paul Walmsley
2026-07-14  6:23     ` [External] " yunhui cui
2026-07-03 12:28 ` [PATCH v8 2/3] riscv: introduce percpu.h into include/asm Yunhui Cui
2026-08-26  1:07   ` Davidlohr Bueso
2026-11-08  7:28     ` [External] " yunhui cui
2026-07-03 12:28 ` [PATCH v8 3/3] riscv: store percpu offset into thread_info Yunhui Cui
2026-07-03 21:02   ` Thomas Gleixner
2026-11-08  8:27     ` yunhui cui [this message]
2026-08-26  1:24   ` Davidlohr Bueso

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='CAEEQ3w=B4p-_4pg3ffrkSA_AXuz86FCd-w4FSB50HoijcSL74w@mail.gmail.com' \
    --to=cuiyunhui@bytedance.com \
    --cc=ajones@ventanamicro.com \
    --cc=alex@ghiti.fr \
    --cc=andrii@kernel.org \
    --cc=andybnac@gmail.com \
    --cc=aou@eecs.berkeley.edu \
    --cc=apatel@ventanamicro.com \
    --cc=arnd@arndb.de \
    --cc=ast@kernel.org \
    --cc=atishp@rivosinc.com \
    --cc=ben.dooks@codethink.co.uk \
    --cc=bjorn@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=cl@gentwo.org \
    --cc=conor.dooley@microchip.com \
    --cc=cyrilbur@tenstorrent.com \
    --cc=daniel@iogearbox.net \
    --cc=debug@rivosinc.com \
    --cc=dennis@kernel.org \
    --cc=eddyz87@gmail.com \
    --cc=jolsa@kernel.org \
    --cc=justinstitt@google.com \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=llvm@lists.linux.dev \
    --cc=martin.lau@linux.dev \
    --cc=memxor@gmail.com \
    --cc=menglong8.dong@gmail.com \
    --cc=morbo@google.com \
    --cc=nathan@kernel.org \
    --cc=nick.desaulniers+lkml@gmail.com \
    --cc=palmer@dabbelt.com \
    --cc=pjw@kernel.org \
    --cc=pulehui@huawei.com \
    --cc=puranjay@kernel.org \
    --cc=qingfang.deng@siflower.com.cn \
    --cc=rkrcmar@ventanamicro.com \
    --cc=samuel.holland@sifive.com \
    --cc=seanwascoding@gmail.com \
    --cc=song@kernel.org \
    --cc=tglx@kernel.org \
    --cc=thuth@redhat.com \
    --cc=tj@kernel.org \
    --cc=wangruikang@iscas.ac.cn \
    --cc=yonghong.song@linux.dev \
    --cc=zong.li@sifive.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

all inboxes | Powered by JetHome®