<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel/linux.git/arch/s390/include/asm/preempt.h, branch linux-7.0.y</title>
<subtitle>Linux kernel stable tree (mirror)</subtitle>
<id>https://git.radix-linux.su/kernel/linux.git/atom?h=linux-7.0.y</id>
<link rel='self' href='https://git.radix-linux.su/kernel/linux.git/atom?h=linux-7.0.y'/>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/'/>
<updated>2026-01-17T14:52:49+00:00</updated>
<entry>
<title>s390/preempt: Optimize __preempt_count_dec_and_test()</title>
<updated>2026-01-17T14:52:49+00:00</updated>
<author>
<name>Heiko Carstens</name>
<email>hca@linux.ibm.com</email>
</author>
<published>2026-01-13T19:44:00+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=48b4790f054994d4df6d1025ec9267b19618f0ec'/>
<id>urn:sha1:48b4790f054994d4df6d1025ec9267b19618f0ec</id>
<content type='text'>
Provide an inline assembly using alternatives to avoid the need of a
base register due to relocatable lowcore when adding or subtracting
small constants from preempt_count.

Main user is preempt_enable(), which subtracts one from preempt_count
and tests if the result is zero.

With this the generated code changes from

  1000b8:       a7 19 00 00             lghi    %r1,0
  1000bc:       eb ff 13 a8 00 6e       alsi    936(%r1),-1
  1000c2:       a7 54 00 05             jnhe    1000cc &lt;__rcu_read_unlock+0x14&gt;

to something like this:

  1000b8:       eb ff 03 a8 00 6e       alsi    936,-1
  1000be:       a7 54 00 05             jnhe    1000c8 &lt;__rcu_read_unlock+0x10&gt;

Kernel image size is reduced by 45kb (bloat-o-meter -t, defconfig, gcc15).

Reviewed-by: Sven Schnelle &lt;svens@linux.ibm.com&gt;
Signed-off-by: Heiko Carstens &lt;hca@linux.ibm.com&gt;
</content>
</entry>
<entry>
<title>s390/preempt: Optimize __preemp_count_add()/__preempt_count_sub()</title>
<updated>2026-01-17T14:52:49+00:00</updated>
<author>
<name>Heiko Carstens</name>
<email>hca@linux.ibm.com</email>
</author>
<published>2026-01-13T19:43:58+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=23ba7d31633da6b0706b4154e4eb74cdfab710ef'/>
<id>urn:sha1:23ba7d31633da6b0706b4154e4eb74cdfab710ef</id>
<content type='text'>
Provide an inline assembly using alternatives to avoid the need of a
base register due to relocatable lowcore when adding or subtracting
small constants from preempt_count.

Main user is preempt_disable(), which subtracts one from
preempt_count. With this the generated code changes from

  10012c:       a7 b9 00 00             lghi    %r11,0
  100130:       eb 01 b3 a8 00 6a       asi     936(%r11),1

to something like this:

 10012c:        eb 01 03 a8 00 6a       asi     936,1

Kernel image size is reduced by 13kb (bloat-o-meter -t, defconfig, gcc15).

Reviewed-by: Sven Schnelle &lt;svens@linux.ibm.com&gt;
Signed-off-by: Heiko Carstens &lt;hca@linux.ibm.com&gt;
</content>
</entry>
<entry>
<title>s390/preempt: Optimize preempt_count()</title>
<updated>2026-01-17T14:52:49+00:00</updated>
<author>
<name>Heiko Carstens</name>
<email>hca@linux.ibm.com</email>
</author>
<published>2026-01-13T19:43:57+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=6cce3609a1e0dedeef9b4bfdc87d0d4692f691d7'/>
<id>urn:sha1:6cce3609a1e0dedeef9b4bfdc87d0d4692f691d7</id>
<content type='text'>
Provide an inline assembly using alternatives to avoid the need of
a base register when reading preempt_count() from lowcore. Use the
LLGT instruction, which reads only the least significant 31 bits of
preempt_count. This masks out the encoded PREEMPT_NEED_RESCHED bit.

