_tlbstate_shared variables are global, it can be completely inline. In fact, the implementation of this function on other architectures is inline. This series of patches mainly does the following things: 1. Change enter_lazy_tlb to inline on x86. 2. Let the finish_task_switch function be called inline during context switching. 3. Set the subfunctions called by finish_task_switch to be inline: When finish_task_switch is changed to an inline func, the number of calls to the subfunctions(which called by finish_task_switch) in this translation unit increases due to the inline expansion of the finish_task_switch function. For example, the finish_lock_switch function originally had only one calling point in core.o (in finish_task_switch func), but because the finish_task_switch was inlined, the calling points become two. Due to compiler optimization strategies, these subfunctions may transition from inline functions to non inline functions, which can actually lead to performance degradation. So I modify some subfunctions of finish_task_stwitch to be always inline to prevent degradation. These functions are either very short or are only called once in the entire kernel, so they do not have a big impact on the size. This series of patches does not find any impact on the size of the bzImage image (using Os to build). Xie Yuanbin (3): arch/arm/include/asm/mmu_context.h | 6 +++++- arch/riscv/include/asm/sync_core.h | 2 +- arch/s390/include/asm/mmu_context.h | 6 +++++- arch/sparc/include/asm/mmu_context_64.h | 6 +++++- arch/x86/include/asm/mmu_context.h | 22 +++++++++++++++++++++- arch/x86/include/asm/sync_core.h | 2 +- arch/x86/mm/tlb.c | 21 --------------------- include/linux/perf_event.h | 2 +- include/linux/sched/mm.h | 10 +++++----- include/linux/tick.h | 4 ++-- include/linux/vtime.h | 8 ++++---- kernel/sched/core.c | 20 +++++++++++++------- 12 files changed, 63 insertions(+), 46 deletions(-) -- 2.51.0[PATCH 0/3] Optimize code generation during context switchingXie Yuanbin undefinedlinux@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, peterz@infradead.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“`ƒÄX