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 66B01C4332F for ; Fri, 16 Dec 2022 08:40:39 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7B9828E0003; Fri, 16 Dec 2022 03:40:38 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 768458E0002; Fri, 16 Dec 2022 03:40:38 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 630BC8E0003; Fri, 16 Dec 2022 03:40:38 -0500 (EST) 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 545868E0002 for ; Fri, 16 Dec 2022 03:40:38 -0500 (EST) Received: from smtpin12.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 0C328A0A8D for ; Fri, 16 Dec 2022 08:40:38 +0000 (UTC) X-FDA: 80247523356.12.157B2D8 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by imf05.hostedemail.com (Postfix) with ESMTP id 37D06100018 for ; Fri, 16 Dec 2022 08:40:35 +0000 (UTC) Authentication-Results: imf05.hostedemail.com; dkim=pass header.d=suse.com header.s=susede1 header.b=Bw8en1xm; spf=pass (imf05.hostedemail.com: domain of mhocko@suse.com designates 195.135.220.29 as permitted sender) smtp.mailfrom=mhocko@suse.com; dmarc=pass (policy=quarantine) header.from=suse.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1671180036; a=rsa-sha256; cv=none; b=jgANlsH6UQixryJ5tGrI7Vbdtk/8EB1ZFk7fcxQPj7BHAP1puwIN6HqzfcLHRS4os/RbEK cQu9aG4k+lOY3zRMnfhql6/D16dSXoq8y1mltt7aegI8xO3h1o7+oZYu3gRjvDzObtgUE9 A+rxakM/wTKTPWKzYvH0OzUqH7YyBg4= ARC-Authentication-Results: i=1; imf05.hostedemail.com; dkim=pass header.d=suse.com header.s=susede1 header.b=Bw8en1xm; spf=pass (imf05.hostedemail.com: domain of mhocko@suse.com designates 195.135.220.29 as permitted sender) smtp.mailfrom=mhocko@suse.com; dmarc=pass (policy=quarantine) header.from=suse.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1671180036; 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=3nvimj2ZFEx9YlSQKEbscjAQshU+naWh0RT6szJpxbY=; b=UXQw4Y5/5dyQoVuuObKVhNhOTe+lGlVM497JC0KPkaKLlK36BKoAgC2Ke9aqboDebKrDKg 2CcopaFahh8wKKsZVvsKUiFz5mZYQgkF/10Cy6OsEdbQUswAlD5bcmzechpyrInyFF6p33 9L4s9HZNzesAWFwW2/ye4JYgYxzFUoQ= Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id A2AD021064; Fri, 16 Dec 2022 08:40:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1671180034; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=3nvimj2ZFEx9YlSQKEbscjAQshU+naWh0RT6szJpxbY=; b=Bw8en1xmr0xlc033t59Fmd9xvJ/ey7A/H7JtocX065COY8g9zeA9OnNx20n2Ecsfjj43n/ FWc+JP9gV724C3PypNeuOfBOmHNZKslYtZkGj1Kg9xqrZxwikmlBC/Kr73SRMVPlE6A53h 68JY5QsKr1zGoq1BIgq+jwbjwvzffq0= Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 8F403138FD; Fri, 16 Dec 2022 08:40:34 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id IE7GIQIvnGM2NAAAMHmgww (envelope-from ); Fri, 16 Dec 2022 08:40:34 +0000 Date: Fri, 16 Dec 2022 09:40:34 +0100 From: Michal Hocko To: Wei Xu Cc: Mina Almasry , Johannes Weiner , "Huang, Ying" , Tejun Heo , Zefan Li , Jonathan Corbet , Roman Gushchin , Shakeel Butt , Muchun Song , Andrew Morton , Yang Shi , Yosry Ahmed , fvdl@google.com, bagasdotme@gmail.com, cgroups@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: Re: [PATCH v3] mm: Add nodes= arg to memory.reclaim Message-ID: References: <20221202223533.1785418-1-almasrymina@google.com> <87k02volwe.fsf@yhuang6-desk2.ccr.corp.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Rspam-User: X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: 37D06100018 X-Stat-Signature: 44jk43ap9cwbz866gbwhrzo1r4n6a6bo X-HE-Tag: 1671180035-924478 X-HE-Meta: U2FsdGVkX1913o7PrbZXWEN9CYbvNCabbdcj3G8TkZ2XLRfQDxXH9Kz0kclsG6z15YCPDSVMVRrsLyQJywpivRaUYobfTnTBqW9UQnmMObDzOrZOCAxFurEShgbWwIHwlKCY3hh6Xf2H9y4aSksJDaEipIVOyMoj2JYX2pDtlxMtJfwqf94f9uRTgpXh45teMUEgccIx8D+YILHTZdDjuai5L0BtQYClO6rjWfJ7mnKqAocumyDY0toIaIcZq8Kw6aZrBu/nKnoWdgXMNYJzbayDfpRamEm3miW0k5Jmao2GzMfbSPA/Vxs63Ia1wsV7qMvZOjdZBYlrpAjD0OfwEXGcXRy0mB1ca+nyaKn6uF1M9inp07RSGorekSMLNhvtxZFsXHqPIbiGDNIqhb9Tk5mR75B02xDifeOXh4DuYsH20P8TKa+fAy4PFEmWwUZhGpZj3PSq0pPEkPYm1UI0FHH4b4Ea5CEVnzPBbDMirk477fmnjEXOlbYFUKcODRrCYM6Uzi2OEDNjq3Et9vSFwgIyMwzw5q8lV3U1n2Fxlvgbsv56qCSDUWTVQsJ0fiNLBnuU2SoxK+dM4pEEL6uoIY1/kxCOXFPotqlbYCN5y2uj5kM4BvXr3br9KYLRhb9uP4sMYWw5fE5CpmxbQqCZZ/XZmsA52GiztP8/5s0fnQsz7SmIS5szNz/NGdl2u26cCKELZ/8f/DncrfTxEv1Od2dluUHy83hlwscBExemMnLwegfNzDeXIJ0oT5Mooqg6X7PO7Te9m/+vnmC46D75iaU/Qs1ERz0wCOmNmQxziDLTI8KcWWYLtb+Rd+doPLdHB59vsPENwKGnMZRc0tjOcuYGhHufsq0ls7dCIXKozdsU9unBQAjzgw== 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 Thu 15-12-22 09:58:12, Wei Xu wrote: > On Wed, Dec 14, 2022 at 2:23 AM Michal Hocko wrote: > > > > On Tue 13-12-22 11:29:45, Mina Almasry wrote: > > > 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. > > > > But what should happen if the immediate demotion target is full but > > lower tiers are still usable. Should the first one demote before > > allowing to demote from the top tier? > > In that case, the demotion will fall back to the lower tiers. See > node_get_allowed_targets() and establish_demotion_targets().. I am not talking about an implicit behavior that we do not want to cast into interface. If we want to allow a fine grained control over demotion then the implementation shouldn't rely on the current behavior. [...] > > Is there any strong reason for that? We do not have any interface to > > control NUMA balancing from userspace. Why cannot we use the interface > > for that purpose? > > A demotion interface such as memory.demote will trigger the demotion > code path in the kernel, which depends on multiple memory tiers. Demotion is just a fancy name of a directed migration. There is no realy dependency on the HW nor the technology. > I think what you are getting is a more general page migration > interface for memcg, which will need both source and target nodes as > arguments. I think this can be a great idea. It should be able to > support our demotion use cases as well. yes. -- Michal Hocko SUSE Labs