Re: [PATCH 12/24] s390/preempt: Enable HAS_SEPARATE_PREEMPT_RESCHED_BITS
Peter Zijlstra <[email protected]> Mon, 3 Aug 2026 13:40:32 +0200
| Newsgroups | org.kernel.vger.rust-for-linux,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <[email protected]> |
On Fri, Jul 31, 2026 at 01:30:13PM -0700, Boqun Feng wrote:
> @@ -26,25 +23,25 @@
> */
> static __always_inline int preempt_count(void)
> {
> - unsigned long lc_preempt, count;
> + unsigned long lc_preempt;
> + int count;
>
> - BUILD_BUG_ON(sizeof_field(struct lowcore, preempt_count) != sizeof(int));
> - lc_preempt = offsetof(struct lowcore, preempt_count);
> + lc_preempt = offsetof(struct lowcore, preempt.count);
> /* READ_ONCE(get_lowcore()->preempt_count) & ~PREEMPT_NEED_RESCHED */
If I'm not mistaken, this comment is no longer accurate, since
NEED_RESCHED lives in the high word and you're only loading the low
word.
> asm_inline(
> - ALTERNATIVE("llgt %[count],%[offzero](%%r0)\n",
> - "llgt %[count],%[offalt](%%r0)\n",
> + ALTERNATIVE("ly %[count],%[offzero](%%r0)\n",
> + "ly %[count],%[offalt](%%r0)\n",
> ALT_FEATURE(MFEATURE_LOWCORE))
> : [count] "=d" (count)
> : [offzero] "i" (lc_preempt),
> [offalt] "i" (lc_preempt + LOWCORE_ALT_ADDRESS),
> - "m" (((struct lowcore *)0)->preempt_count));
> + "m" (((struct lowcore *)0)->preempt.count));
> return count;
> }