me config: PREEMPT=n DEBUG_PREEMPT=n NO_HZ_FULL=n NO_HZ_IDLE=y STACKPROTECTOR_STRONG=y On my device, these patches have very little effect when mitigations off, but the improvement was still very noticeable when the mitigation was on. I suspect this is because I'm using a recent Ryzen CPU with a very powerful instruction cache and branch prediction capabilities, so without considering the Spectre vulnerability, inlining is less effective. However, on embedded devices with small instruction caches, these patches should still be effective even with mitigations off. Placing related functions and data close together in the binary is a common compiler optimization. For example, the cold and hot attributes will place codes in ".text.hot" and ".text.cold" sections. This reduces cache misses for instruction and data caches. The current code adds the __sched attribute to the __schedule function (placing it into ".text.sched" section), but not to finish_task_switch, causing them to be very far apart in the binary. If the __schedule function didn't have the __sched attribute, both would be in the .text section of the sched.o translation unit. Thus, the __sched attribute in the __schedule function actually causes a degradation, and inlining finish_task_switch can alleviate this problem. Xie Yuanbin[PATCH 0/3] Optimize code generation during contextXie Yuanbin undefinedpeterz@infradead.org, linux@armlinux.org.uk, mathieu.desnoyers@efficios.com, paulmck@kernel.org, pjw@kernel.org, palmer@dabbelt.com, aou@eecs.berkeley.edu, alex@ghiti.fr, hca@linux.ibm.com, gor@linux.ibm.com, agordeev@linux.ibm.com, borntraeger@linux.ibm.com, svens@linux.ibm.com, davem@davemloft.net, andreas@gaisler.com, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, hpa@zytor.com, luto@kernel.org, acme@kernel.org, namhyung@kernel.org, mark.rutland@arm.com, alexander.shishkin@linux.intel.com, jolsa@kernel.org, irogers@google.com, adrian.hunter@intel.com, anna-maria@linutronix.de, frederic@kernel.org, juri.lelli@redhat.com, vincent.guittot@linaro.org, dietmar.eggemann@arm.com, rostedt@goodmis.org, bsegall@google.com, mgorman@suse.de, vschneid@redhat.com, qq570070308@gmail.com, thuth@redhat.com, riel@surriel.com, akpm@linux-foundation.org, david@redhat.com, lorenzo.stoakes@oracle.com, segher@kernel.crashing.org, ryan.roberts@arm.com, max.kellermann@ionos.com, urezki@gmail.com, nysal@linux.ibm.com undefined undefined undefined undefined undefined undefined undefined undefined undefined undefined undefined undefined undefined undefined undefined undefined undefined undefined undefined undefined undefined undefined undefined undefined undefined undefined undefined undefined undefined undefined undefined undefined undefined undefined undefined undefined undefined undefined undefined undefined undefined undefined undefined undefined undefined undefined undefined undefined undefined undefined undefined undefined undefined undefined undefined