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 DFEDACE7AB0 for ; Mon, 9 Sep 2024 07:20:32 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 473F76B0131; Mon, 9 Sep 2024 03:20:32 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 4234B6B0132; Mon, 9 Sep 2024 03:20:32 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2C3946B0133; Mon, 9 Sep 2024 03:20:32 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 0FD9C6B0131 for ; Mon, 9 Sep 2024 03:20:32 -0400 (EDT) Received: from smtpin03.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 701C841DAC for ; Mon, 9 Sep 2024 07:20:31 +0000 (UTC) X-FDA: 82544351862.03.A4F5555 Received: from mail-wm1-f46.google.com (mail-wm1-f46.google.com [209.85.128.46]) by imf12.hostedemail.com (Postfix) with ESMTP id 7E6304000C for ; Mon, 9 Sep 2024 07:20:29 +0000 (UTC) Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=suse.com header.s=google header.b=gIAzlzbW; dmarc=pass (policy=quarantine) header.from=suse.com; spf=pass (imf12.hostedemail.com: domain of mhocko@suse.com designates 209.85.128.46 as permitted sender) smtp.mailfrom=mhocko@suse.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1725866347; a=rsa-sha256; cv=none; b=RE+4yI33zB+nP8nLHwnet8IAIIoop+WpTJc2xh9+HOpV2qyv4VYqxVkspmD2BcKvo5GBO1 nScnZET1h/hwNPuof+2PuThZVQXREaQX6ak+UfBv4sE/kHkai77vX96izpcFYCvbNIuGLl chXl+6GYPvVWhs3FyooTOxePnkLHD0Y= ARC-Authentication-Results: i=1; imf12.hostedemail.com; dkim=pass header.d=suse.com header.s=google header.b=gIAzlzbW; dmarc=pass (policy=quarantine) header.from=suse.com; spf=pass (imf12.hostedemail.com: domain of mhocko@suse.com designates 209.85.128.46 as permitted sender) smtp.mailfrom=mhocko@suse.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1725866347; 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=PUYgRrt73R/AzDLyM5Jg4uBo6/bxbCoymCk3p5vIpyk=; b=MKr3a5m8gG2WRE3iZaChpq2MTeTnYPjXBgIoBL68LoP509WdtyXsx8g89Exoj10vVXw9Nt 0Hbb0M2EyYv12FFwUdRfkJ06U98wU9Vz4/66ZiGiv2SJGBsjlL59aPe+VbO6w8DTOaLKf9 3mlH5FSwElEI/CGHOm3cSFuEyPKQyFk= Received: by mail-wm1-f46.google.com with SMTP id 5b1f17b1804b1-42bb6d3e260so35502875e9.1 for ; Mon, 09 Sep 2024 00:20:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1725866428; x=1726471228; darn=kvack.org; 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=PUYgRrt73R/AzDLyM5Jg4uBo6/bxbCoymCk3p5vIpyk=; b=gIAzlzbWX8lFPvxCTpZXaBX2C8yywVqHVHmo/Ge4bHv4pXafJ3H11RLf9i1iI0sS26 TcgtQepV2pgI0960+Ov7j36EBnpljHrWndoYqt/+hkiBlw/T21EGwd7gzeprUkUc5ZKN TH1i/OB0+9wHZHtnBlyYTNwRH9RZHmiNahat8osvJ1C3nBWIcrhfErCvP9SjnvTfzdNQ M6Krnjnu87r1Chc4OKV+R07GqlJ7KnS/llmFXnXg7RdM3EkA/L5+odYAKPEb2r69qkk1 uuG1O9BnEHqzyIciE3WFAjbDeE9aQd4QVxeEyJQQDECyT/X1XSiRlBOi3fwQ8GgU22T/ DGOw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725866428; x=1726471228; 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=PUYgRrt73R/AzDLyM5Jg4uBo6/bxbCoymCk3p5vIpyk=; b=ckJDgUIk5e4PV0t6Ae6ZR5ihGRbMcnjO0xr9F6TdeTALgruCpp2950zck01/X5IODm CGIEKwQy/Z3S26vYc20sk8uVI9HNmDa3pfc1SWSV/dMMt0eccydroqtonf6UANk7ntVO b7nhYD6okb+vuPW/ac+y6s5c61JU1RHmevAoG3cwXXxll/y5DjgQW7yMLRzYoxLaXCI8 gtf0a7KjviQSL5r+7DpFDOP/9PuqX71235ijRRGfMhkHTcVgCr+8AWmPPULlJyxjqm4s BCOyvLCpEoRa2aFvtrhAIRwAOX89KvaNYh5L2ybB2Jtr14NPN5/LZvMxaRipeu7nM9sL YzkA== X-Gm-Message-State: AOJu0YzhwNbHVCy4lSnWvgHkxgoW+JAwQVgkS35slxkCEbpX30Fv0jzw /lPT6hqiCwiL56CBOaKbt/IXNjylMP/6VmaimADW4EDrQYNk7kK0nY2EU2vgvWk= X-Google-Smtp-Source: AGHT+IFIiDSRSYeBEcV92W79htAPHfJxh9us1KZqt+JswhX3Is2KoO8v4vNKGbVTCpDoomhtPcTkdw== X-Received: by 2002:a05:600c:22cf:b0:42c:a8cb:6a75 with SMTP id 5b1f17b1804b1-42ca8cb6c5amr55206885e9.17.1725866427774; Mon, 09 Sep 2024 00:20:27 -0700 (PDT) Received: from localhost (109-81-94-251.rct.o2.cz. [109.81.94.251]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42caf436998sm65861645e9.29.2024.09.09.00.20.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Sep 2024 00:20:27 -0700 (PDT) Date: Mon, 9 Sep 2024 09:20:26 +0200 From: Michal Hocko To: Davidlohr Bueso Cc: linux-mm@kvack.org, akpm@linux-foundation.org, rientjes@google.com, yosryahmed@google.com, hannes@cmpxchg.org, almasrymina@google.com, roman.gushchin@linux.dev, gthelen@google.com, dseo3@uci.edu, a.manzanares@samsung.com, linux-kernel@vger.kernel.org Subject: Re: [PATCH -next] mm: introduce per-node proactive reclaim interface Message-ID: References: <20240904162740.1043168-1-dave@stgolabs.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240904162740.1043168-1-dave@stgolabs.net> X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: 7E6304000C X-Stat-Signature: srcmci9extayd8y1wbr9c766qw665d9o X-Rspam-User: X-HE-Tag: 1725866429-987857 X-HE-Meta: U2FsdGVkX1+egNkCo2y5old8kWDOQMXWKmwMxEZ0tdzlsMnUnmT+J5W2i77pWbx8mVmSl016a0p3SZYyJH+vdHa5TO510tFHH0vrYulcaspntuzFUTS6PI7hN6sIsPmwPmcbXcuvzsHYQooIhuGxNemlXAhDKWtZd8/ZF+URDS6201RkLQeq0x9nDx5pnJibh0JIZCvJswAF0D1e7qJPQOXPmW8bjDG0lHMPAw5DjJAvSBuDIm7J+D8GVV3Z/aDVqkTNXUQVSmOsK1JhxFH4hPDOS8COJgRscPEunVwsWDiZOl+vnx5nPEzjyCRbddkCz2F5UAMUwzm+oGvSpXgQJnyIiibOV2MByfSl5l0Qsod0+A9/bmw+EkDQ9GzsQHErC9WVxvAOjjnYcl2c/qrdIq+iwanRzg0H7OBWTTdrCAW5GFwAJr8u9+0P/8zTfEXrCTtA86m7jD1Gy0i2KomIpEl8vb0SdSlC5jco6urszH9MSjFtzdQRR+A3zBGrsmvSwjWh6dtphhGWn7+A++L9tMpvSDlMUtriWg+Ewk5mPDlXq6bQp7f9Am7ZU7jjcyfazdhuiBNZs2Wz6P2uE/uZwSjabuHcHN1rKYeCSGzQv95iaknnofLWCU6Susd8oTvmjg1wUneqMiST+z0VOBG+B2wbOqG98QD91eJOYgKJP9QbVCoYtLMrA1L26UN3lfi3fEpBYa+70mGnM6Z2rilYC/09HkO1xUDYHvp1r+UtYyQQbKJpAAFPzIxD3fcLOkEwa40He2oZEvmsCPSOS7xsGVffFzruP4BwaGQlErJlxWpIT2QdDs+37Ebq3MYIpscgqYetlNiNTQ/8I43hSxlhSkrSD3t9il2aUFT3ErTlabNxAVR05u1ZWQTXH5VDwJte1jY+RI8wyK/KQv4r+bKQqWyOyBq/0mFSxeLKMZnJOYGN+D1mF8j334Qjc/PXA6ptQW4WIvQr+p47pSonzWM JiNfv+zz qNKV9n+T0BiwKJisYprR45c34KDEmORJL1cgcvU9k9r1wiqhs7slSnndVsNREd1vYXwQKjromUamkSDevBo6BoRBxAB3YtAdYInuIRWPWNMCBkrHhIcsRQqhFfdlEbyhgxuB/cqOyPkLK+pYWOp6uvJM8W4bzuUKv2cnzQqoOpeJBcgOIADhMaljI59qK+d97PX8RTGa5r9r6dFfBmcXJDlDzNN4MA9siZ++nFhVTRu9D/Nv+oFbDAUpeuyX5OTq3yvUxHfRj4fBAvQRcUZM/B4ZZKVh0zGOrHSDIlOeHaBwBVwNYVcPs1H+exg== 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: List-Subscribe: List-Unsubscribe: On Wed 04-09-24 09:27:40, Davidlohr Bueso wrote: > This adds support for allowing proactive reclaim in general on a > NUMA system. A per-node interface extends support for beyond a > memcg-specific interface, respecting the current semantics of > memory.reclaim: respecting aging LRU and not supporting > artificially triggering eviction on nodes belonging to non-bottom > tiers. > > This patch allows userspace to do: > > echo 512M swappiness=10 > /sys/devices/system/node/nodeX/reclaim > > One of the premises for this is to semantically align as best as > possible with memory.reclaim. During a brief time memcg did > support nodemask until 55ab834a86a9 (Revert "mm: add nodes= > arg to memory.reclaim"), for which semantics around reclaim > (eviction) vs demotion were not clear, rendering charging > expectations to be broken. > > With this approach: > > 1. Users who do not use memcg can benefit from proactive reclaim. It would be great to have some specific examples here. Is there a specific reason memcg is not used? > 2. Proactive reclaim on top tiers will trigger demotion, for which > memory is still byte-addressable. Reclaiming on the bottom nodes > will trigger evicting to swap (the traditional sense of reclaim). > This follows the semantics of what is today part of the aging process > on tiered memory, mirroring what every other form of reclaim does > (reactive and memcg proactive reclaim). Furthermore per-node proactive > reclaim is not as susceptible to the memcg charging problem mentioned > above. > > 3. Unlike memcg, there should be no surprises of callers expecting > reclaim but instead got a demotion. Essentially relying on behavior > of shrink_folio_list() after 6b426d071419 (mm: disable top-tier > fallback to reclaim on proactive reclaim), without the expectations > of try_to_free_mem_cgroup_pages(). I am not sure I understand. If you demote then you effectively reclaim because you free up memory on the specific node. Or do I just misread what you mean? Maybe you meant to say that the overall memory consumption on all nodes is not affected? Your point 4 and 5 follows up on this so we should better clarify that before going there. -- Michal Hocko SUSE Labs