Re: [PATCH] x86: Optimize load_mm_cr4 to load_mm_cr4_irqsoff

From: Jan Kiszka
Date: Tue Jun 18 2019 - 11:02:32 EST


On 18.06.19 16:41, Dave Hansen wrote:
On 6/18/19 12:32 AM, Jan Kiszka wrote:
Thus, we can avoid disabling interrupts again in cr4_set/clear_bits.

Seems reasonable.

Your *_irqsoff() variants need lockdep_assert_irqs_disabled(), at least,
though.

It inherits this check via __cr4_set, so I didn't add that to the outer path.


Can you talk a bit about the motivation here, though? Did you encounter
some performance issue that led you to make this patch, or was it simply
an improvement you realized you could make from code inspection?


I ran into a downstream issue adjusting patches to this code. In a nutshell, Xenomai has something like an NMI context over most Linux code that shares some codepaths with the kernel, though. One of them is switch_mm_irqs_off, and there our checking logic warned. The rest was code inspection.

For upstream, this is a micro-optimization. But given that something like switch_mm is in the path, I thought it's worth to propose.

Jan

--
Siemens AG, Corporate Technology, CT RDA IOT SES-DE
Corporate Competence Center Embedded Linux