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 3C4B2C4828E for ; Fri, 2 Feb 2024 10:15:38 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B565D6B0078; Fri, 2 Feb 2024 05:15:37 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id B062E6B007B; Fri, 2 Feb 2024 05:15:37 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9A6A06B0082; Fri, 2 Feb 2024 05:15:37 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 87D016B0078 for ; Fri, 2 Feb 2024 05:15:37 -0500 (EST) Received: from smtpin28.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 5D9CAA013B for ; Fri, 2 Feb 2024 10:15:37 +0000 (UTC) X-FDA: 81746457114.28.21607D4 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.223.131]) by imf26.hostedemail.com (Postfix) with ESMTP id 3D7B9140018 for ; Fri, 2 Feb 2024 10:15:34 +0000 (UTC) Authentication-Results: imf26.hostedemail.com; dkim=pass header.d=suse.com header.s=susede1 header.b=t5NptUfm; dkim=pass header.d=suse.com header.s=susede1 header.b=KDSpFCd3; dmarc=pass (policy=quarantine) header.from=suse.com; spf=pass (imf26.hostedemail.com: domain of mkoutny@suse.com designates 195.135.223.131 as permitted sender) smtp.mailfrom=mkoutny@suse.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1706868935; 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: in-reply-to:in-reply-to:references:references:dkim-signature; bh=YG/G98bRsAnGh877wO+CNpr7OSPc876vz8JKWKpu7x8=; b=KefCk6gkuSbY1rpzSuPEB2Q8DGqUeTYOU4poYeTkib52tIs7ZyaSaa2IULAVro10phkKmf 6oioaDSyBtIDfiG+Uzt1fl9GknmGGsr4f2SZiFvIkF4/Np5wllk5r3dsdMMZW+mFdh4b8b pVKnX2sjqJgDlQq1xVuJ/e+s/tYn9Kg= ARC-Authentication-Results: i=1; imf26.hostedemail.com; dkim=pass header.d=suse.com header.s=susede1 header.b=t5NptUfm; dkim=pass header.d=suse.com header.s=susede1 header.b=KDSpFCd3; dmarc=pass (policy=quarantine) header.from=suse.com; spf=pass (imf26.hostedemail.com: domain of mkoutny@suse.com designates 195.135.223.131 as permitted sender) smtp.mailfrom=mkoutny@suse.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1706868935; a=rsa-sha256; cv=none; b=7mrQBoSDk4/tnHsRSpEGBiSy16DZDB/5FEmM2zVWk/LQn29RI9PwoPtEqpWRzZtlJmHXf9 pRKeT5LG05hW0oO0xBdL3NvliXtNoaiCWCgw5oAz/VujyVcX0gzW5g7kQPpyCGJFQ09JIA Bp+iouKJZltUiKeGnIEPn8U4yOUPdlc= Received: from blackpad (unknown [10.100.12.75]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 58CFC1F461; Fri, 2 Feb 2024 10:15:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1706868933; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=YG/G98bRsAnGh877wO+CNpr7OSPc876vz8JKWKpu7x8=; b=t5NptUfm52ay6TCDiMFIYGgKuDry0bkrabgNwhUrEeWMOj5LMcIhmbfcWOkXw09jBzFxNo 2RE0ujQRjek0Wf25yAizUoO3EFfBg2uT17S0xdFm/LpeEVl/pBGHb5yGMcFcpl1/wGq2xT E+1Nki4QSrgUVEcFS3NUtrkQC1Z1n8s= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1706868932; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=YG/G98bRsAnGh877wO+CNpr7OSPc876vz8JKWKpu7x8=; b=KDSpFCd3kVc5wqknaVaSk2qJ3647XRbzLNQrQDlg6lV0P6KuX2x1yLYAGp7BlvgfJSVx0a 0XrVgWj1v3Fe2yFAJHCr16adkisWRbVzkfJCT/BGHbV68XWard5frxgx1f2C7HhDO369SN mtCza+wH2LLg7J97GGAnRfviryBcIgU= Date: Fri, 2 Feb 2024 11:15:31 +0100 From: Michal =?utf-8?Q?Koutn=C3=BD?= To: Efly Young Cc: hannes@cmpxchg.org, akpm@linux-foundation.org, android-mm@google.com, cgroups@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, mhocko@kernel.org, muchun.song@linux.dev, roman.gushchin@linux.dev, shakeelb@google.com, tjmercier@google.com, yuzhao@google.com Subject: Re: Re: [PATCH] mm: memcg: Use larger chunks for proactive reclaim Message-ID: References: <20240201153428.GA307226@cmpxchg.org> <20240202050247.45167-1-yangyifei03@kuaishou.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="i6547u4e3dsdsmiu" Content-Disposition: inline In-Reply-To: <20240202050247.45167-1-yangyifei03@kuaishou.com> X-Rspam-User: X-Stat-Signature: 7pd39b5prr3xfpjkgom38qa134wsw4np X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 3D7B9140018 X-HE-Tag: 1706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PZdJlMBVKOQsAfekABm+876kemHtJlT5jUYXdxhh8jCsckg6BVB3ypUBhMjlWZRPdJjS2YxLeDB/RG3evO45PpHqbBAPCepk7r10tP/ZdBp7WTEpF53mzyaXVnqdG7bNPMjqmkNEGc9VQbWh/XL/WoqNPWbTFXy62pvFa/ZvVl+ookwjei3jThAW1OXQG9kq0YdWz9nIZcA2+YRgxI6LuM2NeU06AXh0D5gQkETA2CFW3lkdQSMK9eswX21Png= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000046, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: --i6547u4e3dsdsmiu Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Feb 02, 2024 at 01:02:47PM +0800, Efly Young wrote: > > Looking at the code, I'm not quite sure if this can be read this > > literally. Efly might be able to elaborate, but we do a full loop of > > all nodes and cgroups in the tree before checking nr_to_reclaimed, and > > rely on priority level for granularity. So request size and complexity > > of the cgroup tree play a role. I don't know where the exact factor > > two would come from. >=20 > I'm sorry that this conclusion may be arbitrary. It might just only suit > for my case. In my case, I traced it loop twice every time before checking > nr_reclaimed, and it reclaimed less than my request size(1G) every time. > So I think the upper bound is 2 * request. But now it seems that this is > related to cgroup tree I constucted and my system status and my request > size(a relatively large chunk). So there are many influencing factors, > a specific upper bound is not accurate. Alright, thanks for the background. > > IMO it's more accurate to phrase it like this: > >=20 > > Reclaim tries to balance nr_to_reclaim fidelity with fairness across > > nodes and cgroups over which the pages are spread. As such, the bigger > > the request, the bigger the absolute overreclaim error. Historic > > in-kernel users of reclaim have used fixed, small request batches to > > approach an appropriate reclaim rate over time. When we reclaim a user > > request of arbitrary size, use decaying batches to manage error while > > maintaining reasonable throughput. Hm, decay... So shouldn't the formula be nr_pages =3D delta <=3D SWAP_CLUSTER_MAX ? delta : (delta + 3*SWAP_CLUSTE= R_MAX) / 4 where delta =3D nr_to_reclaim - nr_reclaimed ? (So that convergence for smaller deltas is same like original- and other reclaims while conservative factor is applied for effectivity of higher user requests.) Thanks, Michal --i6547u4e3dsdsmiu Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEABYKAB0WIQQpEWyjXuwGT2dDBqAGvrMr/1gcjgUCZbzArwAKCRAGvrMr/1gc jgzbAQCS67JzDKT6wEDM8S72f5VdiKV8t/HeB+VB6/lh57jnsQEAgbHFRm3ydZLW +QPinqIYWeFg0bd97cxxHhyNjoAmswY= =64ep -----END PGP SIGNATURE----- --i6547u4e3dsdsmiu--