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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8726EC433EF for ; Thu, 28 Oct 2021 00:46:13 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 00461610C7 for ; Thu, 28 Oct 2021 00:46:12 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 00461610C7 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 63673940007; Wed, 27 Oct 2021 20:46:11 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 5E6686B0072; Wed, 27 Oct 2021 20:46:11 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4AEB7940007; Wed, 27 Oct 2021 20:46:11 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0201.hostedemail.com [216.40.44.201]) by kanga.kvack.org (Postfix) with ESMTP id 20DE56B0071 for ; Wed, 27 Oct 2021 20:46:11 -0400 (EDT) Received: from smtpin01.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id A6A4018311475 for ; Thu, 28 Oct 2021 00:46:10 +0000 (UTC) X-FDA: 78744004500.01.D8E9A2C Received: from mail-qv1-f48.google.com (mail-qv1-f48.google.com [209.85.219.48]) by imf31.hostedemail.com (Postfix) with ESMTP id 960871048E29 for ; Thu, 28 Oct 2021 00:46:09 +0000 (UTC) Received: by mail-qv1-f48.google.com with SMTP id v2so2973491qve.11 for ; Wed, 27 Oct 2021 17:46:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=WP0EhpkPG4zhYCdaeYS6YIcnXfowG3Qfj8auHLu7RCs=; b=EUM+LqN+o9a7VH2KekR6Y3w0AyEmah+uVCPv4CyO8pqV9nqErxTZPWntW2h9ZNKKL4 5XrX0FbXUAJRY/ge7AsF0Nf6S8tAdWeOwSoRvH3INOmxPgASeqvu4K6D+dSKdLBDPmw5 ePdkiNF9duZVtFg3xIVCkeTJSuMmEPWkHb1bvDAMOJXIEs1LeFl5ym78dui0ygwWKhEa Yo+iXBuPbBKhz+xRPwYYIAKm3L01i+257lvHbK17Mxc3zSZnosxNZ2KP2CAY8YVkaMeV dG7/h9Px9uYj3w938TzUh4Y+k1BvRhVQo66BeeyMMpWNtPBpTumQp2jVBGylPXxqqGtH EbYQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=WP0EhpkPG4zhYCdaeYS6YIcnXfowG3Qfj8auHLu7RCs=; b=hBKoeFuUABjm1rBe7Trsk51KzOX84uD0chVBFhrhoAYKX3+iB0hL8fULEM4bkfZa6W PqFkBpAB+w5r5zH4pDRO1rO4a2yg8S7i/Umo0S5FyYyvHD8d1TUpvg0n7NR/sWG6OdVf jkxcX5R7tF5sQE2IaTRDJrDHj7ZKQZ5yXf+DVt7yEhtJYjSsT5+3rtoFvEZ1xmbkBbAb fFtmaE5hpRQ3se4CpN1LU/ArABJRUSSyEKtbWktC5NH4B+aNGE52W64HoJxcOrrUpurD G1S9GCy/SaR2iFMMMGnZGvfkIXzadirsrT2+Yb5oCtiKg32wO1oWHobBoRRA3n2EaFkR H4Eg== X-Gm-Message-State: AOAM530YwvX0uB+LiD3TFgXEr46P2gpVssoH04w6dn/D+MyuKqtQOYqA ebuqOpthxunAuCbymfeF09MBBXK2PCUsNjJmtUc= X-Google-Smtp-Source: ABdhPJyk1ad7CpmSuwErS4kaMQ80cWFsf/AMP3JYRDaABDbZQ4W5J6rNN9xROzGYWZigqV/y4ckIjFElBHtqIMPUplI= X-Received: by 2002:a05:6214:411e:: with SMTP id kc30mr1228742qvb.6.1635381969675; Wed, 27 Oct 2021 17:46:09 -0700 (PDT) MIME-Version: 1.0 References: <1635318110-1905-1-git-send-email-huangzhaoyang@gmail.com> In-Reply-To: From: Zhaoyang Huang Date: Thu, 28 Oct 2021 08:45:48 +0800 Message-ID: Subject: Re: [RFC PATCH] mm: have kswapd only reclaiming use min protection on memcg To: Michal Hocko Cc: Andrew Morton , Johannes Weiner , Vladimir Davydov , Zhaoyang Huang , "open list:MEMORY MANAGEMENT" , LKML Content-Type: text/plain; charset="UTF-8" X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: 960871048E29 X-Stat-Signature: gnjtqrnnk1hq6ec1qbkmtecm3s3kgjsz Authentication-Results: imf31.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=EUM+LqN+; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf31.hostedemail.com: domain of huangzhaoyang@gmail.com designates 209.85.219.48 as permitted sender) smtp.mailfrom=huangzhaoyang@gmail.com X-HE-Tag: 1635381969-138243 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 Wed, Oct 27, 2021 at 8:31 PM Michal Hocko wrote: > > 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? We do have out of tree code behave like this and want to make the mechanics more robust > > -- > Michal Hocko > SUSE Labs