Received: by 2002:a05:7412:6592:b0:d7:7d3a:4fe2 with SMTP id m18csp930050rdg; Fri, 11 Aug 2023 04:49:22 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFb/PFRx+zxUGUKaGgHqWCLfJwaY0CGDNI9J7sq1NPt0nUYKO3eyvZloLjFqmjB+bNBtdPq X-Received: by 2002:a17:902:ce92:b0:1ac:5717:fd5 with SMTP id f18-20020a170902ce9200b001ac57170fd5mr2038353plg.60.1691754561745; Fri, 11 Aug 2023 04:49:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691754561; cv=none; d=google.com; s=arc-20160816; b=l/xUoiWMYV+FUwZntbmCWkLeOnuDwYwlxG+h2XWN6zPm1VgpJ4v6yFBybeqMHnWX8b 6YbzeqMMtvB5MPpTa/Wiy4A7de6CNVruoFX12v/54f1eYruKSfffus85PRqrCoS6BnA+ HSB7AKvuBaAMniC7CMA2Xjy916nDiFsoaW7E5henO+coiZpO6CC4bH5Dxo8I32HwwhL7 R/L4lKEiOD5EH0Htcnjrvz3yIMY4Us+TUMRNL8sx/5dQYiXiNntBkUsfXmaQejkHRmRW PbRRwZiBp5HF5YKVUOzkONAcPbvuj2+59+u8j7rqAyC2wgZVFjMgRpb9Amo9mt6pF4wF QaKw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=t/tEynIR4U6iHt7GPkko/b/gVTYV1oL7tRpdFFRnc8k=; fh=6IYanm6whkyQuuogzuPRw69vaSfMVrYVqfoEkt7srl8=; b=qtLdpupyfntcNJxIZAza6xIgXO4da66KMMXkuB2WATfgMu7ZZcxyw9QG5pvfkIS7ug 6hEFkfy8pH3FF4McgZ4koD1/YfbMgPqh1sKnTayQ+9TEK2VdHiuJxHDBl566LptqadwC YLvuzCRrGbgKTTGyayppDxe6LJbzdTmKy29ytuNKGtZ9zpxaCzmE743XdK3dcYUOS/nE KvpKGQ4cTnwyyHR7ZGpN0aUdMtntIhtdexE0w/W4Ux58uurMBoaaTPiUxG7pV/rMfW5G 0CIuAd/PP2Q57rqM6t9ng8fWpLJwZn+Nal2+BGcfJ/xzt8DG/8OMr9YUvGutW3E8HtAO 3enQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=MepRkntq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n15-20020a170902e54f00b001bc674914b0si3261844plf.472.2023.08.11.04.49.07; Fri, 11 Aug 2023 04:49:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=MepRkntq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234061AbjHKJfm (ORCPT + 99 others); Fri, 11 Aug 2023 05:35:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51542 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229927AbjHKJfl (ORCPT ); Fri, 11 Aug 2023 05:35:41 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2001:67c:2178:6::1d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5CC502709 for ; Fri, 11 Aug 2023 02:35:39 -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-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-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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