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 A4551C4332F for ; Wed, 14 Dec 2022 09:43:01 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C551D8E0003; Wed, 14 Dec 2022 04:43:00 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id C040F8E0002; Wed, 14 Dec 2022 04:43:00 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id AF29F8E0003; Wed, 14 Dec 2022 04:43:00 -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 A264E8E0002 for ; Wed, 14 Dec 2022 04:43:00 -0500 (EST) Received: from smtpin11.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 6080D1602FE for ; Wed, 14 Dec 2022 09:43:00 +0000 (UTC) X-FDA: 80240422920.11.FCB8ACA Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by imf02.hostedemail.com (Postfix) with ESMTP id A655D80008 for ; Wed, 14 Dec 2022 09:42:58 +0000 (UTC) Authentication-Results: imf02.hostedemail.com; dkim=pass header.d=suse.com header.s=susede1 header.b=fB8E77Qf; dmarc=pass (policy=quarantine) header.from=suse.com; spf=pass (imf02.hostedemail.com: domain of mhocko@suse.com designates 195.135.220.29 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=1671010978; 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=JnGr6T5PzN4rqLE7A7I6Y8MT8u+Eib8ilOJAxivRgLo=; b=Ilgr5p3dePSQ1sDT23k9KDOwcLic3gzOKZNBUB5rcAxnGlPvuhl11UYducvSFoRbZIa0GU 0p055EY4RT7PH1o6sCL7SDJVWT9eM3JiDKrecOuiCsc3ARdjqL7BaGftsHfyh+SoNYgVJp oaWqctFh/zC0AyVOjMlRxOYG9CVoPYQ= ARC-Authentication-Results: i=1; imf02.hostedemail.com; dkim=pass header.d=suse.com header.s=susede1 header.b=fB8E77Qf; dmarc=pass (policy=quarantine) header.from=suse.com; spf=pass (imf02.hostedemail.com: domain of mhocko@suse.com designates 195.135.220.29 as permitted sender) smtp.mailfrom=mhocko@suse.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1671010978; a=rsa-sha256; cv=none; b=sf2KMeBeWxGmP3jfcLHjkzUEMRCMljrhMkKuZ50mM/OekqFRA1PU9NQVdJnKhdDYfeu52q AnGBGOjkBqTIhUXl0hVa4nu7sTYl19VLy7d232FmmpRHFLlwszHfkpBz9JCr9MoYFXA3lJ nusNvYrPj9k8QkdnDJYg1zYc+sZrOHc= 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 1A2D51FE02; Wed, 14 Dec 2022 09:42:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1671010977; 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=JnGr6T5PzN4rqLE7A7I6Y8MT8u+Eib8ilOJAxivRgLo=; b=fB8E77QfidvkfB9OguZfZuOlxxS0DRG0or8DxVTOWL9KJDA0ab/7eRBHC+q0blP0F0Iozi rKeowTne1CI4Gss+GSgZHMZVEYGU5f2mT7qwkqUj9Xk9EE4TqCa4mxrNIqDqQQnYF0/F/9 0vZgkPx4bE4a+ihpWkmaCynrsqtc9kE= 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 EB4AD138F6; Wed, 14 Dec 2022 09:42:56 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id ptpBNKCamWMOCAAAMHmgww (envelope-from ); Wed, 14 Dec 2022 09:42:56 +0000 Date: Wed, 14 Dec 2022 10:42:56 +0100 From: Michal Hocko To: Johannes Weiner Cc: Dave Hansen , "Huang, Ying" , Yang Shi , Wei Xu , Andrew Morton , linux-mm@kvack.org, LKML Subject: Re: memcg reclaim demotion wrt. isolation Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Rspam-User: X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: A655D80008 X-Stat-Signature: jn6pgbaz9qc33tbxpdu6ehnrxa14yah7 X-HE-Tag: 1671010978-696549 X-HE-Meta: U2FsdGVkX1/LEn1NFdF/DJAWgVchhzLbxPhqoWd1JZeTsFSjTO4qx1wT1ZA8dttVJMTXNjQ0LaWEjLP4WAvO9KRtm4j6BWe63i2GktlLBl0h2kdu0xXr5BKENqwbLhRC64GSTueu218+d28fnBvkNM0xlaeiDx6E1z5edLJzWNaB8MmAoJM++47RDc2kUpDFyVolu0ybZD31KxMrHTKg1SF2h6AJIADxVGt5SWjBfbt+3RAr9Uz0HRCqAqaMh/4D1/BKjFdwRmy1iCtOqWsNAlSpZ3Sf1Tl0ZJBKs9HzQqBki/cZ/Z4boZg645wSkNQBcnBZ9mvv/haLTM/9aAg09w9rVYE1S+FIwfyRjZzWQk5SDJ9XdJEbynsoEjByTah0hM7AAPHuwxoeV1oVWg59tq+d5RCSSIfgnkqnaEAzjmM7Wve6mI4SJVQ1j6MKCROHY49s3wHK4akgqsI0RoBYIXWOZe3tMlJTvVSYn0wNFuwl1h4OheYy2CVEo7ZSClZup5yn4/KYl+kFm/CQEHFL1Ttu9OSEU1nrTMSYHDHwSrWC+3CsW0J/txMKCYLlsDh/CKlkRjLl6qvxE9bWn0Dzv170j3VLP8E/qjgK7ItJPc26LifPfIgFlFTbQ0jlx0DDESVUNdb1yRuAYk+SP2jPk9s6qbMCrNI7BJwpN8YBsFHG/xvLUKaQCbPLU461xpNxD8Fj8NcmIzlnMBJ5mAJJrB2aoiQp8mL8nZZCcvJIS+N3SoRpZa6rZoE2K6gD2wWuR0sVOzzVO0dIYztO8H6+7RujcPwKMgkWyxD9ukHl1y1Zryw1CbfIlLC0zZn1KVD4xnCEuwl2XvY5pgv7msJzuo1b8LELjQSDx3uQyETZ/rg= 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 Tue 13-12-22 17:14:48, Johannes Weiner wrote: > On Tue, Dec 13, 2022 at 04:41:10PM +0100, Michal Hocko wrote: > > Hi, > > I have just noticed that that pages allocated for demotion targets > > includes __GFP_KSWAPD_RECLAIM (through GFP_NOWAIT). This is the case > > since the code has been introduced by 26aa2d199d6f ("mm/migrate: demote > > pages during reclaim"). I suspect the intention is to trigger the aging > > on the fallback node and either drop or further demote oldest pages. > > > > This makes sense but I suspect that this wasn't intended also for > > memcg triggered reclaim. This would mean that a memory pressure in one > > hierarchy could trigger paging out pages of a different hierarchy if the > > demotion target is close to full. > > This is also true if you don't do demotion. If a cgroup tries to > allocate memory on a full node (i.e. mbind()), it may wake kswapd or > enter global reclaim directly which may push out the memory of other > cgroups, regardless of the respective cgroup limits. You are right on this. But this is describing a slightly different situaton IMO. > The demotion allocations don't strike me as any different. They're > just allocations on behalf of a cgroup. I would expect them to wake > kswapd and reclaim physical memory as needed. I am not sure this is an expected behavior. Consider the currently discussed memory.demote interface when the userspace can trigger (almost) arbitrary demotions. This can deplete fallback nodes without over-committing the memory overall yet push out demoted memory from other workloads. From the user POV it would look like a reclaim while the overall memory is far from depleted so it would be considered as premature and a warrant a bug report. The reclaim behavior would make more sense to me if it was constrained to the allocating memcg hierarchy so unrelated lruvecs wouldn't be disrupted. -- Michal Hocko SUSE Labs