Received: by 2002:a05:7412:6592:b0:d7:7d3a:4fe2 with SMTP id m18csp2299787rdg; Sun, 13 Aug 2023 19:32:02 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHSSPaiFot61O6jTVHH8NBpilZNeftU+bWdMfbeBa1QmzL9nENkTrpS+rgrvUEIU3hu/Pr+ X-Received: by 2002:a05:6358:c12:b0:13a:200c:8f02 with SMTP id f18-20020a0563580c1200b0013a200c8f02mr6889944rwj.9.1691980321896; Sun, 13 Aug 2023 19:32:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691980321; cv=none; d=google.com; s=arc-20160816; b=UDIwF/yExb7hI+0uqTCQLFp8Q9v96ExgNAbQHtHVsZxT9Q0zdgnRXrKPnc8aUIuu2E pAQNoFMf9hqeUcbUvafhIv7l6C8iWyHQI924xlZrYBstGm36TGG47XcfV0ExNn0o32u4 vrVFiXMakPCu/DVlL6I0h0wVtsy8WqmE2e8WFrM4xPnaGkk81gDzBkbwkhOrN1lnGeMh O46cG1oGGdUaKmjniCz9xTckAG0kpY+Ehc15aht2K1GP9zmsE1tq2XoVZIUL5+cB/bCF 7K7VLRfBWF+T9YCV/nY0uVYkgPVuaV5OqEWerNC7hT0LnH3A0OR+o1vxjEJuARyv+Izb 9OMw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:message-id:in-reply-to :date:references:subject:cc:to:from:dkim-signature; bh=8m/gIdV2Znxg+TJaUmU2J5bCe7aSMdWTpetudXCRqH0=; fh=wu0iPuhof9+HIxERkh99D5NGnw5JHE1hetwsJf2bgTs=; b=unMwO+4xvV18IpUyej99zlI4CpVM21fs4h/3Ry6V0i3wZI6Zg7omCeT9MseBYuWE2L p7sXWx5c0nkOUn+7A7l2x7TH/4Zqd9YVeMIRz1F2V1YzOU2o3YEkjXatScibOaT8BXEA ZSb/UFBrbyY5EDEiP9Gt35tTuJc52x4rbzxUYl6JwFKT9n5xpzpSsn7EPQKwnVAcLkHe 02Ch0Rw4gZ9OsMMZw9YiRh/SrLPqC/bC0D7IMjzzTacGyXNZDdKN95JlE0soNkKwPh1t W1UbxvUA/nDv2soJUnMDRGsNFbM60zBfy7lCTk5Q2lA9CvD+v5vqJw13jkd0KpRQZZdM 3YhA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Wg+WicIz; 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=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z2-20020a63ac42000000b005655bf61e37si5029377pgn.14.2023.08.13.19.31.46; Sun, 13 Aug 2023 19:32:01 -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=@intel.com header.s=Intel header.b=Wg+WicIz; 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=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232622AbjHNCCe (ORCPT + 99 others); Sun, 13 Aug 2023 22:02:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50770 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232618AbjHNCBm (ORCPT ); Sun, 13 Aug 2023 22:01:42 -0400 Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.93]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E6CF519A0 for ; Sun, 13 Aug 2023 19:01:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1691978490; x=1723514490; h=from:to:cc:subject:references:date:in-reply-to: message-id:mime-version; bh=elP5MaPiK7sfhDGC7LIIpybcSaFP9t6Qc2Prs7OZsoI=; b=Wg+WicIz8p+/3pWqpLmCizpxyARbqR/8laNKbJVlhfPM38lG+FT/0Ech eqnOVBFYPqhSWAbjzEykH8yzoGainLG+Tq3yXW6W1JBS2lZ6IgfhK4VoV hKihe12YwQ6zmnyv2ijKbUk4idcINN7Wl8QaWGwMNB3TjFaBF/GkZfC2h QkTXix5gcBqKpAe7kDYBK1NF5tI3zWz0l9WP8/2L5FZ/Xo9/O6V5L3PMN ETXoZXNFHKnq6waDAbLz50+OFfXoUJ/iP5tS79M1utPO81eOzzluktL/8 ORNp7xszoGtpwH/RbSY1HSzZPfcByltEd6QrmhFz7PTXaJohS6Uj33yfh Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10801"; a="369414378" X-IronPort-AV: E=Sophos;i="6.01,171,1684825200"; d="scan'208";a="369414378" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Aug 2023 19:01:30 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10801"; a="979821263" X-IronPort-AV: E=Sophos;i="6.01,171,1684825200"; d="scan'208";a="979821263" Received: from yhuang6-desk2.sh.intel.com (HELO yhuang6-desk2.ccr.corp.intel.com) ([10.238.208.55]) by fmsmga006-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Aug 2023 19:01:28 -0700 From: "Huang, Ying" To: Michal Hocko 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 References: <20230811090819.60845-1-ying.huang@intel.com> Date: Mon, 14 Aug 2023 09:59:51 +0800 In-Reply-To: (Michal Hocko's message of "Fri, 11 Aug 2023 11:35:37 +0200") Message-ID: <87r0o6bcyw.fsf@yhuang6-desk2.ccr.corp.intel.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=ascii X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_NONE 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 Hi, Michal, Michal Hocko writes: > 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? The pages of the remote zone may be kept in the local per-CPU pageset for long time as long as there's no page allocation/freeing on the logical CPU. In addition to the logical CPU goes idle, this is also possible if the logical CPU is busy in the user space. I will update the change log to include this. -- Best Regards, Huang, Ying >> 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