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

From: Oleg Nesterov
Date: Fri Mar 13 2015 - 14:29:11 EST


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.


--- a/arch/x86/kernel/xsave.c
+++ b/arch/x86/kernel/xsave.c
@@ -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();
}

/*

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/