• Honggyu Kim's avatar
    mm/damon/paddr: introduce DAMOS_MIGRATE_COLD action for demotion · b51820eb
    Honggyu Kim authored
    This patch introduces DAMOS_MIGRATE_COLD action, which is similar to
    DAMOS_PAGEOUT, but migrate folios to the given 'target_nid' in the sysfs
    instead of swapping them out.
    
    The 'target_nid' sysfs knob informs the migration target node ID.
    
    Here is one of the example usage of this 'migrate_cold' action.
    
      $ cd /sys/kernel/mm/damon/admin/kdamonds/<N>
      $ cat contexts/<N>/schemes/<N>/action
      migrate_cold
      $ echo 2 > contexts/<N>/schemes/<N>/target_nid
      $ echo commit > state
      $ numactl -p 0 ./hot_cold 500M 600M &
      $ numastat -c -p hot_cold
    
      Per-node process memory usage (in MBs)
      PID             Node 0 Node 1 Node 2 Total
      --------------  ------ ------ ------ -----
      701 (hot_cold)     501      0    601  1101
    
    Since there are some common routines with pageout, many functions have
    similar logics between pageout and migrate cold.
    
    damon_pa_migrate_folio_list() is a minimized version of
    shrink_folio_list().
    
    Link: https://lkml.kernel.org/r/20240614030010.751-6-honggyu.kim@sk.comSigned-off-by: default avatarHonggyu Kim <honggyu.kim@sk.com>
    Signed-off-by: default avatarHyeongtak Ji <hyeongtak.ji@sk.com>
    Signed-off-by: default avatarSeongJae Park <sj@kernel.org>
    Cc: Gregory Price <gregory.price@memverge.com>
    Cc: Hyeonggon Yoo <42.hyeyoo@gmail.com>
    Cc: Masami Hiramatsu (Google) <mhiramat@kernel.org>
    Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
    Cc: Rakie Kim <rakie.kim@sk.com>
    Cc: Steven Rostedt (Google) <rostedt@goodmis.org>
    Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
    b51820eb
sysfs-schemes.c 62.7 KB