mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-30 19:51:31 -04:00
x86/mm/mtrr: Mark the 'range_new' static variable in mtrr_calc_range_state() as __initdata
'range_new' doesn't seem to be used after init. It is only passed to memset(), sum_ranges(), memcmp() and x86_get_mtrr_mem_range(), the latter of which also only passes it on to various *range* library functions. So mark it __initdata to free up an extra page after init. Its contents are wiped at every call to mtrr_calc_range_state(), so it being static is not about preserving state between calls, but simply to avoid a 4k+ stack frame. While there, add a comment explaining this and why it's safe. We could also mark nr_range_new as __initdata, but since it's just a single int and also doesn't carry state between calls (it is unconditionally assigned to before it is read), we might as well make it an ordinary automatic variable. Signed-off-by: Rasmus Villemoes <[email protected]> Cc: H. Peter Anvin <[email protected]> Cc: Linus Torvalds <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Thomas Gleixner <[email protected]> Cc: Toshi Kani <[email protected]> Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Ingo Molnar <[email protected]>
This commit is contained in:
parent
8609d1b5da
commit
c332813b51
1 changed files with 9 additions and 2 deletions
|
|
@ -593,9 +593,16 @@ mtrr_calc_range_state(u64 chunk_size, u64 gran_size,
|
|||
unsigned long x_remove_base,
|
||||
unsigned long x_remove_size, int i)
|
||||
{
|
||||
static struct range range_new[RANGE_NUM];
|
||||
/*
|
||||
* range_new should really be an automatic variable, but
|
||||
* putting 4096 bytes on the stack is frowned upon, to put it
|
||||
* mildly. It is safe to make it a static __initdata variable,
|
||||
* since mtrr_calc_range_state is only called during init and
|
||||
* there's no way it will call itself recursively.
|
||||
*/
|
||||
static struct range range_new[RANGE_NUM] __initdata;
|
||||
unsigned long range_sums_new;
|
||||
static int nr_range_new;
|
||||
int nr_range_new;
|
||||
int num_reg;
|
||||
|
||||
/* Convert ranges to var ranges state: */
|
||||
|
|
|
|||
Loading…
Reference in a new issue