Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp883899pxb; Wed, 27 Oct 2021 14:26:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx/hb1zCWjipN+E1y2L+GPQlIgZLXbkWoWsp8++vWB8uy0D5Z28bOrMbVnNzcBGjLW7Bulk X-Received: by 2002:a50:9eab:: with SMTP id a40mr432412edf.281.1635369964542; Wed, 27 Oct 2021 14:26:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635369964; cv=none; d=google.com; s=arc-20160816; b=0a6pBemu5hbVbQ7KEVtt0JBBRecXJlrazAtM5YS01DvEVTDtuNXmfRx9GcEk3+XfqR KNV/dW+rdHdkc577YIiLBFABxYX+yT6zBGftV75+UnZqsERJLpvGznlZ85E/8YENSat4 p+ZWnY4N3N27amyqeNGKhslM5EDWBmcyOtBVHsOuseOOUXXVxZWTwC4Epb5d6hywJWz9 kZQfsVUbZWrlOlMF40JeLZvRXwtnbAwjYfK8ksE1AYqpBbOjUwyFjSGue2EtmIxD75AD CY0J+fIxW0cWWZ1fy+ybnB5J0HUXInOxI2Y856dZoRKitg2zXnWKujK3cUlhwgRzDoUW qxHw== 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=/ZGtK0xOo2bZRtxCSg2rXfX4YA6Rq3MqUKuL+bVoReU=; b=xTWQftZ82XuiHXlEXXWNrT+Yk8D3WGd3ToPxLjfmDczmUbvO6wa0rDq5ZTPG47ww28 UKAbNd1kyFrnG4P3CgW9roQ9aVtbOh2HmO18p0/Ff1qxXjqZwz46TMj90mmPi1N0mhvA DAakpd1ucA5/ILFVK9eQDIQGFFTADFoucisVMLKCrOVIKGc8wzfrgEXQogxJs9niJ3E+ Z++BdIAkKEjNdMJBFvbWVMRO/unEDw+bkZWSc96Ge0zopqdeD0czDkcii69o/uBODLaY mU9LZvz9PdK2l2vBqHEVusOT8BzHiUW/JPHBJ/95004GHXPFmuZ+RxcWRcetcpqw3fpP 0DaA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=UI5frhLz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=suse.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ne21si1838178ejc.424.2021.10.27.14.25.41; Wed, 27 Oct 2021 14:26:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=UI5frhLz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=suse.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239920AbhJ0Md2 (ORCPT + 97 others); Wed, 27 Oct 2021 08:33:28 -0400 Received: from smtp-out2.suse.de ([195.135.220.29]:47290 "EHLO smtp-out2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236079AbhJ0Md1 (ORCPT ); Wed, 27 Oct 2021 08:33:27 -0400 Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id 88CC41FD46; Wed, 27 Oct 2021 12:31:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1635337861; 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=/ZGtK0xOo2bZRtxCSg2rXfX4YA6Rq3MqUKuL+bVoReU=; b=UI5frhLzPfdiR5xuYknfWR+Ixh2SjrSHGdOyajiaPJJjieIWqojZTa7UFWoBrfCROKw5Wh LKKhPBIn/apdHkrGtjlggB8yu63PuGIa1aa+1jDxwV9xE6Xo83ALVUFNo3nKqEabWEeM2z raoQc8T9XHaK8il6SUahiEcpoAExqUw= Received: from suse.cz (unknown [10.100.201.86]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id 0BB6DA3B83; Wed, 27 Oct 2021 12:31:01 +0000 (UTC) Date: Wed, 27 Oct 2021 14:31:00 +0200 From: Michal Hocko To: Zhaoyang Huang Cc: Andrew Morton , Johannes Weiner , Vladimir Davydov , Zhaoyang Huang , "open list:MEMORY MANAGEMENT" , LKML Subject: Re: [RFC PATCH] mm: have kswapd only reclaiming use min protection on memcg Message-ID: References: <1635318110-1905-1-git-send-email-huangzhaoyang@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed 27-10-21 20:05:30, Zhaoyang Huang wrote: > On Wed, Oct 27, 2021 at 7:52 PM Michal Hocko wrote: > > > > On Wed 27-10-21 17:19:56, Zhaoyang Huang wrote: > > > On Wed, Oct 27, 2021 at 4:26 PM Michal Hocko wrote: > > > > > > > > On Wed 27-10-21 15:46:19, Zhaoyang Huang wrote: > > > > > On Wed, Oct 27, 2021 at 3:20 PM Michal Hocko wrote: > > > > > > > > > > > > On Wed 27-10-21 15:01:50, Huangzhaoyang wrote: > > > > > > > From: Zhaoyang Huang > > > > > > > > > > > > > > For the kswapd only reclaiming, there is no chance to try again on > > > > > > > this group while direct reclaim has. fix it by judging gfp flag. > > > > > > > > > > > > There is no problem description (same as in your last submissions. Have > > > > > > you looked at the patch submission documentation as recommended > > > > > > previously?). > > > > > > > > > > > > Also this patch doesn't make any sense. Both direct reclaim and kswapd > > > > > > use a gfp mask which contains __GFP_DIRECT_RECLAIM (see balance_pgdat > > > > > > for the kswapd part).. > > > > > ok, but how does the reclaiming try with memcg's min protection on the > > > > > alloc without __GFP_DIRECT_RECLAIM? > > > > > > > > I do not follow. There is no need to protect memcg if the allocation > > > > request doesn't have __GFP_DIRECT_RECLAIM because that would fail the > > > > charge if a hard limit is reached, see try_charge_memcg and > > > > gfpflags_allow_blocking check. > > > > > > > > Background reclaim, on the other hand never breaches reclaim protection. > > > > > > > > What is the actual problem you want to solve? > > > Imagine there is an allocation with gfp_mask & ~GFP_DIRECT_RECLAIM and > > > all processes are under cgroups. Kswapd is the only hope here which > > > however has a low efficiency of get_scan_count. I would like to have > > > kswapd work as direct reclaim in 2nd round which will have > > > protection=memory.min. > > > > Do you have an example where this would be a practical problem? Atomic > > allocations should be rather rare. > Please find below for the search result of '~__GFP_DIRECT_RECLAIM' > which shows some drivers and net prefer to behave like that. > Furthermore, the allocations are always together with high order. And what is the _practical_ problem you are seeing or trying to solve? -- Michal Hocko SUSE Labs