From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3FEBDC19F32 for ; Fri, 28 Feb 2025 03:16:42 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B27FD280001; Thu, 27 Feb 2025 22:16:41 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id AD8116B0085; Thu, 27 Feb 2025 22:16:41 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 99FA8280001; Thu, 27 Feb 2025 22:16:41 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 7C4C56B0083 for ; Thu, 27 Feb 2025 22:16:41 -0500 (EST) Received: from smtpin17.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 1E3D01A2282 for ; Fri, 28 Feb 2025 03:16:41 +0000 (UTC) X-FDA: 83167891002.17.E21BF4B Received: from mail-ej1-f66.google.com (mail-ej1-f66.google.com [209.85.218.66]) by imf23.hostedemail.com (Postfix) with ESMTP id 21A98140008 for ; Fri, 28 Feb 2025 03:16:38 +0000 (UTC) Authentication-Results: imf23.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=Hi2Gt5ey; spf=pass (imf23.hostedemail.com: domain of yc1082463@gmail.com designates 209.85.218.66 as permitted sender) smtp.mailfrom=yc1082463@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1740712599; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=AsQv1V81RoMvDet1T87kyc/NnMb5goNVEAJP9Aqhjow=; b=hItlHm0AugsuYEWD/vIEDfS8wnLEtlzex1fPbSVcPMXtem5S4YjjfrijJaR/HM7wIZl49t GNFKRs9oMXCiSKagoKZP4Ni0NSLgMms6xQh47HkoEphXDqQzXv1T6mDQu8EipWo5R8fDap WAf9ta+WKCZstcC5+jA2wV9Dw4hILfk= ARC-Authentication-Results: i=1; imf23.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=Hi2Gt5ey; spf=pass (imf23.hostedemail.com: domain of yc1082463@gmail.com designates 209.85.218.66 as permitted sender) smtp.mailfrom=yc1082463@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1740712599; a=rsa-sha256; cv=none; b=oyohJdAsbaSaMRLBVy7i+KdQu4LThxzGrV1IZeoaABaSh/hYE0Al4eKH6A0ZdTrUuA/Fy9 WN+96R3VSYL/FjHnPuaFRO1WxlvzSD+mltWdcCa6dmQ7646RyuoYqmxgQOrNMFkuxiF+Yr VCeUHvy7yNX5JgXmB8y9QIkB+4yIx2Q= Received: by mail-ej1-f66.google.com with SMTP id a640c23a62f3a-abbec6a0bfeso253180866b.2 for ; Thu, 27 Feb 2025 19:16:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1740712597; x=1741317397; darn=kvack.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=AsQv1V81RoMvDet1T87kyc/NnMb5goNVEAJP9Aqhjow=; b=Hi2Gt5eyvaVp62/v7+ORb6wncyfYVpBWDbQGgo7m+QzlKZVSgWd7bgVYKB9Bgd/Ekw 9LnTawNt8H5xojZJaLKc4XHrg7mw5yHja2BbKaqEnu9f8Rjq8mzZuZYPKvCyxF00cp6C C+KENESnVSbcw7c3byhsMuHlEPIIrAa2uYPgtFKrStL+MHan5eq5RTPjJTXchhOPgaZM 7Be5w5zZvSkBxexmw1J0ULXw2xOXYV7FJwP4hmOGjZaQ1gEy26d6mKFl5hcsPshddOHL Z0gDrq3qzyT0ipsEnBxnJC0+h6xwVPddq0FjqTe9xndFRho8whQzCLo1S80ck7vURlio vMxg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1740712597; x=1741317397; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=AsQv1V81RoMvDet1T87kyc/NnMb5goNVEAJP9Aqhjow=; b=MqssXtMGrTA6p0dtw7mf+rQ3v9PMWErcSSQtvawqsXKEmNCh3wBjrAhkROlKV6dE7S 7+hdpr5lHEygivfHV6mZ7i4FwqggXVQRdmyaxJ4QGGQkl3S9KJwz4uiML0y6Fpv8w6WW OO3u1lpWDUW1jonS7k5qe2iA9rkDE1gyaYz9BTZ7/mP970NmefGhq2jYzZ8NkO2v1ZQk 4TcaqtTH6jPynEqLhKa34TDXRmau0X3hbKjQszhheU7UrHYPa8wzwjom/wKOlUwY2ZzM 89UrNgcsobK8ErFMmkuvb4P6TnDmMzhbjVtFNzw15xqz17tRBQVtusC5/bTS9B67v/4m RUvg== X-Forwarded-Encrypted: i=1; AJvYcCVUiwIopMYc10iug6QrqkNjDUHsjrynB966dbhbcIkhaMZ8WAjBlxH8Rb9ypAKM3Dj3CeKaYXJTuw==@kvack.org X-Gm-Message-State: AOJu0YwJjgcXmwrYHfcZDupZ127BYUW/G/HPsiejdGHdOKA1bBw+r3/F NcgVvS0a+mNK6Ma71X1wD8i/zG6eVoc2fLzymL9unBWD48xUuREDpHMVc1QONkphdwllV/ahMvS yfKRmcLUto5KwejxyQBrJ79QmXRQ= X-Gm-Gg: ASbGncusdVf9m8gu1RBO7sAmRsvmSSxXzImUowg1zIAq4PJw+DODbruxT2AkoT1YRO+ txVJlH88BUSqxcuT4U7OBdZZFhw5B8CLw6dhqHklVfzoAUp9yUff8NtKa8mgNk7t64H/ZieJQU2 +WQ3MxuTpS X-Google-Smtp-Source: AGHT+IGtTLidtoJ1+wTRTSrRYN6Stb7rU8rJHiX+Hp1pZywNzcYDvnpR3lE67iaDxJfTRHQve0GKBK5FjyIMDANyQ8U= X-Received: by 2002:a17:907:7f0f:b0:ab6:b9c0:1ea2 with SMTP id a640c23a62f3a-abf261f2529mr163289766b.25.1740712597351; Thu, 27 Feb 2025 19:16:37 -0800 (PST) MIME-Version: 1.0 References: <20250227155431.2534325-1-joshua.hahnjy@gmail.com> In-Reply-To: <20250227155431.2534325-1-joshua.hahnjy@gmail.com> From: ying chen Date: Fri, 28 Feb 2025 11:16:25 +0800 X-Gm-Features: AQ5f1Jryxw3FMTA2IoyXpHhM2strZZsKlz0OOnXnnAoM-bqY5L_DIGfHx66LEFI Message-ID: Subject: Re: [PATCH] mm/vmscan: when the swappiness is set to 0, memory swapping should be prohibited during the global reclaim process To: Joshua Hahn Cc: akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, hannes@cmpxchg.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Rspam-User: X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: 21A98140008 X-Stat-Signature: t874sxtw577gfy1muoojqzr1egjoo91n X-HE-Tag: 1740712598-757012 X-HE-Meta: U2FsdGVkX193O0k8QfH2cSO2KFXQSRziuZ2zDFXtEZB0PMAuWynHOQV4A/OGPVzwi1vsOgoAR0ZOaUN4uEbVgTX32Xp+Vnt8xNhqMn7Id/9kHJEoHLlRRHJayVBDWro3eVpQbdDpK3tpBMwgsGjl+PSl0on+wq1KKmw6Or5YIQHTYYIiBf7gIl5zRALWUEbjUldxpkZ4YFYkibrU5lWPE8j9gAEs30I8Hvo2UvfhehLpw3dhs6/1mgMAVK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pxG1sb6wdzJ/ucQJIEkF3TPL0d5gh27OFu/sVGMXm97/DA4CKcfLzYAbxyn0HMsMnv8OM5smUhdvEghtkNDpmoghrJhbQreVn/ZrOxqFvcPBFdsK+JlwduUDIziGuuBS9iNQQl89yI2Sc11exvTifGQ12UMkStfwIHy2MuDMNQ1YM38mcMeqm7tNYy8aKM+HDje5N9hBqfr9Y9nT+IPKJCJSJgeBe/3a56jTn6eew1vYCRvuazJXdyGZj9iwubgAgEkU8Up/d9AF3Tdibv+OwLnlsmZO0rxXXSY+JL6UKI/svmxts4lFwkvO2Ai3J75tnEkwu X-Bogosity: Ham, tests=bogofilter, spamicity=0.001162, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: We only create a limited zram disk size for the cgroups that allow swapping= . If this part of the swap space is occupied by other cgroups that don't allow swapping, the cgroups that allow swapping may not have enough swap space available. On Thu, Feb 27, 2025 at 11:54=E2=80=AFPM Joshua Hahn wrote: > > On Thu, 27 Feb 2025 22:34:51 +0800 ying chen wrote: > > Hi Ying, > > I hope you are having a great day! I wanted to share a few thoughts: > > Previously, when the system is under a lot of memory pressure and is > facing OOMs, global reclaim can create space for the system and prevent > going out of memory by swapping, even when swappiness is 0. If this patch > removes that check, it would mean that global reclaim can no longer > "bypass" the swappiness =3D=3D 0 condition. > > I am also CCing Johannes, who is the original author of this section [1], > who clarified in the patch that swappiness =3D=3D 0 has different meaning= s for > global reclaim and memory cgroup reclaim. > > > 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 m= emory > > won't be swapped back immediately after the free memory increases. Inst= ead, > > it will continue to occupy the zram space, which may result in no avail= able > > zram space for the cgroups with swapping enabled. Therefore, I think th= at > > IMHO, I think that even with zram, we would still want to allow the syste= m > to reclaim memory & swap out, in case we are facing imminent OOMs. Even i= f > the memory isn't immediately swapped back in when we are able to manage t= he > memory spike and see free memory, I imagine that we might not even be abl= e > to manage the spike if we prevent global reclaim from swapping. > > These are just some thoughts that I had about the patch. However, my > understanding of zram and reclaim is limited; please feel free to > correct me if you see anything that I am not understanding correctly. > > Thank you for your time, have a great day! > Joshua > > [1] https://lore.kernel.org/linux-mm/1355767957-4913-4-git-send-email-han= nes@cmpxchg.org/ > > > when the vm.swappiness is set to 0, global reclaim should also refrain > > from memory swapping, just like these cgroups. > > > > Signed-off-by: yc1082463 > > --- > > 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 =3D SCAN_FILE; > > goto out; > > } > > -- > > 2.34.1 > > Sent using hkml (https://github.com/sjp38/hackermail) >