Received: by 2002:a05:7412:d1aa:b0:fc:a2b0:25d7 with SMTP id ba42csp1288382rdb; Tue, 30 Jan 2024 13:56:38 -0800 (PST) X-Google-Smtp-Source: AGHT+IGiEo4sNu4c4Mbz0K8913tCNC04Cwv8DrxBBiZ24WHd4PxAOapNKNtf1ydwa9mjPgaFV4kS X-Received: by 2002:a17:902:7845:b0:1d8:ca2a:5b9f with SMTP id e5-20020a170902784500b001d8ca2a5b9fmr4621764pln.22.1706651798413; Tue, 30 Jan 2024 13:56:38 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706651798; cv=pass; d=google.com; s=arc-20160816; b=guZKvX75xBttEqNNPSZDxFba/pS7IKtDFDz3JrxxNiZqnqdmUGQhXsfEjMTzMgPV+M r/twN+aoSRfV0yr0fNocUGYrr/NU9f14GWtbZtbsFQtBakQ1Z4RQcpEdO6dPPaUtp6JG O81vdmeIkykTSPEh4YVCZelV8cd7Pfy/Nqv3m2w8EG8iX7Bp0REXIfjUGmM9uWm2Vt4S Kf/0/7tLxnav7KYMOtQxrtW3LttfDXk66hzck1sleVK78rBPZV73AC2z+zXyhA0N7G00 iZydBHgyHILN0CCCsOUew7SF4uw9Kmc19akNZJSoLcVUplQTxV/0ogMemhyYz12lvPEM eTAg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:message-id:subject:cc:to:from:date:dkim-signature; bh=zUwitgcZ8PysFOK/IjV63sunJlwofoIw/gZSZx3mTw0=; fh=G39Uaa1XyPDc14yATmuH/YiakivcHQWOi4A1CTJ80/I=; b=fH8HJuh2qVDndnCLTgcJXMPZmAKvLNlGG5K2Zai8Cuw5qx66QhQARXKC2bQSPbNyxE 54Dp4nLsPhgOWSnuXLQ5uAfXssIpesU+GFIydyQxsSCTQXzz0u4OVn6VyEgeKwc4DSQn qQNuseC8rISUUx/gzG5QqunLG9MkldoeyMcFvLxWwSGinAaTJeLV01wNcXH/aPh8ASf5 GOMmAvPV/6zzy9+ljhoseoUDXdvLNV09/uIgdpQAPCUtWez6ma5B1knlIUc4EXpY350H QyDw/Enh28+8PkSgaiGDOPFkkgPuvtBtREfS8PUp/JKfdrw2xTBk+zPMkGhRNslbUFnQ LFjA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@cmpxchg-org.20230601.gappssmtp.com header.s=20230601 header.b=NPOWjrkO; arc=pass (i=1 spf=pass spfdomain=cmpxchg.org dkim=pass dkdomain=cmpxchg-org.20230601.gappssmtp.com dmarc=pass fromdomain=cmpxchg.org); spf=pass (google.com: domain of linux-kernel+bounces-45354-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-45354-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=cmpxchg.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id y8-20020a17090264c800b001d90a15616asi1790980pli.149.2024.01.30.13.56.38 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Jan 2024 13:56:38 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-45354-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@cmpxchg-org.20230601.gappssmtp.com header.s=20230601 header.b=NPOWjrkO; arc=pass (i=1 spf=pass spfdomain=cmpxchg.org dkim=pass dkdomain=cmpxchg-org.20230601.gappssmtp.com dmarc=pass fromdomain=cmpxchg.org); spf=pass (google.com: domain of linux-kernel+bounces-45354-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-45354-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=cmpxchg.org 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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 69189288AE4 for ; Tue, 30 Jan 2024 21:56:37 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id EA4A77D3F4; Tue, 30 Jan 2024 21:56:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=cmpxchg-org.20230601.gappssmtp.com header.i=@cmpxchg-org.20230601.gappssmtp.com header.b="NPOWjrkO" Received: from mail-qv1-f46.google.com (mail-qv1-f46.google.com [209.85.219.46]) (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 DDD3914F61 for ; Tue, 30 Jan 2024 21:56:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.46 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706651790; cv=none; b=cIgEEvoTLalIEPMUnqJEX3/1Ii3mBbg5+SuigRZ3l1LlUJYWsJ24P7xV8wQdtc7dRJX4vM1YL/CEeDjTsQXcA1Owce27hceJhLJp3LG63gBR8E6yWB4isYf7GM8Fxkn7c002imz8dbAquxAxaqVFe1v1MMiPwRtbts95Q0jPtj0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706651790; c=relaxed/simple; bh=QFF3g8SJ4OiMza5Xx+W6HjoPtXkMrCk0w56SdKoVm3E=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=CLVNaNEKsJkE9c45CBkhSYIR0dGnY8Nn7eW308vGGFA0YquqjW6dQi0bnQ4VNWn9tl2EaeRgU7Kz5l4GbXSe7ZIhb+hHpGbaYnf0FDqwOpSMZM38aCXcxiIcD+SYj20JIsURULGAXLDW45IZaNUgqGb8quy6kIi6kShH62gVOig= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=cmpxchg.org; spf=pass smtp.mailfrom=cmpxchg.org; dkim=pass (2048-bit key) header.d=cmpxchg-org.20230601.gappssmtp.com header.i=@cmpxchg-org.20230601.gappssmtp.com header.b=NPOWjrkO; arc=none smtp.client-ip=209.85.219.46 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=cmpxchg.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=cmpxchg.org Received: by mail-qv1-f46.google.com with SMTP id 6a1803df08f44-68c53ed6c56so13100016d6.3 for ; Tue, 30 Jan 2024 13:56:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cmpxchg-org.20230601.gappssmtp.com; s=20230601; t=1706651786; x=1707256586; darn=vger.kernel.org; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:from:to :cc:subject:date:message-id:reply-to; bh=zUwitgcZ8PysFOK/IjV63sunJlwofoIw/gZSZx3mTw0=; b=NPOWjrkOnfgF8bI7jvihkIPTJu13w3AKmOzC6OtMmjjq0My81atY0FPGwutJpJ7cFZ 5q+UP8E4EP68OysIHXPvvARU5NlRGWUEzCxAcwFdo2VflztzgRE3o7QDkZgPjTYIy5Pu Ro3whZW3ldQXFFOfmMwil4DNc+AF9RMkm5rQGgZb8uGYgEdo2NfKzXlzwmPvqFhc++hx 1JcUgQL8ers4696kfJSPMI0D/J9IcYWYstHLNHX07A1gKIx0YHvk8sNYHijSBregHI4a 86lt9aceAOzKlS8qza1i3F78SroqUWfOLs6zNxJ3PxSVvWfEmAyY1DAh/8NA7b70qLMe MREw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706651786; x=1707256586; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=zUwitgcZ8PysFOK/IjV63sunJlwofoIw/gZSZx3mTw0=; b=eMxUrtPxoewyozIx4/4bFMAsl5GlcaVEMNKBPH/XTLW57oUHxk2lPDeNcLZSwM/qrE rS6XbXOYAz39RqX+sICKE25Z+UOXcFFW85gt+oxmkE9HkgAH2+DGWPu5GE+30KHMU8uy CIZ1W+dHyJZvl7SG8oGUO/1ejzKaaw9ojLdZAPZNBsD7kCwmrAWoif2q7S1r96H3y1sP OAAbFGWvmQN449paDMNsL5eFBCiUK5wf7D7LQdbijTlpS7i0sLQHfdUwe4+Wv7PsGZ3+ Xh5pcXnEbTOJMKi9iMpBkMBSsUqirwm0O3EWwISO2o3KrS9wIKt9pRdqrukWpFZuu2un ufCA== X-Gm-Message-State: AOJu0YzQgh5SjZwb/hQbUnGYXFQ62b0g74cSe8CqmlU397KQc6XkJURK dboBs4+Fi9hAYuvglVer53q62F12ij42UtSB56W568j2AO8VsVjeEs4w+HxP1vfmSjypxr+uarn f X-Received: by 2002:ad4:5ecf:0:b0:686:309d:8915 with SMTP id jm15-20020ad45ecf000000b00686309d8915mr9823848qvb.6.1706651786531; Tue, 30 Jan 2024 13:56:26 -0800 (PST) Received: from localhost (2603-7000-0c01-2716-da5e-d3ff-fee7-26e7.res6.spectrum.com. [2603:7000:c01:2716:da5e:d3ff:fee7:26e7]) by smtp.gmail.com with ESMTPSA id pj3-20020a0562144b0300b0068c68437655sm362333qvb.115.2024.01.30.13.56.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Jan 2024 13:56:26 -0800 (PST) Date: Tue, 30 Jan 2024 16:56:25 -0500 From: Johannes Weiner To: "T.J. Mercier" 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 Subject: Re: [PATCH] Revert "mm:vmscan: fix inaccurate reclaim during proactive reclaim" Message-ID: <20240130215625.GA970164@cmpxchg.org> References: <20240121214413.833776-1-tjmercier@google.com> <20240123164819.GB1745986@cmpxchg.org> <20240126163401.GJ1567330@cmpxchg.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: On Tue, Jan 30, 2024 at 12:58:12PM -0800, T.J. Mercier wrote: > On Fri, Jan 26, 2024 at 8:41 AM T.J. Mercier wrote: > > > > On Fri, Jan 26, 2024 at 8:34 AM 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 size > > > > geometrically instead of the SWAP_CLUSTER_MAX constant: > > > > > > > > reclaimed = 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. That looks great, thanks for giving it a shot. Looking forward to your patch.