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 30C97C4332F for ; Fri, 2 Dec 2022 23:51:19 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8E0CD6B0071; Fri, 2 Dec 2022 18:51:18 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 891356B0072; Fri, 2 Dec 2022 18:51:18 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7587B6B0073; Fri, 2 Dec 2022 18:51:18 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 674626B0071 for ; Fri, 2 Dec 2022 18:51:18 -0500 (EST) Received: from smtpin07.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 309D1C0DAE for ; Fri, 2 Dec 2022 23:51:18 +0000 (UTC) X-FDA: 80199015036.07.C40A56A Received: from mail-yw1-f181.google.com (mail-yw1-f181.google.com [209.85.128.181]) by imf17.hostedemail.com (Postfix) with ESMTP id C4D7E40012 for ; Fri, 2 Dec 2022 23:51:17 +0000 (UTC) Authentication-Results: imf17.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=J+XH6uWA; spf=pass (imf17.hostedemail.com: domain of shakeelb@google.com designates 209.85.128.181 as permitted sender) smtp.mailfrom=shakeelb@google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1670025077; 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=C9WKOxmWkfW4LPRSnLoIzD57XAizk9zr1vImUcT3N2Q=; b=LsDRLR2CK2ZMC6QQCwn6bCLO0vsE7IWPsH182eqGEc5BYsUjdNOaGEaE7bYfG0TjG4nsPn qjfrc10tJxrZzqUW7N9SOwxl54SMDWBXEa27Htw4gcQbjRCxsnbvvNbtV0ToJC+xPsYCtg /Q+ZIweM04oXlni5SXqqp1L8NHP4TfA= ARC-Authentication-Results: i=1; imf17.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=J+XH6uWA; spf=pass (imf17.hostedemail.com: domain of shakeelb@google.com designates 209.85.128.181 as permitted sender) smtp.mailfrom=shakeelb@google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1670025077; a=rsa-sha256; cv=none; b=kcxe9UaxXnWJzIBnDcfH3SQqZSEUi2gdKBHwf+lhqv/nybuZeOawKAxQ9F3VIDrpX18TrW h4sGiqwCBJWgSraMRU4I/a7pmBHuoaiWRb4i4XMLUH5mx0P4GwG2Byggg0Ji9s9Tq1igEr tQliMTfYAfHNeuEmLzBu1+EmBSVZoBo= Received: by mail-yw1-f181.google.com with SMTP id 00721157ae682-3bfd998fa53so64172867b3.5 for ; Fri, 02 Dec 2022 15:51:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=C9WKOxmWkfW4LPRSnLoIzD57XAizk9zr1vImUcT3N2Q=; b=J+XH6uWAW3mtp9ryZERhIO5RTz7UpJXX0ISGrh6eiHEBZtQ5DccXuubGSINfjBtjYq D+CSK2iBIfahhsUq5Gg7iKILITGVWaYVN5DKlN4Zn2ztLLehdBMGpZ5nHCZsPebuBi59 j+bw9yPdQu3fGW+O7V5X2UAes2SJFvvNnOyDFCI9m44m2i8C/Lnk9+MyJd1q/ZmYuzbY xUJnCPgjHbY+6s514YFgBky0HhyI7X0JFrJvI6fSzGCkNJvHJnKQqc+Tr9brDL2F3Spk nUrRfLWcMr/3iv6hWBdbH3MXUczM6er3HW/oTTwdCihni9ZRtzi/e8GAovQ85z9cg5rQ GF/g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=C9WKOxmWkfW4LPRSnLoIzD57XAizk9zr1vImUcT3N2Q=; b=vtaOcN/FqM5bgNsRMQlsavEIylddYpTRRRYFAMJH4lopxVZ4nDxGVj1cLJrG0SI5Vt vV8SImPZT5/OVz03+/lddQkhlJgbU26bYYWHnrRtapjZ2sjn3aKW5oAZFceizPUWuQCU hCnEW1E/3ofrOj91X+2WY1rnTdmK5lIDCgM1/t8ovYMvBfhi1wp6QXulhQiBmAcX/+lZ yXowtzo9t9SuX1BU/jmQUjU9mUxntH38dUVYATuvtSR/Fu7jTiGLI49Q5YsE0dQPdHLF v7RV2L0soFzMbRZ/jC8nxC/cG4u8Q1K04G5swQKGeh0hfUbe99C6cple3vDsXgqSxi0P S/Zw== X-Gm-Message-State: ANoB5pl2fSJ2xuEx9EmIVMW9LlltTezuu5hK/LJAdjVTZEHjhBRNGymW 4FkRxD2BbdzJxWT7nxSp9BEdZlhSwCWRIuapKWNnQw== X-Google-Smtp-Source: AA0mqf5JqO0RWjrk2CGn7HiRfFaulAHm7j02wuTI4sJc1JkY/dCQghaPTFTFYshY1va1Q1nAOmgUS5UwyeDruhxe7vw= X-Received: by 2002:a0d:f645:0:b0:3ba:76ae:dade with SMTP id g66-20020a0df645000000b003ba76aedademr36378869ywf.93.1670025076845; Fri, 02 Dec 2022 15:51:16 -0800 (PST) MIME-Version: 1.0 References: <20221202223533.1785418-1-almasrymina@google.com> In-Reply-To: <20221202223533.1785418-1-almasrymina@google.com> From: Shakeel Butt Date: Fri, 2 Dec 2022 15:51:05 -0800 Message-ID: Subject: Re: [PATCH v3] mm: Add nodes= arg to memory.reclaim To: Mina Almasry Cc: Tejun Heo , Zefan Li , Johannes Weiner , Jonathan Corbet , Michal Hocko , Roman Gushchin , Muchun Song , Andrew Morton , Huang Ying , Yang Shi , Yosry Ahmed , weixugc@google.com, fvdl@google.com, Michal Hocko , bagasdotme@gmail.com, cgroups@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: C4D7E40012 X-Stat-Signature: 3c47k78pqqc4faikht6ikdwefaosnex1 X-Rspam-User: X-Spamd-Result: default: False [3.07 / 9.00]; SORBS_IRL_BL(3.00)[209.85.128.181:from]; BAD_REP_POLICIES(0.10)[]; RCVD_NO_TLS_LAST(0.10)[]; MIME_GOOD(-0.10)[text/plain]; BAYES_HAM(-0.03)[51.22%]; RCVD_COUNT_TWO(0.00)[2]; MIME_TRACE(0.00)[0:+]; FROM_EQ_ENVFROM(0.00)[]; DMARC_POLICY_ALLOW(0.00)[google.com,reject]; RCPT_COUNT_TWELVE(0.00)[20]; DKIM_TRACE(0.00)[google.com:+]; TO_MATCH_ENVRCPT_SOME(0.00)[]; PREVIOUSLY_DELIVERED(0.00)[linux-mm@kvack.org]; R_DKIM_ALLOW(0.00)[google.com:s=20210112]; ARC_SIGNED(0.00)[hostedemail.com:s=arc-20220608:i=1]; FROM_HAS_DN(0.00)[]; R_SPF_ALLOW(0.00)[+ip4:209.85.128.0/17]; TO_DN_SOME(0.00)[]; ARC_NA(0.00)[] X-Rspamd-Server: rspam08 X-HE-Tag: 1670025077-718717 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: On Fri, Dec 2, 2022 at 2:37 PM Mina Almasry wrote: > > The nodes= arg instructs the kernel to only scan the given nodes for > proactive reclaim. For example use cases, consider a 2 tier memory system: > > nodes 0,1 -> top tier > nodes 2,3 -> second tier > > $ echo "1m nodes=0" > memory.reclaim > > This instructs the kernel to attempt to reclaim 1m memory from node 0. > Since node 0 is a top tier node, demotion will be attempted first. This > is useful to direct proactive reclaim to specific nodes that are under > pressure. > > $ echo "1m nodes=2,3" > memory.reclaim > > This instructs the kernel to attempt to reclaim 1m memory in the second tier, > since this tier of memory has no demotion targets the memory will be > reclaimed. > > $ echo "1m nodes=0,1" > memory.reclaim > > Instructs the kernel to reclaim memory from the top tier nodes, which can > be desirable according to the userspace policy if there is pressure on > the top tiers. Since these nodes have demotion targets, the kernel will > attempt demotion first. > > Since commit 3f1509c57b1b ("Revert "mm/vmscan: never demote for memcg > reclaim""), the proactive reclaim interface memory.reclaim does both > reclaim and demotion. Reclaim and demotion incur different latency costs > to the jobs in the cgroup. Demoted memory would still be addressable > by the userspace at a higher latency, but reclaimed memory would need to > incur a pagefault. > > The 'nodes' arg is useful to allow the userspace to control demotion > and reclaim independently according to its policy: if the memory.reclaim > is called on a node with demotion targets, it will attempt demotion first; > if it is called on a node without demotion targets, it will only attempt > reclaim. > > Acked-by: Michal Hocko > Signed-off-by: Mina Almasry > Acked-by: Shakeel Butt