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 84446C4332F for ; Wed, 23 Nov 2022 18:00:12 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D90666B0071; Wed, 23 Nov 2022 13:00:11 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id D403C6B0073; Wed, 23 Nov 2022 13:00:11 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BE0F26B0074; Wed, 23 Nov 2022 13:00:11 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id AB3816B0071 for ; Wed, 23 Nov 2022 13:00:11 -0500 (EST) Received: from smtpin15.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 6FBC1C121C for ; Wed, 23 Nov 2022 18:00:11 +0000 (UTC) X-FDA: 80165471022.15.765B097 Received: from mail-qt1-f179.google.com (mail-qt1-f179.google.com [209.85.160.179]) by imf12.hostedemail.com (Postfix) with ESMTP id 9A18D40010 for ; Wed, 23 Nov 2022 18:00:10 +0000 (UTC) Received: by mail-qt1-f179.google.com with SMTP id c15so11729503qtw.8 for ; Wed, 23 Nov 2022 10:00:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cmpxchg-org.20210112.gappssmtp.com; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=9A8cQiLxG2eDxIN9LqbxR9kHprQzAjhFPvRfMzy2nbA=; b=JThIsrnalYZmSDDhQKwWGGeuUVFsTtfznTSg/LnbVkKWTcX9TtIOv42OyoGs/EtBM8 5lKGVFslA1HnCNcURKMoM7T/K5hQwmN15JAejQfmZfRaoCm/MMDOmrdCHuzVCDcYlBOm 3IAENmp+qd/OJOhBTPrmss/VakKTnaf6J5wSznE4djUqzpdYatYSslwQHPZmXSf277kI D2w+/RQ5P18zqyLmhAbeXS1zvALCeHv+RG+/JYfuS9W+4DGU4sd57x7C61z2PraoCam2 GEGp6cj7FfpM9ECL7TpcAPgq0EZ2u8/s5TQ1PwqG5SQpnHDtFREeAmmJ6yvoVy//Qa5W SsjA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=9A8cQiLxG2eDxIN9LqbxR9kHprQzAjhFPvRfMzy2nbA=; b=avjw8LakkeYEdtA5RYETze3QSGVstZFwjDwPhHaeYF1MVJaqbHBKMs35q1N8pwn22j 1UDZk23jFbEmxLVYApYjEF0qgdYL6KHzmF7ds6TbG/Bt2mI3kC7YCOhrJvKM3UXEPyze mhKXv8GM/7nj+bRxW8lEAl0ljmnx7ftDHNWzKzxcPiEisOIRsjdGDocSD6bjdpayIT6h gj8/ISR+XQjBAKqjekZ5oxJEircN4Cf1KIPDYYUIAvRkrrWBt8oUUoe0jtQKdbkqnWEz wMjfJMz3MuvOrkH7ZYQa+k1EzkHPbcMtg0ph5Kj0+4TWnXo6ZM0Q+FN+YJDqKuuqm4Ur 4kLg== X-Gm-Message-State: ANoB5plv6P/QuU+vYGPpk0UbnA5J2udXIEZsvKDvoqf1VUp3xT4sVYFy xoJ4xeqt0jBuUrAO/7/9wYJsKg== X-Google-Smtp-Source: AA0mqf7yzb7BfNDeGRABLsmwYWSqaGKI2q66TVb/68TnDeMjm5zA8YnyzmhmQSDqNQ1wSvG+wsNWTA== X-Received: by 2002:a05:622a:4890:b0:3a5:84b9:3292 with SMTP id fc16-20020a05622a489000b003a584b93292mr27137746qtb.119.1669226409525; Wed, 23 Nov 2022 10:00:09 -0800 (PST) Received: from localhost ([2620:10d:c091:480::1:bc4]) by smtp.gmail.com with ESMTPSA id i10-20020a05620a404a00b006bb8b5b79efsm12868905qko.129.2022.11.23.10.00.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Nov 2022 10:00:09 -0800 (PST) Date: Wed, 23 Nov 2022 13:00:35 -0500 From: Johannes Weiner To: Mina Almasry Cc: Huang Ying , Yang Shi , Yosry Ahmed , Tim Chen , weixugc@google.com, shakeelb@google.com, gthelen@google.com, fvdl@google.com, Michal Hocko , Roman Gushchin , Muchun Song , Andrew Morton , linux-kernel@vger.kernel.org, cgroups@vger.kernel.org, linux-mm@kvack.org Subject: Re: [RFC PATCH V1] mm: Disable demotion from proactive reclaim Message-ID: References: <20221122203850.2765015-1-almasrymina@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20221122203850.2765015-1-almasrymina@google.com> ARC-Authentication-Results: i=1; imf12.hostedemail.com; dkim=pass header.d=cmpxchg-org.20210112.gappssmtp.com header.s=20210112 header.b=JThIsrna; spf=pass (imf12.hostedemail.com: domain of hannes@cmpxchg.org designates 209.85.160.179 as permitted sender) smtp.mailfrom=hannes@cmpxchg.org; dmarc=pass (policy=none) header.from=cmpxchg.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1669226411; a=rsa-sha256; cv=none; b=lXkr2ZkFlqteDWuZoCWL/zfIajkdAwxz5Xwsw82ECaNYWbmU0M0aCBPnZxkSpdAIycUyly gQYOY1alOFBWAtRYcMPRebmaQk2c5gZc5DoBT5GqkdcEMSLOl6zGsz+wL9pIWo+49BhmdP R6Cdylw1AuLcNEnMdajpZQm96n5r8Ew= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1669226411; 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=9A8cQiLxG2eDxIN9LqbxR9kHprQzAjhFPvRfMzy2nbA=; b=qNEWHIfNslQXtdrshXRmq1wkedwA2+eU5N9tQxtOHEFvVv+ljaSRE85R/zqFhFld9TAG1h 3jDXl63LZPI7UbEOGa5xyZJCLGbRks09X99UGqSBOAUp2empa8ucR9zghNjo+YgXtWWTGE Xa/9C9c/pM5hxzkC/KzwRFGqyISAPUs= X-Rspamd-Queue-Id: 9A18D40010 X-Rspam-User: Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=cmpxchg-org.20210112.gappssmtp.com header.s=20210112 header.b=JThIsrna; spf=pass (imf12.hostedemail.com: domain of hannes@cmpxchg.org designates 209.85.160.179 as permitted sender) smtp.mailfrom=hannes@cmpxchg.org; dmarc=pass (policy=none) header.from=cmpxchg.org X-Rspamd-Server: rspam06 X-Stat-Signature: xt5tbjhkx57hbutujscmgfrtni8ud4fi X-HE-Tag: 1669226410-817260 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: Hello Mina, On Tue, Nov 22, 2022 at 12:38:45PM -0800, Mina Almasry wrote: > Since commit 3f1509c57b1b ("Revert "mm/vmscan: never demote for memcg > reclaim""), the proactive reclaim interface memory.reclaim does both > reclaim and demotion. This is likely fine for us for latency critical > jobs where we would want to disable proactive reclaim entirely, and is > also fine for latency tolerant jobs where we would like to both > proactively reclaim and demote. > > However, for some latency tiers in the middle we would like to demote but > not reclaim. This is because 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. > > To address this, I propose having reclaim-only and demotion-only > mechanisms in the kernel. There are a couple possible > interfaces to carry this out I considered: > > 1. Disable demotion in the memory.reclaim interface and add a new > demotion interface (memory.demote). > 2. Extend memory.reclaim with a "demote=" flag to configure the demotion > behavior in the kernel like so: > - demote=0 would disable demotion from this call. > - demote=1 would allow the kernel to demote if it desires. > - demote=2 would only demote if possible but not attempt any > other form of reclaim. Unfortunately, our proactive reclaim stack currently relies on memory.reclaim doing both. It may not stay like that, but I'm a bit wary of changing user-visible semantics post-facto. In patch 2, you're adding a node interface to memory.demote. Can you add this to memory.reclaim instead? This would allow you to control demotion and reclaim independently as you please: if you call it on a node with demotion targets, it will demote; if you call it on a node without one, it'll reclaim. And current users will remain unaffected.