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=-2.5 required=3.0 tests=MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=no 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 E353FC432C0 for ; Thu, 28 Nov 2019 09:43:16 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 9D2D021741 for ; Thu, 28 Nov 2019 09:43:16 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9D2D021741 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 533AC6B0513; Thu, 28 Nov 2019 04:43:16 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 4E4086B0514; Thu, 28 Nov 2019 04:43:16 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 421986B0515; Thu, 28 Nov 2019 04:43:16 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0246.hostedemail.com [216.40.44.246]) by kanga.kvack.org (Postfix) with ESMTP id 2C5726B0513 for ; Thu, 28 Nov 2019 04:43:16 -0500 (EST) Received: from smtpin16.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with SMTP id E3FA98249980 for ; Thu, 28 Nov 2019 09:43:15 +0000 (UTC) X-FDA: 76205197950.16.horse75_1c74f0756d862 X-HE-Tag: horse75_1c74f0756d862 X-Filterd-Recvd-Size: 4185 Received: from mail-wr1-f68.google.com (mail-wr1-f68.google.com [209.85.221.68]) by imf33.hostedemail.com (Postfix) with ESMTP for ; Thu, 28 Nov 2019 09:43:15 +0000 (UTC) Received: by mail-wr1-f68.google.com with SMTP id i12so30326505wro.5 for ; Thu, 28 Nov 2019 01:43:15 -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=UgTnLC+3ETJ4P4Qbb/UkyHfmjqLaw4B3tOIrLW9bCaw=; b=I00swfkn1hhk6GRpuPUJcYsyn60pCqr6/tvs2pe1giSGAs3fxWzRuFBQQtdIoWnSKl V1ftSz/75TSQOt0ZKwRdEpx8ShuHIcMGi8TCYBugopNz1tOZePF7ZpQKFF3hOScbYd8l 9FrS+BX/80qtPPmJ7bl5bSalgPB0zEhUmmQDWUjUzKJIZzWqXa5lGPP1h4kzMg+jF42u g6ftUcj3nuqgYiqXjgcJRvL32H9F9J/WRc6UMSD6N6SAG09xQkZt6la7SkZE4KLbLcbl CJC5JHvycoOECdzTi2OZscpLw6RY88QTIk1eLzB3cpQCF/eYsSUTJTZrRuD7HDUxA5Fl UtoQ== X-Gm-Message-State: APjAAAUzqRE/UHqOEl2alf0FgrmZmOVy/Vk7GLf+Krrl+7lVAj8RMBTe IkaiaxJi0UE2CklvSYtoZ/g= X-Google-Smtp-Source: APXvYqwdZRlp/S4BaX1ZlxE2h9655+sgC0OLlqItykCfBmpFF+5UX/uwTKwitYPuGZ1XCtbmnwpBHA== X-Received: by 2002:a05:6000:12c9:: with SMTP id l9mr12196977wrx.304.1574934194317; Thu, 28 Nov 2019 01:43:14 -0800 (PST) Received: from localhost (prg-ext-pat.suse.com. [213.151.95.130]) by smtp.gmail.com with ESMTPSA id l4sm9453508wml.33.2019.11.28.01.43.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Nov 2019 01:43:13 -0800 (PST) Date: Thu, 28 Nov 2019 10:43:12 +0100 From: Michal Hocko To: Roman Gushchin Cc: "linux-mm@kvack.org" , Andrew Morton , Johannes Weiner , "linux-kernel@vger.kernel.org" , Kernel Team , Christian Borntraeger , "stable@vger.kernel.org" Subject: Re: [PATCH] mm: memcg/slab: wait for !root kmem_cache refcnt killing on root kmem_cache destruction Message-ID: <20191128094312.GF26807@dhcp22.suse.cz> References: <20191125185453.278468-1-guro@fb.com> <20191126092918.GB20912@dhcp22.suse.cz> <20191126184135.GA66034@localhost.localdomain> <20191127123225.GR20912@dhcp22.suse.cz> <20191127172724.GA67742@localhost.localdomain> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191127172724.GA67742@localhost.localdomain> 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 Wed 27-11-19 17:27:29, Roman Gushchin wrote: > On Wed, Nov 27, 2019 at 01:32:25PM +0100, Michal Hocko wrote: > > On Tue 26-11-19 18:41:41, Roman Gushchin wrote: > > > On Tue, Nov 26, 2019 at 10:29:18AM +0100, Michal Hocko wrote: > > > > On Mon 25-11-19 10:54:53, Roman Gushchin wrote: > > [...] > > > > > So in a rare case when not all children kmem_caches are destroyed > > > > > at the moment when the root kmem_cache is about to be gone, we need > > > > > to wait another rcu grace period before destroying the root > > > > > kmem_cache. > > > > > > > > Could you explain how rare this really is please? > > > > > > It seems that we don't destroy root kmem_caches with enabled memcg > > > accounting that often, but maybe I'm biased here. > > > > So this happens each time a root kmem_cache is destroyed? Which would > > imply that only dynamically created ones? > > Yes, only dynamically created and only in those cases when destruction > of the root cache happens immediately after the deactivation of the > non-root cache. > Tbh I can't imagine any other case except rmmod after > removing the cgroup. Thanks for the confirmation! Could you please make this explicit in the changelog please? Maybe it is obvious to you but it took me quite some time to grasp what the hell is going on here. Both memcg and kmem_cache destruction are quite complex and convoluted. Thanks a lot. -- Michal Hocko SUSE Labs