Commit 1eeaa4fd authored by Liu Shixin's avatar Liu Shixin Committed by Andrew Morton
Browse files

memory: move hotplug memory notifier priority to same file for easy sorting

The priority of hotplug memory callback is defined in a different file. 
And there are some callers using numbers directly.  Collect them together
into include/linux/memory.h for easy reading.  This allows us to sort
their priorities more intuitively without additional comments.

Link: https://lkml.kernel.org/r/20220923033347.3935160-9-liushixin2@huawei.com


Signed-off-by: default avatarLiu Shixin <liushixin2@huawei.com>
Cc: Christoph Lameter <cl@linux.com>
Cc: David Hildenbrand <david@redhat.com>
Cc: Kefeng Wang <wangkefeng.wang@huawei.com>
Cc: Waiman Long <longman@redhat.com>
Cc: zefan li <lizefan.x@bytedance.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
parent eafd296e
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -849,7 +849,7 @@ static __init int hmat_init(void)
	hmat_register_targets();

	/* Keep the table and structures if the notifier may use them */
	if (!hotplug_memory_notifier(hmat_callback, 2))
	if (!hotplug_memory_notifier(hmat_callback, HMAT_CALLBACK_PRI))
		return 0;
out_put:
	hmat_free_structures();
+1 −1
Original line number Diff line number Diff line
@@ -689,7 +689,7 @@ static int __init proc_kcore_init(void)
	add_modules_range();
	/* Store direct-map area from physical memory map */
	kcore_update_ram();
	hotplug_memory_notifier(kcore_callback, 0);
	hotplug_memory_notifier(kcore_callback, DEFAULT_CALLBACK_PRI);

	return 0;
}
+0 −1
Original line number Diff line number Diff line
@@ -18,7 +18,6 @@
 * the same memory tier.
 */
#define MEMTIER_ADISTANCE_DRAM	((4 * MEMTIER_CHUNK_SIZE) + (MEMTIER_CHUNK_SIZE >> 1))
#define MEMTIER_HOTPLUG_PRIO	100

struct memory_tier;
struct memory_dev_type {
+7 −2
Original line number Diff line number Diff line
@@ -112,8 +112,13 @@ struct mem_section;
 * Priorities for the hotplug memory callback routines (stored in decreasing
 * order in the callback chain)
 */
#define DEFAULT_CALLBACK_PRI	0
#define SLAB_CALLBACK_PRI	1
#define IPC_CALLBACK_PRI        10
#define HMAT_CALLBACK_PRI	2
#define MM_COMPUTE_BATCH_PRI	10
#define CPUSET_CALLBACK_PRI	10
#define MEMTIER_HOTPLUG_PRI	100
#define KSM_CALLBACK_PRI	100

#ifndef CONFIG_MEMORY_HOTPLUG
static inline void memory_dev_init(void)
+1 −1
Original line number Diff line number Diff line
@@ -3647,7 +3647,7 @@ void __init cpuset_init_smp(void)
	cpumask_copy(top_cpuset.effective_cpus, cpu_active_mask);
	top_cpuset.effective_mems = node_states[N_MEMORY];

	hotplug_memory_notifier(cpuset_track_online_nodes, 10);
	hotplug_memory_notifier(cpuset_track_online_nodes, CPUSET_CALLBACK_PRI);

	cpuset_migrate_mm_wq = alloc_ordered_workqueue("cpuset_migrate_mm", 0);
	BUG_ON(!cpuset_migrate_mm_wq);
Loading