Received: by 2002:a05:7412:5112:b0:fa:6e18:a558 with SMTP id fm18csp356907rdb; Tue, 23 Jan 2024 01:34:59 -0800 (PST) X-Google-Smtp-Source: AGHT+IFGgkbkikeYN2tpYjvvcfoTtvZ7r8UNu5JpUc/gNjlrDnSTaIQSd0dgjGPGo6Zs9nYvM6nJ X-Received: by 2002:a05:6a20:734f:b0:19c:4ddd:d9d9 with SMTP id v15-20020a056a20734f00b0019c4dddd9d9mr1843300pzc.83.1706002498786; Tue, 23 Jan 2024 01:34:58 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706002498; cv=pass; d=google.com; s=arc-20160816; b=p50F8jG11ExmJ40G3u7ElVJi+lKSVSaSfg6w+it79sWJQYk62x+9H/M+Pa1K8WJFAD 4FGRwPebpCT0qK9y/klkT3GGhiqCCH5lg9IrhP0TCtlBYlBr1h9VfZIcBF9oxuBDM1Uy 6epuF6FyjN3ysiGOyN2L3UXT9ydlgD097Gr9tW7IQxsEVXLZRDeNMd3S480kF9hPdoUd PvTLh/WjjdmrltGD1HeTFlSHBfIC5rOfmSND8aFCBZ7v/yEzpsEuXQsQ+3OwZ1dsckvQ hCK54ublcthIPU3h78oau6Z0JWEDwpRkn2XfZUggn/2Rf4XLp8+w0bkG0kWXHee/CEdx QZUA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature:dkim-signature; bh=vr0dVSL74POTu+Iy/t8VsndcOHjm5FnK2rIR21aIjBA=; fh=Q0i1KYyKtBnmmWCF1PNVO2C2IGQY8AroeYJuZtZzZpY=; b=VYZBvbfxUO2of0yfRMHMG1K6lqhl2PhwufUz5Ed8zbkGGzq4kbF+WYLpv/DH7Gmtn/ lPEQ7hB7FZCwmf/mcT28Ysnm4ih0+jk/pgWoBuhy63hqxRzWKMSJcEpPi8rOTP8/0TE0 99yYnO3HMcfTZvzfq+D1I+SO/JKT3Av0/Jg9iFcE4DVDhvoUsVdl2C2abETA/h8bOsJe cUYNMy2ptGik4wDSqwoFsm1H5wnEJn25M8RqfE6PBGowZzEIIzK70W6tN3iZDbuvh7K4 Z52biL5/fLNm7H6wokVjlbPjE3+GSO7t1qCrya0htx9CNJIlFCmP8kehEMztutGE3otV RZ3A== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=S+BrXl9K; dkim=pass header.i=@suse.com header.s=susede1 header.b=S+BrXl9K; arc=pass (i=1 spf=pass spfdomain=suse.com dkim=pass dkdomain=suse.com dkim=pass dkdomain=suse.com dmarc=pass fromdomain=suse.com); spf=pass (google.com: domain of linux-kernel+bounces-35000-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-35000-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id x22-20020a170902b41600b001d6f1b54acfsi9573365plr.455.2024.01.23.01.34.58 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Jan 2024 01:34:58 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-35000-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=S+BrXl9K; dkim=pass header.i=@suse.com header.s=susede1 header.b=S+BrXl9K; arc=pass (i=1 spf=pass spfdomain=suse.com dkim=pass dkdomain=suse.com dkim=pass dkdomain=suse.com dmarc=pass fromdomain=suse.com); spf=pass (google.com: domain of linux-kernel+bounces-35000-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-35000-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 830CE288D7B for ; Tue, 23 Jan 2024 09:33:54 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B540559B6A; Tue, 23 Jan 2024 09:33:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=suse.com header.i=@suse.com header.b="S+BrXl9K"; dkim=pass (1024-bit key) header.d=suse.com header.i=@suse.com header.b="S+BrXl9K" Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.223.130]) (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 0FA8959B4C; Tue, 23 Jan 2024 09:33:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.135.223.130 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706002420; cv=none; b=AW5dlAvX5/9XJ3j6YG1rSTE3EHwUg1YXMlyCsrOYSHVWBmozGppQhtTLeip12OCZbVbPq1/Eq/MByxJV0kO1119C0HIRdlm/enFCqUeQFDQEqhhvwzeYChT34V7nLuzb0U3BM7/uLTKi3JFwoKs1yXBlrt8DJ6F5Y/IVfrv5MPA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706002420; c=relaxed/simple; bh=2KnS/m/aJXF9pgC7sa33Pkk2SdNYQMgvjyWG/WyoxTs=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=FqMPnLs3ItmhDv5lsRW81fvzHegP85mwv4+l9VsqzC5/d2braGMMR82/VGdw0Ecvc8r1wYi9igxjkWiLETxWJRuUUQ6v9SrW0g8SUsqVPF3LdGSsbebJFQ1gBso4tLVurBENLX5n7RFNaUJfOGyBoD3QX+IPh8/tBy/RMwGOqV8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com; spf=pass smtp.mailfrom=suse.com; dkim=pass (1024-bit key) header.d=suse.com header.i=@suse.com header.b=S+BrXl9K; dkim=pass (1024-bit key) header.d=suse.com header.i=@suse.com header.b=S+BrXl9K; arc=none smtp.client-ip=195.135.223.130 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.com Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 3249622177; Tue, 23 Jan 2024 09:33:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1706002417; 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=vr0dVSL74POTu+Iy/t8VsndcOHjm5FnK2rIR21aIjBA=; b=S+BrXl9K9p1cn9yvSqLBO6VScZ2ywrf6is1PxTTlOrOQLKR/o1eBgNPpxkLlrCuQiXFQQl ppba9WHp4P1Rk+Xl+nS5t5H/PqltWHfRSpGhUke8SVx0Y9i2fBBGEWEMzWKRzzqxG8e32f 9YiuDQWiNDXvvemyB6ndXo393rAodMo= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1706002417; 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=vr0dVSL74POTu+Iy/t8VsndcOHjm5FnK2rIR21aIjBA=; b=S+BrXl9K9p1cn9yvSqLBO6VScZ2ywrf6is1PxTTlOrOQLKR/o1eBgNPpxkLlrCuQiXFQQl ppba9WHp4P1Rk+Xl+nS5t5H/PqltWHfRSpGhUke8SVx0Y9i2fBBGEWEMzWKRzzqxG8e32f 9YiuDQWiNDXvvemyB6ndXo393rAodMo= Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 13D05136A4; Tue, 23 Jan 2024 09:33:37 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id bXbOAfGHr2VMBwAAD6G6ig (envelope-from ); Tue, 23 Jan 2024 09:33:37 +0000 Date: Tue, 23 Jan 2024 10:33:36 +0100 From: Michal Hocko To: "T.J. Mercier" Cc: Johannes Weiner , 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: References: <20240121214413.833776-1-tjmercier@google.com> 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=us-ascii Content-Disposition: inline In-Reply-To: <20240121214413.833776-1-tjmercier@google.com> X-Spam-Level: Authentication-Results: smtp-out1.suse.de; dkim=pass header.d=suse.com header.s=susede1 header.b=S+BrXl9K X-Rspamd-Server: rspamd2.dmz-prg2.suse.org X-Spamd-Result: default: False [-3.01 / 50.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; R_DKIM_ALLOW(-0.20)[suse.com:s=susede1]; SPAMHAUS_XBL(0.00)[2a07:de40:b281:104:10:150:64:97:from]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; MIME_GOOD(-0.10)[text/plain]; DWL_DNSWL_MED(-2.00)[suse.com:dkim]; NEURAL_HAM_SHORT(-0.20)[-1.000]; RCVD_COUNT_THREE(0.00)[3]; DKIM_SIGNED(0.00)[suse.com:s=susede1]; DKIM_TRACE(0.00)[suse.com:+]; MX_GOOD(-0.01)[]; RCPT_COUNT_TWELVE(0.00)[12]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.com:dkim]; FUZZY_BLOCKED(0.00)[rspamd.com]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; MID_RHS_NOT_FQDN(0.50)[]; RCVD_TLS_ALL(0.00)[] X-Spam-Score: -3.01 X-Rspamd-Queue-Id: 3249622177 X-Spam-Flag: NO On Sun 21-01-24 21:44:12, T.J. Mercier wrote: > This reverts commit 0388536ac29104a478c79b3869541524caec28eb. > > Proactive reclaim on the root cgroup is 10x slower after this patch when > MGLRU is enabled, and completion times for proactive reclaim on much > smaller non-root cgroups take ~30% longer (with or without MGLRU). What is the reclaim target in these pro-active reclaim requests? > With > root reclaim before the patch, I observe average reclaim rates of > ~70k pages/sec before try_to_free_mem_cgroup_pages starts to fail and > the nr_retries counter starts to decrement, eventually ending the > proactive reclaim attempt. Do I understand correctly that the reclaim target is over estimated and you expect that the reclaim process breaks out early> > After the patch the reclaim rate is > consistently ~6.6k pages/sec due to the reduced nr_pages value causing > scan aborts as soon as SWAP_CLUSTER_MAX pages are reclaimed. The > proactive reclaim doesn't complete after several minutes because > try_to_free_mem_cgroup_pages is still capable of reclaiming pages in > tiny SWAP_CLUSTER_MAX page chunks and nr_retries is never decremented. I do not understand this part. How does a smaller reclaim target manages to have reclaimed > 0 while larger one doesn't? > The docs for memory.reclaim say, "the kernel can over or under reclaim > from the target cgroup" which this patch was trying to fix. Revert it > until a less costly solution is found. > > Signed-off-by: T.J. Mercier > --- > mm/memcontrol.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/mm/memcontrol.c b/mm/memcontrol.c > index e4c8735e7c85..cee536c97151 100644 > --- a/mm/memcontrol.c > +++ b/mm/memcontrol.c > @@ -6956,8 +6956,8 @@ static ssize_t memory_reclaim(struct kernfs_open_file *of, char *buf, > lru_add_drain_all(); > > reclaimed = try_to_free_mem_cgroup_pages(memcg, > - min(nr_to_reclaim - nr_reclaimed, SWAP_CLUSTER_MAX), > - GFP_KERNEL, reclaim_options); > + nr_to_reclaim - nr_reclaimed, > + GFP_KERNEL, reclaim_options); > > if (!reclaimed && !nr_retries--) > return -EAGAIN; > -- > 2.43.0.429.g432eaa2c6b-goog > -- Michal Hocko SUSE Labs