Generated code is changed from

000000000046e5d0 &lt;vfree&gt;:
  46e5d0:       c0 04 00 00 00 00       jgnop   46e5d0 &lt;vfree&gt;
  46e5d6:       a7 39 00 00             lghi    %r3,0
  46e5da:       58 10 33 a8             l       %r1,936(%r3)
  46e5de:       c0 1b 00 ff ff 00       nilf    %r1,16776960
  46e5e4:       a7 74 00 11             jne     46e606 &lt;vfree+0x36&gt;

to something like this:

000000000046e5d0 &lt;vfree&gt;:
  46e5d0:       c0 04 00 00 00 00       jgnop   46e5d0 &lt;vfree&gt;
  46e5d6:       e3 10 03 a8 00 17       llgt    %r1,936
  46e5dc:       ec 41 28 b7 00 55       risbgz  %r4,%r1,40,55
  46e5e2:       a7 74 00 0f             jne     46e600 &lt;vfree+0x30&gt;

Overall savings are only 82 bytes according to bloat-o-meter. This
is because of different inlining decisions, and there aren't many
preempt_count() users in the kernel.

Reviewed-by: Sven Schnelle &lt;svens@linux.ibm.com&gt;
Signed-off-by: Heiko Carstens &lt;hca@linux.ibm.com&gt;
</content>
</entry>
<entry>
<title>s390/preempt: Optimize __preempt_count_dec_and_test()</title>
<updated>2024-12-15T15:19:03+00:00</updated>
<author>
<name>Heiko Carstens</name>
<email>hca@linux.ibm.com</email>
</author>
<published>2024-12-11T11:58:05+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=5c9e37e5233ec3a6b4f2d160c697b8b28d13f134'/>
<id>urn:sha1:5c9e37e5233ec3a6b4f2d160c697b8b28d13f134</id>
<content type='text'>
Use __atomic_add_const_and_test() within __preempt_count_dec_and_test().
With this it is possible to decrease preempt_count by one and test if
need_resched is set with one instruction, if the compiler has support for
flag output operand constraints.

Reviewed-by: Juergen Christ &lt;jchrist@linux.ibm.com&gt;
Signed-off-by: Heiko Carstens &lt;hca@linux.ibm.com&gt;
Signed-off-by: Alexander Gordeev &lt;agordeev@linux.ibm.com&gt;
</content>
</entry>
<entry>
<title>s390/preempt: Adjust coding style</title>
<updated>2024-12-15T14:13:43+00:00</updated>
<author>
<name>Heiko Carstens</name>
<email>hca@linux.ibm.com</email>
</author>
<published>2024-12-04T11:31:02+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=2ca248f52afa4f55fd3fc2e7c5e123385b192f14'/>
<id>urn:sha1:2ca248f52afa4f55fd3fc2e7c5e123385b192f14</id>
<content type='text'>
Just remove a line break which reduces readability.

Reviewed-by: Alexander Gordeev &lt;agordeev@linux.ibm.com&gt;
Signed-off-by: Heiko Carstens &lt;hca@linux.ibm.com&gt;
Signed-off-by: Alexander Gordeev &lt;agordeev@linux.ibm.com&gt;
</content>
</entry>
<entry>
<title>s390/preempt: Remove special pre MARCH_HAS_Z196_FEATURES implementation</title>
<updated>2024-12-15T14:13:43+00:00</updated>
<author>
<name>Heiko Carstens</name>
<email>hca@linux.ibm.com</email>
</author>
<published>2024-12-04T11:31:01+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=5eee66c5bf6034c84a67fdbf224110f5288d9195'/>
<id>urn:sha1:5eee66c5bf6034c84a67fdbf224110f5288d9195</id>
<content type='text'>
Remove the preempt count implementation for pre MARCH_HAS_Z196_FEATURES
builds. If the kernel is compiled with PREEMPT=n, which is the default for
all distributions, this has close to zero impact in the generated code.

