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 E34FAC001B0 for ; Fri, 11 Aug 2023 09:35:43 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 336F1900003; Fri, 11 Aug 2023 05:35:43 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 2BFD6900002; Fri, 11 Aug 2023 05:35:43 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 18879900003; Fri, 11 Aug 2023 05:35:43 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 0655A900002 for ; Fri, 11 Aug 2023 05:35:43 -0400 (EDT) Received: from smtpin27.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id C70A7B1F68 for ; Fri, 11 Aug 2023 09:35:42 +0000 (UTC) X-FDA: 81111316524.27.4356BBA Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by imf19.hostedemail.com (Postfix) with ESMTP id E40471A0019 for ; Fri, 11 Aug 2023 09:35:39 +0000 (UTC) Authentication-Results: imf19.hostedemail.com; dkim=pass header.d=suse.com header.s=susede1 header.b=MepRkntq; dmarc=pass (policy=quarantine) header.from=suse.com; spf=pass (imf19.hostedemail.com: domain of mhocko@suse.com designates 195.135.220.29 as permitted sender) smtp.mailfrom=mhocko@suse.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1691746540; 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=t/tEynIR4U6iHt7GPkko/b/gVTYV1oL7tRpdFFRnc8k=; b=tT0rNkDYY/OVxfCyZUuYMIN+/QUf5ka48M7A6FmewCh/tSUuhVQDNd13s3VczbN5nGt22O NYvrsvotsrHd4wem4RiOMA9jNaOJcIh4P3a2/yoXt+Hcr7jeyoZC3nIgL4foy7QHqcnSVJ UcjaLVezQVf2eynwn+ikSJjZOCu0hNw= ARC-Authentication-Results: i=1; imf19.hostedemail.com; dkim=pass header.d=suse.com header.s=susede1 header.b=MepRkntq; dmarc=pass (policy=quarantine) header.from=suse.com; spf=pass (imf19.hostedemail.com: domain of mhocko@suse.com designates 195.135.220.29 as permitted sender) smtp.mailfrom=mhocko@suse.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1691746540; a=rsa-sha256; cv=none; b=IsrHEAoMkRPB710NbVpGgLCLoq/UjaZZm2yLbY6bXfwvtCA3yUuVSpaCahLGs8FAs5bszn XY9HsL/bUsZ5IAHyJTCz9QM8MwP6ian4j1O7jVVrLn3Ya6CcZk1QzLGLHx1TMrR/pb8eYa vyFSYUxmoqscrNibvlx8OOLI2yCa/ro= 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-out2.suse.de (Postfix) with ESMTPS id 1F78B1F74A; Fri, 11 Aug 2023 09:35:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1691746538; 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=t/tEynIR4U6iHt7GPkko/b/gVTYV1oL7tRpdFFRnc8k=; b=MepRkntqqYC9hI27B0fxkWkr4DYYrXcgwDq1ppIT40Fi9Vg8Z4DoIrLh/l6DJiVyUpbHCl r/LdssTYho1VoOPJ0+9eekU6HA8ZAIrggQqs+AZj5uQ92HR/sFnC2guIiiqrKV3v9auBlR m5E7gAy4Dy3Pbyqrhu8JIlHyJ5d817w= 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 0224B138E2; Fri, 11 Aug 2023 09:35:37 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id LGbxOOkA1mRiHwAAMHmgww (envelope-from ); Fri, 11 Aug 2023 09:35:37 +0000 Date: Fri, 11 Aug 2023 11:35:37 +0200 From: Michal Hocko To: Huang Ying Cc: Andrew Morton , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Christoph Lameter , Mel Gorman , Vlastimil Babka Subject: Re: [PATCH] mm: fix draining remote pageset Message-ID: References: <20230811090819.60845-1-ying.huang@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230811090819.60845-1-ying.huang@intel.com> X-Rspam-User: X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: E40471A0019 X-Stat-Signature: oedxyxg7at5mg9wwkcmyrrw4rropapo9 X-HE-Tag: 1691746539-65685 X-HE-Meta: U2FsdGVkX1+Vl75kb1isVTLa0ZFqNInlahW/0aCDbX4IUKIEx/gjz5U0cXkzeYHTo2Gw7GCF/NMZdmHdpATyZ4nJyl+gdkdHPdAWHiXtmq6IY67zgrvDVmVBD5ePrWdUJLZf+H1LAsJMOEbQS4AdUmcc4YjVR64YZqI5Wt91/+r43ScKFsXsKYLGCqmlLD1SX2CFaBXLqqXQu+a1sUO/TISdEi37gWD+t/6luj/qnzEwgnzD345I/B870okHMop45AIR2ZoUXsMr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: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Fri 11-08-23 17:08:19, Huang Ying wrote: > If there is no memory allocation/freeing in the remote pageset after > some time (3 seconds for now), the remote pageset will be drained to > avoid memory wastage. > > But in the current implementation, vmstat updater worker may not be > re-queued when we are waiting for the timeout (pcp->expire != 0) if > there are no vmstat changes, for example, when CPU goes idle. Why is that a problem? > This is fixed via guaranteeing that the vmstat updater worker will > always be re-queued when we are waiting for the timeout. > > We can reproduce the bug via allocating/freeing pages from remote > node, then go idle. And the patch can fix it. > > Fixes: 7cc36bbddde5 ("vmstat: on-demand vmstat workers V8") > Signed-off-by: "Huang, Ying" > Cc: Christoph Lameter > Cc: Mel Gorman > Cc: Vlastimil Babka > Cc: Michal Hocko > --- > mm/vmstat.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/mm/vmstat.c b/mm/vmstat.c > index b731d57996c5..111118741abf 100644 > --- a/mm/vmstat.c > +++ b/mm/vmstat.c > @@ -856,8 +856,10 @@ static int refresh_cpu_vm_stats(bool do_pagesets) > continue; > } > > - if (__this_cpu_dec_return(pcp->expire)) > + if (__this_cpu_dec_return(pcp->expire)) { > + changes++; > continue; > + } > > if (__this_cpu_read(pcp->count)) { > drain_zone_pages(zone, this_cpu_ptr(pcp)); > -- > 2.39.2 -- Michal Hocko SUSE Labs