Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp748387rwb; Wed, 14 Dec 2022 02:11:16 -0800 (PST) X-Google-Smtp-Source: AA0mqf7pJ9hhpiy/1j10OWqsot6u1Ozv/foGjkRNpg9DaloX9EFgeG75v4Y9LxHmoi8GXIiy7iIY X-Received: by 2002:aa7:9522:0:b0:577:c181:bd61 with SMTP id c2-20020aa79522000000b00577c181bd61mr23585475pfp.20.1671012676691; Wed, 14 Dec 2022 02:11:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671012676; cv=none; d=google.com; s=arc-20160816; b=pz/IpZhzOJW/a2zlDS0wqmofE7CCKgxdU55zCUi0Idr7Dp1QR8aikU7sqvjqI2HdL5 u01+r3mWjFQ3m4NJK/LmjyPrUhHLoK1GqFXPPOCJbM+mxMq+RiwR7RElVjKko4i9pxdo +CoYIDmYaB53Iyk/4efNTHVGnstjeTtHcylsbXys5K7bmJr+lgwfVpd6euDRWl8jzV0s jyUr6TTh1SfO9f8fB8IRMgbSeZvsNlwKcN8B9Tej8pIniq8jP4ZcpzDEb1Ld8Kjeccov J01no7HiZOZygiNYtPAOZ9Ro8VhW/XcaAgBCHsGsQiuxWLnAAkUu/2whZHNt8nCEyc/u 9Gaw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=JnGr6T5PzN4rqLE7A7I6Y8MT8u+Eib8ilOJAxivRgLo=; b=r8S/+DU9FWp4GABNmhb6BzdwAG5dtrzhI5ak8SIIipvehtZR+VJFHLWcKJqS5YX04/ oUblR4iry3N1rh9iGBZoq3CSnF3zI2zjKmi2Mm/FOtVM0664UFL2QeygMpAygnRcEVci 6AZ/XI+yHDuEFXuVohog8qnaGn0Ed2h7bHCGrH1l6D9WYSs/agfoM2JIxCEHK6v2pfly +PvekQMj5Nwa/jjVwXkiIYOcAOoOD5h93IEcVkuGGgEXtSad2EN7acTHRq34c2shx6ZP RjAaDXR5Aj1/hqBWPax4LQUD55emCZryPTu1tZhD1ya1o2EXqJJK4pkkdqvO3j09/ye5 MLOA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=fB8E77Qf; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x10-20020a056a00188a00b00571fad2adaasi16388578pfh.224.2022.12.14.02.11.07; Wed, 14 Dec 2022 02:11:16 -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=@suse.com header.s=susede1 header.b=fB8E77Qf; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237909AbiLNJnP (ORCPT + 70 others); Wed, 14 Dec 2022 04:43:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49948 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237645AbiLNJnL (ORCPT ); Wed, 14 Dec 2022 04:43:11 -0500 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 422362DF5 for ; Wed, 14 Dec 2022 01:42:58 -0800 (PST) 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-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS autolearn=ham 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 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