Therefore remove the alternative implementation to keep things simple.

Acked-by: Alexander Gordeev &lt;agordeev@linux.ibm.com&gt;
Signed-off-by: Heiko Carstens &lt;hca@linux.ibm.com&gt;
Signed-off-by: Alexander Gordeev &lt;agordeev@linux.ibm.com&gt;
</content>
</entry>
<entry>
<title>s390/preempt: Add comments</title>
<updated>2024-12-15T14:13:43+00:00</updated>
<author>
<name>Heiko Carstens</name>
<email>hca@linux.ibm.com</email>
</author>
<published>2024-12-04T11:31:00+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=a7af4fb85e208f31cc767245516460b1af287b36'/>
<id>urn:sha1:a7af4fb85e208f31cc767245516460b1af287b36</id>
<content type='text'>
The s390 preempt_count implementation is more or less a copy of the x86
implementation using different instructions. For clarification how this
works also add all comments from x86 with some minor modifications.

Acked-by: Alexander Gordeev &lt;agordeev@linux.ibm.com&gt;
Signed-off-by: Heiko Carstens &lt;hca@linux.ibm.com&gt;
Signed-off-by: Alexander Gordeev &lt;agordeev@linux.ibm.com&gt;
</content>
</entry>
<entry>
<title>s390: Support PREEMPT_DYNAMIC</title>
<updated>2024-11-28T13:12:04+00:00</updated>
<author>
<name>Heiko Carstens</name>
<email>hca@linux.ibm.com</email>
</author>
<published>2024-11-27T16:17:12+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=b5f463486b212c56d837c2592d87de7fb4833662'/>
<id>urn:sha1:b5f463486b212c56d837c2592d87de7fb4833662</id>
<content type='text'>
Select HAVE_PREEMPT_DYNAMIC_KEY and add the pieces which are required to
support PREEMPT_DYNAMIC.

See commit 99cf983cc8bc ("sched/preempt: Add PREEMPT_DYNAMIC using static
keys") and commit 1b2d3451ee50 ("arm64: Support PREEMPT_DYNAMIC") for more
details.

Signed-off-by: Heiko Carstens &lt;hca@linux.ibm.com&gt;
</content>
</entry>
<entry>
<title>s390/preempt: Use arch_try_cmpxchg() instead of __atomic_cmpxchg()</title>
<updated>2024-11-12T13:01:29+00:00</updated>
<author>
<name>Heiko Carstens</name>
<email>hca@linux.ibm.com</email>
</author>
<published>2024-11-06T10:03:14+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=75a98ed6faa03656811922cd383994fa7c300259'/>
<id>urn:sha1:75a98ed6faa03656811922cd383994fa7c300259</id>
<content type='text'>
Use arch_try_cmpxchg() instead of __atomic_cmpxchg() in
preempt_count_set() to generate similar or better code,
depending in compiler features.

Reviewed-by: Juergen Christ &lt;jchrist@linux.ibm.com&gt;
Signed-off-by: Heiko Carstens &lt;hca@linux.ibm.com&gt;
</content>
</entry>
<entry>
<title>s390: Use MARCH_HAS_*_FEATURES defines</title>
<updated>2024-09-07T15:12:42+00:00</updated>
<author>
<name>Heiko Carstens</name>
<email>hca@linux.ibm.com</email>
</author>
<published>2024-09-04T09:39:26+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=ebcc369f18919c92aeca2003618fcfeade04121b'/>
<id>urn:sha1:ebcc369f18919c92aeca2003618fcfeade04121b</id>
<content type='text'>
Replace CONFIG_HAVE_MARCH_*_FEATURES with MARCH_HAS_*_FEATURES
everywhere so code gets compiled correctly depending on if the
target is the kernel or the decompressor.

Reviewed-by: Sven Schnelle &lt;svens@linux.ibm.com&gt;
Signed-off-by: Heiko Carstens &lt;hca@linux.ibm.com&gt;
</content>
</entry>
</feed>
