linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm/vmscan: when the swappiness is set to 0, memory swapping should be prohibited during the global reclaim process
@ 2025-02-27 14:34 ying chen
  2025-02-27 15:54 ` Joshua Hahn
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: ying chen @ 2025-02-27 14:34 UTC (permalink / raw)
  To: akpm, linux-mm, linux-kernel

When we use zram as swap disks, global reclaim may cause the memory in some
cgroups with memory.swappiness set to 0 to be swapped into zram. This memory
won't be swapped back immediately after the free memory increases. Instead,
it will continue to occupy the zram space, which may result in no available
zram space for the cgroups with swapping enabled. Therefore, I think that
when the vm.swappiness is set to 0, global reclaim should also refrain
from memory swapping, just like these cgroups.

Signed-off-by: yc1082463 <yc1082463@gmail.com>
---
 mm/vmscan.c | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)

diff --git a/mm/vmscan.c b/mm/vmscan.c
index c767d71c43d7..bdbb0fc03412 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -2426,14 +2426,7 @@ static void get_scan_count(struct lruvec
*lruvec, struct scan_control *sc,
                goto out;
        }

-       /*
-        * Global reclaim will swap to prevent OOM even with no
-        * swappiness, but memcg users want to use this knob to
-        * disable swapping for individual groups completely when
-        * using the memory controller's swap limit feature would be
-        * too expensive.
-        */
-       if (cgroup_reclaim(sc) && !swappiness) {
+       if (!swappiness) {
                scan_balance = SCAN_FILE;
                goto out;
        }
--
2.34.1


^ permalink raw reply	[flat|nested] 10+ messages in thread
* [PATCH] mm/vmscan: when the swappiness is set to 0, memory swapping should be prohibited during the global reclaim process
@ 2025-02-27  7:51 ying chen
  0 siblings, 0 replies; 10+ messages in thread
From: ying chen @ 2025-02-27  7:51 UTC (permalink / raw)
  To: akpm, linux-mm, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 1633 bytes --]

From 512ea4430805983e949526cce2179d0c37f54450 Mon Sep 17 00:00:00 2001
From: yc1082463 <yc1082463@gmail.com>
Date: Thu, 27 Feb 2025 15:28:28 +0800
Subject: [PATCH] mm/vmscan: when the swappiness is set to 0, memory swapping
 should be prohibited during the global reclaim process.

When we use zram as swap disks, global reclaim may cause the memory in some
cgroups with memory.swappiness set to 0 to be swapped into zram. This memory
won't be swapped back immediately after the free memory increases. Instead,
it will continue to occupy the zram space, which may result in no available
zram space for the cgroups with swapping enabled. Therefore, I think that
when the vm.swappiness is set to 0, global reclaim should also refrain
from memory swapping, just like these cgroups.

Signed-off-by: yc1082463 <yc1082463@gmail.com>
---
 mm/vmscan.c | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)

diff --git a/mm/vmscan.c b/mm/vmscan.c
index c767d71c43d7..bdbb0fc03412 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -2426,14 +2426,7 @@ static void get_scan_count(struct lruvec *lruvec,
struct scan_control *sc,
                goto out;
        }

-       /*
-        * Global reclaim will swap to prevent OOM even with no
-        * swappiness, but memcg users want to use this knob to
-        * disable swapping for individual groups completely when
-        * using the memory controller's swap limit feature would be
-        * too expensive.
-        */
-       if (cgroup_reclaim(sc) && !swappiness) {
+       if (!swappiness) {
                scan_balance = SCAN_FILE;
                goto out;
        }
--
2.34.1

[-- Attachment #2: Type: text/html, Size: 1957 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2025-03-03 12:07 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-02-27 14:34 [PATCH] mm/vmscan: when the swappiness is set to 0, memory swapping should be prohibited during the global reclaim process ying chen
2025-02-27 15:54 ` Joshua Hahn
2025-02-27 16:19   ` Johannes Weiner
2025-02-28  3:18     ` ying chen
2025-02-28  3:21     ` Yafang Shao
2025-02-28  3:16   ` ying chen
2025-02-27 19:12 ` Shakeel Butt
2025-02-28  2:48   ` ying chen
2025-03-03 12:07 ` Michal Hocko
  -- strict thread matches above, loose matches on Subject: below --
2025-02-27  7:51 ying chen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox