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 X-Spam-Level: X-Spam-Status: No, score=-8.5 required=3.0 tests=INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CA141C43603 for ; Thu, 5 Dec 2019 11:45:25 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 9952920707 for ; Thu, 5 Dec 2019 11:45:25 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9952920707 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 2CD4B6B0FFE; Thu, 5 Dec 2019 06:45:25 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 27D226B0FFF; Thu, 5 Dec 2019 06:45:25 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1BAD36B1000; Thu, 5 Dec 2019 06:45:25 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0242.hostedemail.com [216.40.44.242]) by kanga.kvack.org (Postfix) with ESMTP id 071C36B0FFE for ; Thu, 5 Dec 2019 06:45:25 -0500 (EST) Received: from smtpin20.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with SMTP id 96F69180AD80F for ; Thu, 5 Dec 2019 11:45:24 +0000 (UTC) X-FDA: 76230907368.20.train13_2f29e30362310 X-HE-Tag: train13_2f29e30362310 X-Filterd-Recvd-Size: 5434 Received: from mail-wm1-f66.google.com (mail-wm1-f66.google.com [209.85.128.66]) by imf11.hostedemail.com (Postfix) with ESMTP for ; Thu, 5 Dec 2019 11:45:23 +0000 (UTC) Received: by mail-wm1-f66.google.com with SMTP id f129so3316869wmf.2 for ; Thu, 05 Dec 2019 03:45:23 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=FqjNTT6coY6lOQrNhqII9hKDdSPswnOtW3O4CX9UYzE=; b=gZOC2B6fomP3mInba9FFtF6FuRkBrekfCwTzk71GMsbnbWOSTvabOC16SMvUUSqbqh 8GNZDfjSyMo7xVMGJa7PXP/B8Qt/RW2u6S+Xr7Vv8FPxkweLrpWGjDlHwC1z9W1uazS/ RHRfSt0a2pLD4e2XMZLQbY0TuwiUM504HSWYPeP6mCtFZLsl9DHpa8WB/p9R7czGgxpw wuGR1y+7pTEkwVyN8jlYf9uge8ojq+OnZ1EwlmxdZ4pX+Yz6F3obG+458uR7Am9T1qbg yKUmtl+IQPE0gQgaL2KeN5cITxFpr+Yenv/B1zvK4gIjdZLmdM5aAFl9yw+h3yK6RTmD PHyQ== X-Gm-Message-State: APjAAAVHzfh2zyGiBG6idAginA7MK21qu7+cgLfZpJJim7OnUTanZPpN E+QJZ8kYGu2295HjuHr4Eyw= X-Google-Smtp-Source: APXvYqypYEtsGbwttnIbAz/amuCFqz2KBFl3pQq5IOrM218QwbC7Xmj0DinQhJ1Qh+hUdMUhDXKgmg== X-Received: by 2002:a1c:c90e:: with SMTP id f14mr4794615wmb.35.1575546322970; Thu, 05 Dec 2019 03:45:22 -0800 (PST) Received: from localhost (prg-ext-pat.suse.com. [213.151.95.130]) by smtp.gmail.com with ESMTPSA id i10sm12343249wru.16.2019.12.05.03.45.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Dec 2019 03:45:22 -0800 (PST) Date: Thu, 5 Dec 2019 12:45:21 +0100 From: Michal Hocko To: Kirill Tkhai Cc: Yang Shi , hannes@cmpxchg.org, shakeelb@google.com, guro@fb.com, akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] mm: vmscan: protect shrinker idr replace with CONFIG_MEMCG Message-ID: <20191205114521.GF28317@dhcp22.suse.cz> References: <1575486978-45249-1-git-send-email-yang.shi@linux.alibaba.com> <20191205094341.GC28317@dhcp22.suse.cz> <894b9951-449d-6d7e-84aa-a1c510417710@virtuozzo.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <894b9951-449d-6d7e-84aa-a1c510417710@virtuozzo.com> User-Agent: Mutt/1.10.1 (2018-07-13) 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 Thu 05-12-19 13:00:31, Kirill Tkhai wrote: > On 05.12.2019 12:43, Michal Hocko wrote: > > On Thu 05-12-19 11:23:28, Kirill Tkhai wrote: > >> On 04.12.2019 22:16, Yang Shi wrote: > >>> Since commit 0a432dcbeb32edcd211a5d8f7847d0da7642a8b4 ("mm: shrinker: > >>> make shrinker not depend on memcg kmem"), shrinkers' idr is protected by > >>> CONFIG_MEMCG instead of CONFIG_MEMCG_KMEM, so it makes no sense to > >>> protect shrinker idr replace with CONFIG_MEMCG_KMEM. > >>> > >>> Cc: Kirill Tkhai > >>> Cc: Johannes Weiner > >>> Cc: Michal Hocko > >>> Cc: Shakeel Butt > >>> Cc: Roman Gushchin > >>> Signed-off-by: Yang Shi > >> > >> It looks like that in CONFIG_SLOB case we do not even call some shrinkers > >> for subordinate mem cgroups (i.e., we don't call deferred_split_shrinker), > >> since they never become completely registered. > >> > >> Fixes: 0a432dcbeb32edcd211a5d8f7847d0da7642a8b4 ("mm: shrinker: make shrinker not depend on memcg kmem") > > > > I am confused. Why the Fixes tag? Nothing should be really broken with > > KMEM config guard right? > > idr_replace() is disabled in CONFIG_MEMCG && CONFIG_SLOB case, and this is > wrong. > > 0a432dcbeb32edcd211a5d8f7847d0da7642a8b4 goes in the series, which enables > shrinker_idr infrastructure for huge_memory.c's deferred_split_shrinker > in CONFIG_MEMCG case. Previously, all SHRINKER_MEMCG_AWARE shrinkers were > based on LRUs, and they remain to base of CONFIG_MEMCG_KMEM. > But deferred_split_shrinker is an exception. > > In CONFIG_MEMCG && CONFIG_SLOB case, shrinker_idr contains only shrinker, > and it is deferred_split_shrinker. But it is never actually called, since > idr_replace() is never compiled. deferred_split_shrinker all the time is > staying in half-registered state, and it's never called for subordinate > mem cgroups. > > So, this is a BUG, and this should go to stable. OK, I see. The changelog should describe all that. Thanks for the clarification. > > This is a mere clean up AFAICS. > > > >> Reviewed-by: Kirill Tkhai > >> > >>> --- > >>> mm/vmscan.c | 2 +- > >>> 1 file changed, 1 insertion(+), 1 deletion(-) > >>> > >>> diff --git a/mm/vmscan.c b/mm/vmscan.c > >>> index ee4eecc..e7f10c4 100644 > >>> --- a/mm/vmscan.c > >>> +++ b/mm/vmscan.c > >>> @@ -422,7 +422,7 @@ void register_shrinker_prepared(struct shrinker *shrinker) > >>> { > >>> down_write(&shrinker_rwsem); > >>> list_add_tail(&shrinker->list, &shrinker_list); > >>> -#ifdef CONFIG_MEMCG_KMEM > >>> +#ifdef CONFIG_MEMCG > >>> if (shrinker->flags & SHRINKER_MEMCG_AWARE) > >>> idr_replace(&shrinker_idr, shrinker, shrinker->id); > >>> #endif > >>> > > > -- Michal Hocko SUSE Labs