Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp900656pxb; Tue, 1 Feb 2022 12:46:28 -0800 (PST) X-Google-Smtp-Source: ABdhPJyeNX9qM6k1KZCEGCgIr7LCiDctSIHZ/E8cafTBx3Mc5FW7WZclBq5uQsPRfZvY3z7/Bfzu X-Received: by 2002:a17:90b:1e42:: with SMTP id pi2mr4404179pjb.176.1643748388570; Tue, 01 Feb 2022 12:46:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643748388; cv=none; d=google.com; s=arc-20160816; b=apk37NtuNqSdW+BOGM3fmPfDmWy4+qThSe19NbhHHLrCQM/xQdZ6u4Q0UpIox/MVPy rxLhqKMD+z6044rTdyMtEcyacYYX31J/SQg0C6yryHHobNWBBb2+nQ1qafSLXYHwbkEJ uKl5IltiLAWOg79fWzv/lxk/AxQwmvGw7vkhzOcOZh4GUAcVaWLHN7wcEX1jKu/Geurp weK68HgJlqP/DsE4BpwsXYj9r1H5YbntZ3JuuXUxVzxNgz/UWp0+9hVPrxi+MozOFTfX D3inBC64RPaHl+esxJUcKcxFuEOEUqSFysgmmL5McnkHqB2+49KTRDfY3jQ+QARN7FYs 09pg== 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=ZDAib+Bb/dH824cDSeLWITIJZuwoFHO7+dlyhfyg7SU=; b=eo7y5oc0WXKFvGcMs88Ru3E8ajwSFgzh30uYtTA3H/cLCSEmArRLzYJFhqLvsDv4io euEosmjrWnFDRc+lhdpboK9/IhjDjwEds635Y0Hsl15CrCThIXJlbIRBWnuYMDnbaEan LGMMTmL0uvu9tcpG8zszdjVeC9YNF4mekoLHC1XNEVhdm79Qx6ksKJBuiVN2cY2qjBe8 Le0bPaQwKUsZCguxuCcOvGx9BOWh4KAjaFbVcidxjHoCvlQxFMYAlO7dTzIzpuJrFxcL lxovML5vG2EOJxZg5kjn3frEf8GeJsvIMeFzXafF8y1gxPxKxmeQhLYIFkDGT/IKi17b Pw9Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=bnGr1AtW; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q17si20628583plx.119.2022.02.01.12.46.16; Tue, 01 Feb 2022 12:46:28 -0800 (PST) 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=@google.com header.s=20210112 header.b=bnGr1AtW; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234173AbiAaSAj (ORCPT + 99 others); Mon, 31 Jan 2022 13:00:39 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57712 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230425AbiAaSAi (ORCPT ); Mon, 31 Jan 2022 13:00:38 -0500 Received: from mail-lf1-x12b.google.com (mail-lf1-x12b.google.com [IPv6:2a00:1450:4864:20::12b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8516BC061714 for ; Mon, 31 Jan 2022 10:00:37 -0800 (PST) Received: by mail-lf1-x12b.google.com with SMTP id p27so28573542lfa.1 for ; Mon, 31 Jan 2022 10:00:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=ZDAib+Bb/dH824cDSeLWITIJZuwoFHO7+dlyhfyg7SU=; b=bnGr1AtWDiuxZ4vCWPPtTrf0rCqdtKwtwCLDhRqdlmk/VByNX7ZDiYGlLu9UpojJuk cmrsI6WYoRXCN5xMdZW/vwApSpcBGKGj/vyMWBkkg8/4ABU8qzFO8Z8Ytq+nyV8L5rAx bPz29zv8jlQQT4kwtfAsG28PDsrgq0akpP0/bJ47B8d+kCcbZMc6nvW/gDsEiDHlBPgR SpXeezyCMttodSaARcOLP4wnQZLtSA0c5gtAiq+gH1S+CkUz36zRT2ZhKOvy5O1UMhsg eyVEFe4mMhm1ogImTdcQh+c2UYLHF0DdNC/kApoDZHqKhHscWYijtUUJ2JjSYLbGGpMK p37Q== 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=ZDAib+Bb/dH824cDSeLWITIJZuwoFHO7+dlyhfyg7SU=; b=WYSbeoEZS5rZ0IouuAb8cvyZitTSJOI6WKsdJhMHmN9uvW5viLTnBC1eRgFc7IFd2q 3BryrJG30HIpmr5XA8f8+xbwZixqK7LE5xhzD5yYPczR9A/3jcaIRZ/AEaO6dWzYpDdn TgKRM4DwiM/c9b/bPIbP2zBFrAPMzlD9YqoVPFWemDuvoDajVVePB2eRLSWpJPCvhnxE UQbIr6g1czwldKadqrx5RYr8w/V7wShUsHGtyxcGlDek6dnFBt649+RpsN2l/fXl9M9Z ePDVAcK8euAULQ/XbaePE35lvDRbYbgdu+aYYeM3bb+nrgCZionlI9xHDcqayLRLCQOJ FBdQ== X-Gm-Message-State: AOAM532P5s8C6WKo0+1BEKtSonwuTLBmsH0tDRochKu/L18tFEe7fZfp QDpdn1VN3P+FjX2D0WJZij741Ise7UYOSGQJuYbgfQ== X-Received: by 2002:a05:6512:3e10:: with SMTP id i16mr1911241lfv.184.1643652035654; Mon, 31 Jan 2022 10:00:35 -0800 (PST) MIME-Version: 1.0 References: <20211001190938.14050-1-longman@redhat.com> <20211001190938.14050-2-longman@redhat.com> <95ba1931-e9c9-45c3-b080-d28f2ad368a7@redhat.com> <9abc9cb8-8734-90b0-c495-8df89c7bb579@redhat.com> In-Reply-To: <9abc9cb8-8734-90b0-c495-8df89c7bb579@redhat.com> From: Shakeel Butt Date: Mon, 31 Jan 2022 10:00:24 -0800 Message-ID: Subject: Re: [PATCH 1/3] mm, memcg: Don't put offlined memcg into local stock To: Waiman Long Cc: Roman Gushchin , Johannes Weiner , Michal Hocko , Vladimir Davydov , Andrew Morton , Vlastimil Babka , LKML , Cgroups , Linux MM , Muchun Song Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jan 31, 2022 at 9:25 AM Waiman Long wrote: > > On 1/31/22 12:19, Roman Gushchin wrote: > > On Mon, Jan 31, 2022 at 12:15:19PM -0500, Waiman Long wrote: > >> On 1/31/22 12:09, Waiman Long wrote: > >>> On 1/31/22 12:01, Roman Gushchin wrote: > >>>> On Sun, Jan 30, 2022 at 10:55:56PM -0500, Waiman Long wrote: > >>>>> On 10/1/21 19:51, Roman Gushchin wrote: > >>>>>> On Fri, Oct 01, 2021 at 03:09:36PM -0400, Waiman Long wrote: > >>>>>>> When freeing a page associated with an offlined memcg, refill_stock() > >>>>>>> will put it into local stock delaying its demise until another memcg > >>>>>>> comes in to take its place in the stock. To avoid that, we now check > >>>>>>> for offlined memcg and go directly in this case to the slowpath for > >>>>>>> the uncharge via the repurposed cancel_charge() function. > >>>>>> Hi Waiman! > >>>>>> > >>>>>> I'm afraid it can make a cleanup of a dying cgroup slower: for every > >>>>>> released page we'll potentially traverse the whole cgroup tree and > >>>>>> decrease atomic page counters. > >>>>>> > >>>>>> I'm not sure I understand the benefits we get from this change which > >>>>>> do justify the slowdown on the cleanup path. > >>>>>> > >>>>>> Thanks! > >>>>> I was notified of a lockdep splat that this patch may help to prevent. > >>>> Would you mind to test this patch: > >>>> https://www.spinics.net/lists/cgroups/msg31244.html ? > >>>> > >>>> It should address this dependency. > >>> Thanks for the pointer. I believe that your patch should be able to > >>> address this circular locking dependency. > >>> > >>> Feel free to add my > >>> > >>> Reviewed-by: Waiman Long > >> BTW, have you posted it to lkml? If not, would you mind doing so? > > Not yet. > > > > I was waiting for Alexander to confirm that it resolves the originally reported > > issue. I just pinged him, will wait for tomorrow and post the patch in any case. > > > > Thanks! > > I see. This is not a problem that is easily reproducible. You need to > hit the right timing for the lockdep splat to appear. I agree here. The patch on its own has merits as it is reducing dependency on an unrelated lock.