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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2C0C8C6FD1D for ; Thu, 30 Mar 2023 07:52:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229529AbjC3Hwv (ORCPT ); Thu, 30 Mar 2023 03:52:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56408 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229379AbjC3Hwu (ORCPT ); Thu, 30 Mar 2023 03:52:50 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2001:67c:2178:6::1c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C993549FE; Thu, 30 Mar 2023 00:52:49 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 840EB21B0B; Thu, 30 Mar 2023 07:52:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1680162768; h=from:from:reply-to: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; bh=dh199jsuIkw67icwSCJmEAMOM1galF76gLuMPyO52BY=; b=mcaDKMiPqsMKSTSx2WP2qVHm5miTytkBZzWk5JU3bD7xHGqkrdBk9x1NvJOXI7BFXxeSZL ro/YJTfRWvZXZHW1a18Rmf7nhQRTSL8u01c1CTU8nlltVrDzsS+LWiOA0FVCVTMKGfaAxS ZEPEb0eUcZtK+ygv3nBfEKPB/BAeTAM= Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 67AE5138FF; Thu, 30 Mar 2023 07:52:48 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id IzQ0F9A/JWRkBAAAMHmgww (envelope-from ); Thu, 30 Mar 2023 07:52:48 +0000 Date: Thu, 30 Mar 2023 09:52:47 +0200 From: Michal Hocko To: Yosry Ahmed Cc: Tejun Heo , Josef Bacik , Jens Axboe , Zefan Li , Johannes Weiner , Roman Gushchin , Shakeel Butt , Muchun Song , Andrew Morton , Michal =?iso-8859-1?Q?Koutn=FD?= , Vasily Averin , cgroups@vger.kernel.org, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, bpf@vger.kernel.org Subject: Re: [PATCH v2 8/9] vmscan: memcg: sleep when flushing stats during reclaim Message-ID: References: <20230328221644.803272-1-yosryahmed@google.com> <20230328221644.803272-9-yosryahmed@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: bpf@vger.kernel.org On Thu 30-03-23 00:44:10, Yosry Ahmed wrote: > On Thu, Mar 30, 2023 at 12:40 AM Michal Hocko wrote: > > > > On Tue 28-03-23 22:16:43, Yosry Ahmed wrote: > > > Memory reclaim is a sleepable context. Allow sleeping when flushing > > > memcg stats to avoid unnecessarily performing a lot of work without > > > sleeping. This can slow down reclaim code if flushing stats is taking > > > too long, but there is already multiple cond_resched()'s in reclaim > > > code. > > > > Why is this preferred? Memory reclaim is surely a slow path but what is > > the advantage of calling mem_cgroup_flush_stats here? > > The purpose of this series is to limit calls to atomic flushing as > much as possible, as flushing can become really expensive on systems > with high cpu counts and a lot of cgroups, and performing such an > expensive operation atomically causes problems -- so we'd rather avoid > doing it atomically where possible. Please add that to the changelog. While the intention might be obvious now (although cover is not explicit about it either) it can cause some head scratching in the future when somebody looks at this commit without a broader context (e.g. previous ML discussions). with that Acked-by: Michal Hocko Thanks > > > Signed-off-by: Yosry Ahmed > > > Acked-by: Shakeel Butt > > > Acked-by: Johannes Weiner > > > --- > > > mm/vmscan.c | 2 +- > > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > > > diff --git a/mm/vmscan.c b/mm/vmscan.c > > > index a9511ccb936f..9c1c5e8b24b8 100644 > > > --- a/mm/vmscan.c > > > +++ b/mm/vmscan.c > > > @@ -2845,7 +2845,7 @@ static void prepare_scan_count(pg_data_t *pgdat, struct scan_control *sc) > > > * Flush the memory cgroup stats, so that we read accurate per-memcg > > > * lruvec stats for heuristics. > > > */ > > > - mem_cgroup_flush_stats_atomic(); > > > + mem_cgroup_flush_stats(); > > > > > > /* > > > * Determine the scan balance between anon and file LRUs. > > > -- > > > 2.40.0.348.gf938b09366-goog > > > > -- > > Michal Hocko > > SUSE Labs -- Michal Hocko SUSE Labs