OSDN Git Service

mm: migrate: make demotion knob depend on migration
authorYang Shi <shy828301@gmail.com>
Fri, 5 Nov 2021 20:43:35 +0000 (13:43 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Sat, 6 Nov 2021 20:30:41 +0000 (13:30 -0700)
commit20f9ba4f995247bb79e243741b8fdddbd76dd923
tree3cff618b212a94b4b4a80edb0c3084d39b0313a6
parent8eb42beac8d369f5443addd469879d152422a28d
mm: migrate: make demotion knob depend on migration

The memory demotion needs to call migrate_pages() to do the jobs.  And
it is controlled by a knob, however, the knob doesn't depend on
CONFIG_MIGRATION.  The knob could be truned on even though MIGRATION is
disabled, this will not cause any crash since migrate_pages() would just
return -ENOSYS.  But it is definitely not optimal to go through demotion
path then retry regular swap every time.

And it doesn't make too much sense to have the knob visible to the users
when !MIGRATION.  Move the related code from mempolicy.[h|c] to
migrate.[h|c].

Link: https://lkml.kernel.org/r/20211015005559.246709-1-shy828301@gmail.com
Signed-off-by: Yang Shi <shy828301@gmail.com>
Acked-by: "Huang, Ying" <ying.huang@intel.com>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
include/linux/mempolicy.h
include/linux/migrate.h
mm/mempolicy.c
mm/migrate.c