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 E3836C4332F for ; Fri, 2 Dec 2022 02:46:00 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 229156B0071; Thu, 1 Dec 2022 21:46:00 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 1D94F6B0073; Thu, 1 Dec 2022 21:46:00 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0A3136B0074; Thu, 1 Dec 2022 21:46:00 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id EECEB6B0071 for ; Thu, 1 Dec 2022 21:45:59 -0500 (EST) Received: from smtpin19.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id BDCC640667 for ; Fri, 2 Dec 2022 02:45:59 +0000 (UTC) X-FDA: 80195826438.19.387E9EF Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by imf04.hostedemail.com (Postfix) with ESMTP id 968CC40006 for ; Fri, 2 Dec 2022 02:45:58 +0000 (UTC) Authentication-Results: imf04.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b=dk5nZc02; spf=pass (imf04.hostedemail.com: domain of ying.huang@intel.com designates 192.55.52.88 as permitted sender) smtp.mailfrom=ying.huang@intel.com; dmarc=pass (policy=none) header.from=intel.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1669949159; 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=mAtF8qaQF7U9Bot7DO8L9ued1/8ko7JpHxq9aDkuHfg=; b=nNDY1dhWxlTk6cU8y5VWBRLQYRwDhl6ybJTnbDRcOy5tTWZm4+9w0L+wq9MSBRAK846BZr zTeu3hmdULYGotJQYtMTlpDH38K1d3aKiS7D7xEgQUYZt/Wh6HA7FtC58Hjb4qv+/Zb8rP UznkkDWtMKUppUGhiiV7Qm8QVjtDChE= ARC-Authentication-Results: i=1; imf04.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b=dk5nZc02; spf=pass (imf04.hostedemail.com: domain of ying.huang@intel.com designates 192.55.52.88 as permitted sender) smtp.mailfrom=ying.huang@intel.com; dmarc=pass (policy=none) header.from=intel.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1669949159; a=rsa-sha256; cv=none; b=5pgRmQ7ilKyghpP7/YfsRtRbUPbKU3sOV+vmz9k9UdO/NJlmRJUiuyTRauYmcCoR4BURtu ZSc9LHmz1uk5KgMwbIufLP4KQz2KDsoW2TW0CU1IwNjn8yjCX4+uPmt2SpYo6RPzmHx5IP h6KuJGkIhxAclqameoHlaj5bb6HOjrI= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1669949158; x=1701485158; h=from:to:cc:subject:references:date:in-reply-to: message-id:mime-version; bh=HUHDeiw3czRsSTcMfUqXaQCnJ9GN67fDujbWfUWTGbk=; b=dk5nZc02htDF2aCZkNAGfeX9R5AxhfoIuvKuT4pYn93gJzRoRCQAyv97 PES3KlOsZxogem2OHqy3i8o4owDnows980MvhlhhgXazUbQGZPpdeiMVW 8OyZGtjBGi9tD+WvTn3JVgOqZpS9m7qyd2JVAy3Fr8dRgLXV80GR2YzLk 3NFzI3xSh7YxW2G5uusxcP7zeMj67sWyhcGy5XCI7/2yfgS6OO9BquHCW 8al8nJx9PXhFhz8K25kkIR+e7FJgj17JIqmWHOT5HAMxmdOVvWlKsL2cK vBS/2Hl7I6K84gxyi3hprLUiRCHcmGPT+wfq22rjOC6S95vW46wWEQ5mH g==; X-IronPort-AV: E=McAfee;i="6500,9779,10548"; a="342788416" X-IronPort-AV: E=Sophos;i="5.96,210,1665471600"; d="scan'208";a="342788416" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Dec 2022 18:45:45 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10548"; a="733653421" X-IronPort-AV: E=Sophos;i="5.96,210,1665471600"; d="scan'208";a="733653421" Received: from yhuang6-desk2.sh.intel.com (HELO yhuang6-desk2.ccr.corp.intel.com) ([10.238.208.55]) by fmsmga003-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Dec 2022 18:45:43 -0800 From: "Huang, Ying" To: Mina Almasry Cc: Yang Shi , Yosry Ahmed , Tim Chen , weixugc@google.com, shakeelb@google.com, gthelen@google.com, fvdl@google.com, Andrew Morton , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v1] mm: disable top-tier fallback to reclaim on proactive reclaim References: <20221201233317.1394958-1-almasrymina@google.com> Date: Fri, 02 Dec 2022 10:44:53 +0800 In-Reply-To: <20221201233317.1394958-1-almasrymina@google.com> (Mina Almasry's message of "Thu, 1 Dec 2022 15:33:17 -0800") Message-ID: <87o7sm34nu.fsf@yhuang6-desk2.ccr.corp.intel.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=ascii X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 968CC40006 X-Stat-Signature: hu8uykt38jstw5arswwhgmgjkfoa7kzw X-Rspam-User: X-Spamd-Result: default: False [-0.96 / 9.00]; DMARC_POLICY_ALLOW(-0.50)[intel.com,none]; R_DKIM_ALLOW(-0.20)[intel.com:s=Intel]; R_SPF_ALLOW(-0.20)[+ip4:192.55.52.88/32]; RCVD_NO_TLS_LAST(0.10)[]; MIME_GOOD(-0.10)[text/plain]; BAYES_HAM(-0.06)[61.66%]; RCPT_COUNT_SEVEN(0.00)[11]; DKIM_TRACE(0.00)[intel.com:+]; FROM_EQ_ENVFROM(0.00)[]; MID_RHS_MATCH_FROMTLD(0.00)[]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_COUNT_THREE(0.00)[3]; FROM_HAS_DN(0.00)[]; MIME_TRACE(0.00)[0:+]; TO_DN_SOME(0.00)[]; ARC_SIGNED(0.00)[hostedemail.com:s=arc-20220608:i=1]; ARC_NA(0.00)[] X-HE-Tag: 1669949158-223286 X-Bogosity: 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: Mina Almasry writes: > Reclaiming directly from top tier nodes breaks the aging pipeline of > memory tiers. If we have a RAM -> CXL -> storage hierarchy, we > should demote from RAM to CXL and from CXL to storage. If we reclaim > a page from RAM, it means we 'demote' it directly from RAM to storage, > bypassing potentially a huge amount of pages colder than it in CXL. > > However disabling reclaim from top tier nodes entirely would cause ooms > in edge scenarios where lower tier memory is unreclaimable for whatever > reason, e.g. memory being mlocked() or too hot to reclaim. In these > cases we would rather the job run with a performance regression rather > than it oom altogether. > > However, we can disable reclaim from top tier nodes for proactive reclaim. > That reclaim is not real memory pressure, and we don't have any cause to > be breaking the aging pipeline. > > Signed-off-by: Mina Almasry > --- > mm/vmscan.c | 27 ++++++++++++++++++++++++--- > 1 file changed, 24 insertions(+), 3 deletions(-) > > diff --git a/mm/vmscan.c b/mm/vmscan.c > index 23fc5b523764..6eb130e57920 100644 > --- a/mm/vmscan.c > +++ b/mm/vmscan.c > @@ -2088,10 +2088,31 @@ static unsigned int shrink_folio_list(struct list_head *folio_list, > nr_reclaimed += demote_folio_list(&demote_folios, pgdat); > /* Folios that could not be demoted are still in @demote_folios */ > if (!list_empty(&demote_folios)) { > - /* Folios which weren't demoted go back on @folio_list for retry: */ > + /* > + * Folios which weren't demoted go back on @folio_list. > + */ I don't we should change comments style here. Why not just + /* Folios which weren't demoted go back on @folio_list. */ Other than this, the patch LGTM, Thanks! Reviewed-by: "Huang, Ying" > list_splice_init(&demote_folios, folio_list); > - do_demote_pass = false; > - goto retry; > + > + /* > + * goto retry to reclaim the undemoted folios in folio_list if > + * desired. > + * > + * Reclaiming directly from top tier nodes is not often desired > + * due to it breaking the LRU ordering: in general memory > + * should be reclaimed from lower tier nodes and demoted from > + * top tier nodes. > + * > + * However, disabling reclaim from top tier nodes entirely > + * would cause ooms in edge scenarios where lower tier memory > + * is unreclaimable for whatever reason, eg memory being > + * mlocked or too hot to reclaim. We can disable reclaim > + * from top tier nodes in proactive reclaim though as that is > + * not real memory pressure. > + */ > + if (!sc->proactive) { > + do_demote_pass = false; > + goto retry; > + } > } > > pgactivate = stat->nr_activate[0] + stat->nr_activate[1]; > -- > 2.39.0.rc0.267.gcb52ba06e7-goog