Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp1029219pxb; Wed, 27 Oct 2021 17:47:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyBtghSjF4Mr3Vn/ZdNySXe9WCWMYtNwLY6AavSr8TfYrpr7L73XmuN9OwEzTy9GdOxuooJ X-Received: by 2002:a17:902:7804:b0:13e:d4c6:e701 with SMTP id p4-20020a170902780400b0013ed4c6e701mr842861pll.66.1635382039040; Wed, 27 Oct 2021 17:47:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635382039; cv=none; d=google.com; s=arc-20160816; b=qPd9YNWC0aV7L8ZD74ERJpyarEyNKqF+vndWG4UAANeS6xtYuzH5NXLQuphwMyj88p GCUAfme1FaPuamtx7Nh7OjrrlRU0gXbmxjkgGapktZKDDAv9DA8HV17xLRRBvL5hIYBJ +RbtgTSDUgyu8lfPGnRgY6Yho/iN/+tMDE2iRF1W9FC5qVdiKqBflU34yjoYBSJsVXEt Mlo2oPHEaGFYC4nacDE2JbMuARkIXCFLCzQ2Ttk1Ka+EfbII3QsAU4MLVtur1fVGMYHz cZd8q3vLPJixqozOYK1iE0L1nKJETGz+H0SJHfUgc8MiJxAZ3hij0b4PX8Qh1oHvXfk/ 1uFw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=WP0EhpkPG4zhYCdaeYS6YIcnXfowG3Qfj8auHLu7RCs=; b=k5jcR0w0u3qSYFIQh9nhXPPlFkd+TlNpkwbkd6Y+ngfYtkoipxcXRbp4ZfG5cu8u3P 7Zb/p+BzaxYbzR0hyuCIAUCLAU1VQNS7qi9+auZUZmKM0v5zyauFXVJauGAhGm6rCDGg DcnEzsFh5Q9UOgAZDY0oRGD7FAaBKmUPrtOtOaHAtBLp0B1wJxuwkfiN6JbfMsjMFw0u qd3rUAwT/33Eqdqyybp4yhQJlOc4rBeSCEKTYcL8Dc5AH5hMf2nt6C20TvsuURU/ERKz kiy8GwX0MYXakfh9931SyEZf2FQ82FEdcAHbuGv848uAKBnEfzqp7biJ1junyA8eGxdJ /alg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=EUM+LqN+; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q2si2425838pfj.271.2021.10.27.17.47.05; Wed, 27 Oct 2021 17:47:19 -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=@gmail.com header.s=20210112 header.b=EUM+LqN+; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229515AbhJ1Ash (ORCPT + 99 others); Wed, 27 Oct 2021 20:48:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43944 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229437AbhJ1Asg (ORCPT ); Wed, 27 Oct 2021 20:48:36 -0400 Received: from mail-qv1-xf30.google.com (mail-qv1-xf30.google.com [IPv6:2607:f8b0:4864:20::f30]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8FA14C061570 for ; Wed, 27 Oct 2021 17:46:10 -0700 (PDT) Received: by mail-qv1-xf30.google.com with SMTP id a5so41097qvn.4 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=zWFtegl3hVZE8MaUoUFgSWUy8xwfgnGWWIV3aTCwt6NEReJMInw/vdvbF30nowIuIV 6wEo71gx0iWxT5D6qqQzPX94vFhofpdyXY7l6ZVBWKcki6SqOguZqSl4cuu8MgAernT9 mWsR922DIdoyCSPriErOztjDCoxeyUT5Vl5RDXQ8nWB4TX+olw686ojLPtkno4MrUafE 8TtWCObMTaqP/QjNcCIs6gu7cnGL+g7LzxVHEc3EfOlI3ssKefabBzOMIL52FSF1LZOa qxX1AssIdon8jARrBMduY2RJj55lZHrInlwm1nveXiTt7IerxevIgmgZ8wKhzHgeafNb VFmQ== X-Gm-Message-State: AOAM530deRgab34ZDXS/r/AljzScO3iyT4x7ypzlslUwdfHQYuc7t3KI NO2tgFDeES5AKFCgkHdsD6OjQ2TU8LmNvwNFS/g= 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" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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