Received: by 2002:a05:7412:d1aa:b0:fc:a2b0:25d7 with SMTP id ba42csp1262780rdb; Tue, 30 Jan 2024 12:58:47 -0800 (PST) X-Google-Smtp-Source: AGHT+IHLNCh57mEvGPVSvuLcs6Pt94yMECIQwOZUTAz1WdUmC14nQy3CT6quas8OfI3Rj0rfJoKu X-Received: by 2002:ac2:51ad:0:b0:50e:416d:c1cd with SMTP id f13-20020ac251ad000000b0050e416dc1cdmr412378lfk.23.1706648327510; Tue, 30 Jan 2024 12:58:47 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706648327; cv=pass; d=google.com; s=arc-20160816; b=y+S05aKeDe9gPN3ppuZEX9qguH9NuLyBeQvxr1o1bQxQcnTXRb5DQoN/GMZq9YV7tl HzEqGS7xN3zRBj5JZzaiAwBhWobMUlQM/kBqW0VimF5jQWZ13wRSu+eDUQpHEDT8S5OG zKlQhpWwOUl8fMPiBpTbPDyvZ+8ZwVnLeu6uhEO/Of5DdJqgKL0O5sQCNrbQWDEMpl37 U7xkYyOPF61jr7ecIlaLap3pAGqhc0j80ZfA60WWoWrY4znvwHtLJp+/ueBAwlkcbgok i5fWOXiGpLaV7SaNp3LeHko0VKgzB49VuKlcygZX43YWDWDgF0KBSRt45bk+4L+qoVNe NFMg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=1cPbys/Y5hoKUbO/5yIH1p7bI18xQRJxP7D74jhJ/rQ=; fh=DMxgLPpaEEuPOy6jzB5vN7dKcqWpIan2/noPBPijtqI=; b=Y4vFzAUPb9O/KyBReDitSbX/EfVz2ykOkHM6PhnM67gMaM/iEEBpiq2QO8lHwE/r6P Uzrxztg50Up/rCDIn8kx5S35PLtXfplaTTVrkGcXftL+gMfbaiN/eE8I8Q6cJkwfGMl9 Q9g4WoMKbCG+wb6UXaIV7rEtUopJDFhrTc1imj7WGhYdmsBotnWFdCzdh1fxwLIj5hZD k6YKa7tCdEODa5a5gmbnsW1BL0EyJUGiddhOf0lMOOnlY3BH44fiiyRSs3FIJeBngLMR Q2dQDq6nC2HAPqL5c4t9UH1ENseBhGNAGJiwhgGLEbbDOwQyKBl4+va0yOkkQaYf2+MR HQEg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=RS1pqNAk; arc=pass (i=1 spf=pass spfdomain=google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-45304-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-45304-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id lf22-20020a170906ae5600b00a34a2c09805si4796531ejb.878.2024.01.30.12.58.47 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Jan 2024 12:58:47 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-45304-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=RS1pqNAk; arc=pass (i=1 spf=pass spfdomain=google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-45304-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-45304-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 4335B1F256D2 for ; Tue, 30 Jan 2024 20:58:47 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 00345762EE; Tue, 30 Jan 2024 20:58:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="RS1pqNAk" Received: from mail-yb1-f179.google.com (mail-yb1-f179.google.com [209.85.219.179]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8E6D5762C5 for ; Tue, 30 Jan 2024 20:58:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.179 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706648307; cv=none; b=jFfo9gdLiQNCo/xisDvIJR4vCWsoWj1pSTUuS9pVWiixrj1BGqu0JH1AHp2mCAS9rK6ZCJFVUEuMkklpVHgXbjuzbCLfynTWSwie6vhaJCoOx5K86getg0lxpLmhXcOuZuOGm0xORPneFZIyv+k8vU3HvAD54zDPQJI+KD2DZEQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706648307; c=relaxed/simple; bh=QIixj73cYx88+TJmwwR9jJ+8HbVMWGwyXbuflZP21QM=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=Ma3zkd2NRqNd+kX/5oTcrq2rJ9Y4+HOWFhTGnRiez8caM/EaEp9STYnCQzzprSgRT/sN33ldszq8fqbCpg84+97IQU++qzeA77CaofRjLjEyoT74vpa3AeHyA7K2VOEwUaKuJGeW0JySiUaXFPXIQD3HktKkLiIAtWJv1Q7h2xA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=RS1pqNAk; arc=none smtp.client-ip=209.85.219.179 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=google.com Received: by mail-yb1-f179.google.com with SMTP id 3f1490d57ef6-dc6b5d0dfe2so294065276.0 for ; Tue, 30 Jan 2024 12:58:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1706648304; x=1707253104; darn=vger.kernel.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=1cPbys/Y5hoKUbO/5yIH1p7bI18xQRJxP7D74jhJ/rQ=; b=RS1pqNAk+rmC8EMxBOHuSyPJyCQG9F38bEp3aug27DHth0Fp6DLc+kjEz45AQ0oJAy jGIeN+/Pkad0h+m3+8uSLxjpXp3Hn5Yus7njklHXmujnlpSSipnoj0I0gvPy52AXG051 FviOZGwHtfA9JxF+YeLlmOdnQcaZIsj+Woqg997zN+68Atc44b7Xn/U0BOn3fwmO9anU rdlm2XaLVxS7h8bXO/R2aXE5J48B9RGfz9UVOb5n8F/fkr+ngl0FnQsFVM/ZW1ErpKyD 5DVRoCBmBN/lb0HAUrFANIghkHPX2V0bnQUSZ9q3Tqh7wYWlfCU0MVM3Nt5SLz9gxkMd v5KQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706648304; x=1707253104; 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=1cPbys/Y5hoKUbO/5yIH1p7bI18xQRJxP7D74jhJ/rQ=; b=AlDSdwM7M/5zLejTvy7ReNb8hbeAtVCRyuiVnIm9cTJ/14c8sulyjbsKM81dj77nJj XZh40y1JXA/bkGMTBvHsE/T7Kmc96NoL2gkYm+diluLmyM3TAPQZE4mCm5sT35YK7kgS V4MTFTp2/f5gf6vcWoyajHHDkhfu4lFMh9gqaSLAB5qz9dIPvm7wfcgOAGGQpu11ZqP6 naKRzqYuO0m1qwqC6srgiEO7Njvl4qKmA1KOvby88BOpYoWYuPn+C3UagJ9LtGC1oSJ7 l6dUeLGvPGJf3RxQrypFGGBxVMQEFcB0wiaQa56U/ctRR6Wy9uvP1prYnlsqjvszuYZR 4t6w== X-Gm-Message-State: AOJu0YyrITgW4JKfBKyC6kW16Y5XUP0jaa+6ue2H+j848lPJF62oifcz E6iXbb0wp7vR0XYUdvW+9XmRPubYry3/4fKEc5155+Qasv8SoKschQaO6ckOh2ZC5NxrA82j6ak vHlGRZr1iIlcG1+ZjlYvJ/aTDjQ8v7zs28l8c X-Received: by 2002:a25:b206:0:b0:dc2:6496:f41d with SMTP id i6-20020a25b206000000b00dc26496f41dmr426963ybj.41.1706648304224; Tue, 30 Jan 2024 12:58:24 -0800 (PST) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240121214413.833776-1-tjmercier@google.com> <20240123164819.GB1745986@cmpxchg.org> <20240126163401.GJ1567330@cmpxchg.org> In-Reply-To: From: "T.J. Mercier" Date: Tue, 30 Jan 2024 12:58:12 -0800 Message-ID: Subject: Re: [PATCH] Revert "mm:vmscan: fix inaccurate reclaim during proactive reclaim" To: Johannes Weiner Cc: Michal Hocko , Roman Gushchin , Shakeel Butt , Muchun Song , Andrew Morton , android-mm@google.com, yuzhao@google.com, yangyifei03@kuaishou.com, cgroups@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Fri, Jan 26, 2024 at 8:41=E2=80=AFAM T.J. Mercier = wrote: > > On Fri, Jan 26, 2024 at 8:34=E2=80=AFAM Johannes Weiner wrote: > > > > On Wed, Jan 24, 2024 at 09:46:23AM -0800, T.J. Mercier wrote: > > > In the meantime, instead of a revert how about changing the batch siz= e > > > geometrically instead of the SWAP_CLUSTER_MAX constant: > > > > > > reclaimed =3D try_to_free_mem_cgroup_pages(memcg, > > > - min(nr_to_reclaim - > > > nr_reclaimed, SWAP_CLUSTER_MAX), > > > + (nr_to_reclaim - nr_reclaimed= )/2, > > > GFP_KERNEL, reclaim_options); > > > > > > I think that should address the overreclaim concern (it was mentioned > > > that the upper bound of overreclaim was 2 * request), and this should > > > also increase the reclaim rate for root reclaim with MGLRU closer to > > > what it was before. > > > > Hahaha. Would /4 work for you? > > > > I genuinely think the idea is worth a shot. /4 would give us a bit > > more margin for error, since the bailout/fairness cutoffs have changed > > back and forth over time. And it should still give you a reasonable > > convergence on MGLRU. > > > > try_to_free_reclaim_pages() already does max(nr_to_reclaim, > > SWAP_CLUSTER_MAX) which will avoid the painful final approach loops > > the integer division would produce on its own. > > > > Please add a comment mentioning the compromise between the two reclaim > > implementations though. > > I'll try it out and get back to you. :) Right, so (nr_to_reclaim - nr_reclaimed)/4 looks pretty good to me: root - full reclaim pages/sec time (sec) pre-0388536ac291 : 68047 10.46 post-0388536ac291 : 13742 inf (reclaim-reclaimed)/4 : 67352 10.51 /uid_0 - 1G reclaim pages/sec time (sec) overreclaim (MiB) pre-0388536ac291 : 258822 1.12 107.8 post-0388536ac291 : 105174 2.49 3.5 (reclaim-reclaimed)/4 : 233396 1.12 -7.4 /uid_0 - full reclaim pages/sec time (sec) pre-0388536ac291 : 72334 7.09 post-0388536ac291 : 38105 14.45 (reclaim-reclaimed)/4 : 72914 6.96 So I'll put up a new patch.