Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp8915657rwb; Tue, 13 Dec 2022 12:08:53 -0800 (PST) X-Google-Smtp-Source: AA0mqf7/LCmXrRiiFNupLfoMMm9kbr+9OR0uAGvF0BV/Pa8F1MtbKkvCSkhO36aBt4QeJcTofqYJ X-Received: by 2002:a17:902:a416:b0:188:f5de:8908 with SMTP id p22-20020a170902a41600b00188f5de8908mr19876721plq.65.1670962133605; Tue, 13 Dec 2022 12:08:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670962133; cv=none; d=google.com; s=arc-20160816; b=eZiQW2m/CwJRb6BMwyM1Ufve8XEii7bqh7MQx7k/J6hwCFHFiSegvXgq5YxQZguoyi PN1lfQ5veHh3C6CI1gfd7ucu5NIs2sAM5G8OGbCWC2+8M5q+QId/3whIBdO3rbSmaYyl ACpuJh6yq+9hYkvCHeRYkpVEV2f6MC2kRrsoGRwP7IuLVjR9uUnxfOoYcp3OMJAVoupM rKIgRP80CZZJLZi1sc+EQc/oxSZW44/v/hJjfxhGNKX6lJcdpc4ei/4xBPyICtwEd9O+ rarXFNTBAt3eBnqkjsZi3Qg2Ozdq/FHXG8nS64Csd3SSAt9Kj+e27pYhNSrfDaRorbUC 7WkQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=neDu/yrL/JSqlqVsfpnzJOzopkIFlG1Zhb0kcbvbZxE=; b=D6HC5VCISplLi29wFPFyPuDDo9hX8vRniKvX6uR7jHr/AZNIVJArObgFu4TZ+6bc3B +/Plqk1GJN+x1p+gN4KC6zfvkWdqkso5cqQAHqi07rX3DXlxBcNv0IZSDyTUEwj3y8wy qmRG9c4tnWW82sWPQjLP9McQt0QIMoezzpF1SBuywnJeIPmwlNO72B+VW1HaqRCMcnrN J5VpnUhrOFwnitm6sXvX3MnOTdx/F3Khu2wDghkNroswLde5c4psPHaz6FNJOimIM/h3 vxghSI0DuGoRplePoN/lYogLb6YYHyg98TrznXsMYqNmslQH2csKqDDdQS6wpt2ADF6R O7fg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=Co3Pb7L3; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u3-20020a17090341c300b00176d5b20ebesi689757ple.355.2022.12.13.12.08.43; Tue, 13 Dec 2022 12:08:53 -0800 (PST) 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=@google.com header.s=20210112 header.b=Co3Pb7L3; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236817AbiLMTaC (ORCPT + 72 others); Tue, 13 Dec 2022 14:30:02 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40606 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236780AbiLMT37 (ORCPT ); Tue, 13 Dec 2022 14:29:59 -0500 Received: from mail-ua1-x929.google.com (mail-ua1-x929.google.com [IPv6:2607:f8b0:4864:20::929]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D0C5225E8B for ; Tue, 13 Dec 2022 11:29:57 -0800 (PST) Received: by mail-ua1-x929.google.com with SMTP id q22so4350746uap.7 for ; Tue, 13 Dec 2022 11:29:57 -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=neDu/yrL/JSqlqVsfpnzJOzopkIFlG1Zhb0kcbvbZxE=; b=Co3Pb7L35N5xF9xIoLlMGqZks/LFNr4reOf6gCRzOWPQh4D6Vm5kabu8s/xMDPyKTQ ErT7zPGS59EnPAPdgJyQICedLFv7aA4I93fBmhAP2ADL50Q9eHAlOZlo25vtmjegw/ry HAU2435Dz4h3vUBsm3VLQvKKEmtJOKX/r2zbudg7uWWZR1p0L7HQ6EaBhfUEYyiQowii HOgtFY9O2bc1hIO+pd9BTsFuike7L+HqcurRV/1SHITmYxuIlaDBiwdqdX9oEVuyPSVy gSxOOgREz2nB1WeQKwxcAlyv2Gup+c5xEjA/7k1NVdA37rZLc/Jyc9dG7iRjCzzmXeEi bpFg== 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=neDu/yrL/JSqlqVsfpnzJOzopkIFlG1Zhb0kcbvbZxE=; b=haUmDSSgBoAVhurIf7zcQYonPrdnRzJu2FlxCLabztTXUMFhEgDqFw+NqkqUP90Gkk 1mFUWIoajIMOXd8C3lBfeyTKPN1KDdZqfAYse5H218dts3+s2KZJLZ4YB7w6GGVPcE1Z zuP2WvQNifYn7OSmiLP6+ZeIJGkq7j1iY28O1A/Spoohu8cWsXr2G4rmzveMT6HMRQIu m3IAs0w/OWWmUsJ1Ox142thROl5Ldmd/lKX2y64Ki4s1BDf94RWEuTgelyltQo/QHcXi x0/5hmXqSZc/mWNDKx6az3eO0IDCeuG+Q0MHjGyWpPaPygIv0otL+qWPbIhfc3Fv7Yr9 Pr7Q== X-Gm-Message-State: ANoB5pl49/EFuHXlhQw95ciY5Cluee4FWxs7KyuQT3aZEPFRuHcmrUXM oPyo6IvClVoMm5i1NO5s/+clG6PjXwxBKJJje2iiAA== X-Received: by 2002:ab0:6014:0:b0:419:c9d3:a3c6 with SMTP id j20-20020ab06014000000b00419c9d3a3c6mr10708006ual.18.1670959796820; Tue, 13 Dec 2022 11:29:56 -0800 (PST) MIME-Version: 1.0 References: <20221202223533.1785418-1-almasrymina@google.com> <87k02volwe.fsf@yhuang6-desk2.ccr.corp.intel.com> In-Reply-To: From: Mina Almasry Date: Tue, 13 Dec 2022 11:29:45 -0800 Message-ID: Subject: Re: [PATCH v3] mm: Add nodes= arg to memory.reclaim To: Michal Hocko Cc: Johannes Weiner , "Huang, Ying" , Tejun Heo , Zefan Li , Jonathan Corbet , Roman Gushchin , Shakeel Butt , Muchun Song , Andrew Morton , Yang Shi , Yosry Ahmed , weixugc@google.com, fvdl@google.com, 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-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL autolearn=unavailable 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 Tue, Dec 13, 2022 at 6:03 AM Michal Hocko wrote: > > On Tue 13-12-22 14:30:40, Johannes Weiner wrote: > > On Tue, Dec 13, 2022 at 02:30:57PM +0800, Huang, Ying wrote: > [...] > > > After these discussion, I think the solution maybe use different > > > interfaces for "proactive demote" and "proactive reclaim". That is, > > > reconsider "memory.demote". In this way, we will always uncharge the > > > cgroup for "memory.reclaim". This avoid the possible confusion there. > > > And, because demotion is considered aging, we don't need to disable > > > demotion for "memory.reclaim", just don't count it. > > > > Hm, so in summary: > > > > 1) memory.reclaim would demote and reclaim like today, but it would > > change to only count reclaimed pages against the goal. > > > > 2) memory.demote would only demote. > > If the above 2 points are agreeable then yes, this sounds good to me and does address our use case. > > a) What if the demotion targets are full? Would it reclaim or fail? > > Wei will chime in if he disagrees, but I think we _require_ that it fails, not falls back to reclaim. The interface is asking for demotion, and is called memory.demote. For such an interface to fall back to reclaim would be very confusing to userspace and may trigger reclaim on a high priority job that we want to shield from proactive reclaim. > > 3) Would memory.reclaim and memory.demote still need nodemasks? memory.demote will need a nodemask, for sure. Today the nodemask would be useful if there is a specific node in the top tier that is overloaded and we want to reduce the pressure by demoting. In the future there will be N tiers and the nodemask says which tier to demote from. I don't think memory.reclaim would need a nodemask anymore? At least I no longer see the use for it for us. > > Would > > they return -EINVAL if a) memory.reclaim gets passed only toptier > > nodes or b) memory.demote gets passed any lasttier nodes? > Honestly it would be great if memory.reclaim can force reclaim from a top tier nodes. It breaks the aginig pipeline, yes, but if the user is specifically asking for that because they decided in their usecase it's a good idea then the kernel should comply IMO. Not a strict requirement for us. Wei will chime in if he disagrees. memory.demote returning -EINVAL for lasttier nodes makes sense to me. > I would also add > 4) Do we want to allow to control the demotion path (e.g. which node to > demote from and to) and how to achieve that? We care deeply about specifying which node to demote _from_. That would be some node that is approaching pressure and we're looking for proactive saving from. So far I haven't seen any reason to control which nodes to demote _to_. The kernel deciding that based on the aging pipeline and the node distances sounds good to me. Obviously someone else may find that useful. > 5) Is the demotion api restricted to multi-tier systems or any numa > configuration allowed as well? > demotion will of course not work on single tiered systems. The interface may return some failure on such systems or not be available at all. > -- > Michal Hocko > SUSE Labs