Skip to content

x86/cpu: don't allocate fpu->state for swapper/0

Oleg Nesterov lkml stable 1 version Applied

Status from this message: Applied, thanks.

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest1 patch 3 repliesApplied

Patches in v1 Applied

#Subject and filesSizeRepliesApplied
1/1x86/cpu: don't allocate fpu->state for swapper/0arch/x86/kernel/xsave.c+0 -21 reply
1/1x86/cpu: kill eager_fpu_init_bp()arch/x86/kernel/xsave.c+3 -131 reply

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/1] x86/cpu: don't allocate fpu->state for swapper/0

Hello.

This patch is "out of order" a bit, but since Borislav mentioned this during review...

And I was going to send the 2nd one (below), but it turns out that __init_refok is not discarded? So is there any way to do

	void __init init_function();

	void non_init_func()
	{
		if (can_only_be_true_before_free_initmem)
			init_function();
	}

and avoid the warning?

Fenghua, could you please explain the SYSTEM_BOOTING check in __save_fpu? It was added by f41d830fa8900 "x86/xsaves: Save xstate to task's xsave area in __save_fpu during booting time", the changelog says:

__save_fpu() can be called during early booting time

how? from where? Do we expect math_error()->unlazy_fpu() at boot time, or what?

Oleg.

arch/x86/kernel/xsave.c +3 -13
@@ -532,7 +532,7 @@ void setup_xstate_comp(void)
 /*
  * setup the xstate image representing the init state
  */
-static void __init setup_init_fpu_buf(void)
+static noinline void __init_refok setup_init_fpu_buf(void)
 {
 	/*
 	 * Setup init_xstate_buf to represent the init state of
@@ -677,16 +677,8 @@ void xsave_init(void)
 	this_func();
 }
 
-static inline void __init eager_fpu_init_bp(void)
-{
-	if (!init_xstate_buf)
-		setup_init_fpu_buf();
-}
-
 void eager_fpu_init(void)
 {
-	static __refdata void (*boot_func)(void) = eager_fpu_init_bp;
-
 	WARN_ON(used_math());
 	current_thread_info()->status = 0;
 
@@ -698,10 +690,8 @@ void eager_fpu_init(void)
 		return;
 	}
 
-	if (boot_func) {
-		boot_func();
-		boot_func = NULL;
-	}
+	if (!init_xstate_buf)
+		setup_init_fpu_buf();
 }
 
 /*