Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp5223946pxv; Tue, 20 Jul 2021 23:45:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyQYhJ0UUs3aUY4ILYRBISSsMgKjlMrRQgh+pxh+b3LrDyLEmgNEFfykyBzz93Pda2gz6eK X-Received: by 2002:a92:cb4d:: with SMTP id f13mr24333254ilq.57.1626849905965; Tue, 20 Jul 2021 23:45:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626849905; cv=none; d=google.com; s=arc-20160816; b=CTKOjVUkqmnfewEi3nrEuXWR/FdQUTba147Rxx6XZDs8tDAy24LrsB0qonxYU9Mzs9 nAnSzyvV79UYhQDdM1cGMY5wv8VCs+UeLxpI0QlEywhVJpZq2BN3BqGhBrXrp/FMZ023 Ro8SisexkcHY+drm+N942A4m+2hHot0HljrxMW9ZSIXLy4EYBqPtURGJ6UUH6HHjZuhY JyCC6BW+GiAt+U69/zW0Gch7BX7lAwjdSQuhXwu/hY6H2xU/Vj0aV8pgdPKYgqXfeAkR mWo4DXm4msZA4NApqsP5VyR+WCibMii3VWTdQq+NiD1+j8PB2LbtnL7jgu8tCsXTx057 xmSg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=YB0qtB/wr7/5w2puJyVUX80Vxe3vhckx2RNVwUPsyJE=; b=k3l6SjQihfwkamfEQ3cDF38AhCJqamGqFwlfpetSjl0LW5wH9azTQwc/pQpxUsyUxk Te7tDKkji+3h9nAsg4W3ksPp9Zow8i/EL6OSjTJsN7DIXBKDrMX0b1LuAlFd/B5PQa7X xUMvWNxZG8EGghoiR0wyZDQm31j9SSSX/9Mo5yEQZTTrFgOGd50n+o7dITCqH9WfWLUY YpjD7QHzrplluZoRIdc3U9H0pvCay6Wnx8nvlvF2sDF99qGDV9YjzMsEZB+Dp+GhM0Hu pKohCG9rTjk5iwSXL6b2mIkWu3tCn48MqYKx/f88hm1nAqzGIrGEkuIcBEZKQwfpuHAA CAbA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j2si21268650ilo.119.2021.07.20.23.44.54; Tue, 20 Jul 2021 23:45:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234476AbhGUGDS (ORCPT + 99 others); Wed, 21 Jul 2021 02:03:18 -0400 Received: from mga06.intel.com ([134.134.136.31]:44388 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234275AbhGUF70 (ORCPT ); Wed, 21 Jul 2021 01:59:26 -0400 X-IronPort-AV: E=McAfee;i="6200,9189,10051"; a="272496401" X-IronPort-AV: E=Sophos;i="5.84,257,1620716400"; d="scan'208";a="272496401" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Jul 2021 23:40:00 -0700 X-IronPort-AV: E=Sophos;i="5.84,257,1620716400"; d="scan'208";a="511390055" Received: from yhuang6-desk2.sh.intel.com ([10.239.159.119]) by fmsmga002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Jul 2021 23:39:57 -0700 From: Huang Ying To: Andrew Morton Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Dave Hansen , "Huang, Ying" , Yang Shi , Yang Shi , Michal Hocko , Wei Xu , Oscar Salvador , Zi Yan , David Rientjes , Dan Williams , David Hildenbrand , Greg Thelen , Keith Busch Subject: [PATCH -V11 8/9] mm/vmscan: never demote for memcg reclaim Date: Wed, 21 Jul 2021 14:39:25 +0800 Message-Id: <20210721063926.3024591-8-ying.huang@intel.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210721063926.3024591-1-ying.huang@intel.com> References: <20210721063926.3024591-1-ying.huang@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Dave Hansen Global reclaim aims to reduce the amount of memory used on a given node or set of nodes. Migrating pages to another node serves this purpose. memcg reclaim is different. Its goal is to reduce the total memory consumption of the entire memcg, across all nodes. Migration does not assist memcg reclaim because it just moves page contents between nodes rather than actually reducing memory consumption. Link: https://lkml.kernel.org/r/20210715055145.195411-9-ying.huang@intel.com Signed-off-by: Dave Hansen Signed-off-by: "Huang, Ying" Suggested-by: Yang Shi Reviewed-by: Yang Shi Cc: Michal Hocko Cc: Wei Xu Cc: Oscar Salvador Cc: Zi Yan Cc: David Rientjes Cc: Dan Williams Cc: David Hildenbrand Cc: Greg Thelen Cc: Keith Busch Signed-off-by: Andrew Morton --- mm/vmscan.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/mm/vmscan.c b/mm/vmscan.c index 67a320c6571d..60179903ed9e 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -521,8 +521,13 @@ static long add_nr_deferred(long nr, struct shrinker *shrinker, static bool can_demote(int nid, struct scan_control *sc) { - if (sc && sc->no_demotion) - return false; + if (sc) { + if (sc->no_demotion) + return false; + /* It is pointless to do demotion in memcg reclaim */ + if (cgroup_reclaim(sc)) + return false; + } if (next_demotion_node(nid) == NUMA_NO_NODE) return false; -- 2.30.2