Skip to content

Commit 8391953

Browse files
davidhildenbrandtorvalds
authored andcommitted
mm/shuffle: remove dynamic reconfiguration
Commit e900a91 ("mm: shuffle initial free memory to improve memory-side-cache utilization") promised "autodetection of a memory-side-cache (to be added in a follow-on patch)" over a year ago. The original series included patches [1], however, they were dropped during review [2] to be followed-up later. Due to lack of platforms that publish an HMAT, autodetection is currently not implemented. However, manual activation is actively used [3]. Let's simplify for now and re-add when really (ever?) needed. [1] https://lkml.kernel.org/r/154510700291.1941238.817190985966612531.stgit@dwillia2-desk3.amr.corp.intel.com [2] https://lkml.kernel.org/r/154690326478.676627.103843791978176914.stgit@dwillia2-desk3.amr.corp.intel.com [3] https://lkml.kernel.org/r/CAPcyv4irwGUU2x+c6b4L=KbB1dnasNKaaZd6oSpYjL9kfsnROQ@mail.gmail.com Signed-off-by: David Hildenbrand <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Reviewed-by: Wei Yang <[email protected]> Acked-by: Dan Williams <[email protected]> Acked-by: Michal Hocko <[email protected]> Cc: Johannes Weiner <[email protected]> Cc: Michal Hocko <[email protected]> Cc: Minchan Kim <[email protected]> Cc: Huang Ying <[email protected]> Cc: Wei Yang <[email protected]> Cc: Mel Gorman <[email protected]> Cc: Dan Williams <[email protected]> Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Linus Torvalds <[email protected]>
1 parent 93146d9 commit 8391953

File tree

2 files changed

+2
-43
lines changed

2 files changed

+2
-43
lines changed

mm/shuffle.c

Lines changed: 2 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -10,33 +10,11 @@
1010
#include "shuffle.h"
1111

1212
DEFINE_STATIC_KEY_FALSE(page_alloc_shuffle_key);
13-
static unsigned long shuffle_state __ro_after_init;
14-
15-
/*
16-
* Depending on the architecture, module parameter parsing may run
17-
* before, or after the cache detection. SHUFFLE_FORCE_DISABLE prevents,
18-
* or reverts the enabling of the shuffle implementation. SHUFFLE_ENABLE
19-
* attempts to turn on the implementation, but aborts if it finds
20-
* SHUFFLE_FORCE_DISABLE already set.
21-
*/
22-
__meminit void page_alloc_shuffle(enum mm_shuffle_ctl ctl)
23-
{
24-
if (ctl == SHUFFLE_FORCE_DISABLE)
25-
set_bit(SHUFFLE_FORCE_DISABLE, &shuffle_state);
26-
27-
if (test_bit(SHUFFLE_FORCE_DISABLE, &shuffle_state)) {
28-
if (test_and_clear_bit(SHUFFLE_ENABLE, &shuffle_state))
29-
static_branch_disable(&page_alloc_shuffle_key);
30-
} else if (ctl == SHUFFLE_ENABLE
31-
&& !test_and_set_bit(SHUFFLE_ENABLE, &shuffle_state))
32-
static_branch_enable(&page_alloc_shuffle_key);
33-
}
3413

3514
static bool shuffle_param;
3615
static int shuffle_show(char *buffer, const struct kernel_param *kp)
3716
{
38-
return sprintf(buffer, "%c\n", test_bit(SHUFFLE_ENABLE, &shuffle_state)
39-
? 'Y' : 'N');
17+
return sprintf(buffer, "%c\n", shuffle_param ? 'Y' : 'N');
4018
}
4119

4220
static __meminit int shuffle_store(const char *val,
@@ -47,9 +25,7 @@ static __meminit int shuffle_store(const char *val,
4725
if (rc < 0)
4826
return rc;
4927
if (shuffle_param)
50-
page_alloc_shuffle(SHUFFLE_ENABLE);
51-
else
52-
page_alloc_shuffle(SHUFFLE_FORCE_DISABLE);
28+
static_branch_enable(&page_alloc_shuffle_key);
5329
return 0;
5430
}
5531
module_param_call(shuffle, shuffle_store, shuffle_show, &shuffle_param, 0400);

mm/shuffle.h

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,10 @@
44
#define _MM_SHUFFLE_H
55
#include <linux/jump_label.h>
66

7-
/*
8-
* SHUFFLE_ENABLE is called from the command line enabling path, or by
9-
* platform-firmware enabling that indicates the presence of a
10-
* direct-mapped memory-side-cache. SHUFFLE_FORCE_DISABLE is called from
11-
* the command line path and overrides any previous or future
12-
* SHUFFLE_ENABLE.
13-
*/
14-
enum mm_shuffle_ctl {
15-
SHUFFLE_ENABLE,
16-
SHUFFLE_FORCE_DISABLE,
17-
};
18-
197
#define SHUFFLE_ORDER (MAX_ORDER-1)
208

219
#ifdef CONFIG_SHUFFLE_PAGE_ALLOCATOR
2210
DECLARE_STATIC_KEY_FALSE(page_alloc_shuffle_key);
23-
extern void page_alloc_shuffle(enum mm_shuffle_ctl ctl);
2411
extern void __shuffle_free_memory(pg_data_t *pgdat);
2512
extern bool shuffle_pick_tail(void);
2613
static inline void shuffle_free_memory(pg_data_t *pgdat)
@@ -58,10 +45,6 @@ static inline void shuffle_zone(struct zone *z)
5845
{
5946
}
6047

61-
static inline void page_alloc_shuffle(enum mm_shuffle_ctl ctl)
62-
{
63-
}
64-
6548
static inline bool is_shuffle_order(int order)
6649
{
6750
return false;

0 commit comments

Comments
 (0)