Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp2913438pxb; Tue, 13 Apr 2021 13:28:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzy54Ndt7itE+Nq6AYkOSh9kbTrcWyKiCw27SqmXQTfX40mhjuJBhw1ApPGPXCmev4NUyUc X-Received: by 2002:a17:903:310d:b029:eb:1fd1:1b6d with SMTP id w13-20020a170903310db02900eb1fd11b6dmr7184939plc.46.1618345738428; Tue, 13 Apr 2021 13:28:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618345738; cv=none; d=google.com; s=arc-20160816; b=HSnqCT4XWe5H6zbcGD8SxxECV+C07TGhFlhNh46ViA4rnrn1FjDYtAagTqqzaSI52M gqQUnMVLE6hC/JBuc//DtDUgeIufgajxJ9NN7t3esycJtUzsQ1lha5pYgoOx9Xp6Py57 MtK8QUKaXPTXzERMv0LZW9YPN94/34jmAAOcdqmVJrApcc9W77EIrUOHzR52D/8+LXkf stB7qmvuinBPsw5UM5OzpRifYGosjhswvCZovM+vzEKhkzbdBp/5ygBZkT/7WAQBewFe WsHLsc1k+MCdymgomgIP1s/7i/F4XY6+GW15CrmvXdjwpFazhzdBF22C9FgPXOCXaMe5 kf8Q== 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=cZ6kidUHRj7ZJtI2NPkmgGxB5X5ZhGWZ4M1kxQQ4MYE=; b=bdwR7oNfHLPjWW8DcGX7o/jrbLNvqBjcNngxGjOmRegSSM98Tahkiv1Ip24xkSoy+8 aocR5tQhzv7KSKP07Ck+WKbZRWLegbryRU1/RSayv0sgM8snKRs1RwIScv53fBuEEjMF B3rHvyoRlclNW8GrlSN+EUe0aU6UqDgXtlDOUEeQwz7MEsr69Xs2PzRyQAvnnH5u/Edk zIdf0heE3PRYNuEptI6+ZA38pzK/iGSGexaoWGLmjxI2BPLM8KBNsXSnz6skqFP4msTU XkrOy4JereMhBZJZ9jxieJ6HvOD51yO/IJUDOJqbuKgqPdPZtdlrj8IBSzRaU8f3hkGu DA0g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=BbdoH85a; 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 k15si19164149pll.39.2021.04.13.13.28.42; Tue, 13 Apr 2021 13:28:58 -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=@google.com header.s=20161025 header.b=BbdoH85a; 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 S230493AbhDMORf (ORCPT + 99 others); Tue, 13 Apr 2021 10:17:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56774 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229590AbhDMORe (ORCPT ); Tue, 13 Apr 2021 10:17:34 -0400 Received: from mail-lf1-x12e.google.com (mail-lf1-x12e.google.com [IPv6:2a00:1450:4864:20::12e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 451A0C061756 for ; Tue, 13 Apr 2021 07:17:14 -0700 (PDT) Received: by mail-lf1-x12e.google.com with SMTP id r8so27501995lfp.10 for ; Tue, 13 Apr 2021 07:17:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=cZ6kidUHRj7ZJtI2NPkmgGxB5X5ZhGWZ4M1kxQQ4MYE=; b=BbdoH85aPSywvPs8poem3KXLPuVQZ0Kud5h/cKfVLSvTpb3s3WRCjKaOnzd7UiQ0yq 4lA/nQdnm3zKkexJFCHsP8B/J5xwoqKyvfvcAaqxC9Ghrwk7DfHu5Cwy+dDZsN7on+ww UZYSmg69HMoOxDD2sujKtzM1tl72CX+LfmA482OIMXPEx9ZfaDCNcfmDQHGXu4seq4Z9 5MJLRToL1Bxvp7riJ4qerWQwAFlDWg0LwOppAtmUM/JdKapyoDW1zmI18gbeHiBYZVq9 iIvfcN8Ura4CX2Y4SgtdZV0b2q9ADUWn5FUULh2bUhR+aZD1vQbsw7TH3+2WZyKXbUKc 4fcA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=cZ6kidUHRj7ZJtI2NPkmgGxB5X5ZhGWZ4M1kxQQ4MYE=; b=rzyvlLL/KefBaSjsfyn4Db+uhbm315sgZaoTl5f2K9IuGTKkxYxYHt6eRAs35ojVbE izl2kgaGXCn3kpVtLF24KRlkDCDnJ6uazDtJa+ttWo8+B49cGIzoBpRmxOnzbxs7sUyM YaNW+XEsnRozFSl9taaAqmbhSt4LR2CkMPxycYT1AIkqJnIKYJX6yz/8s/SG0nTvvcet ywMYBx+XNUBE3d0EO16A1iloXJDI70XZ5iF7LA2KRDV8LRgPxwU7Y6Get1FivZyoa8Dq 4kZBtLVPV27UhpCYS/1Xqt4ILOXrF2B34lyYs7Bn4F52ZwVFYSGjZ+/ExAN5xubIbzwg dkXg== X-Gm-Message-State: AOAM533ABMjSHgxTXnBAk/e0kOiwkrXCimONWpcYFynO8byBH/MyVFe0 KfUs8yALVy3WKUgQDREQo+4jeBYiqvALZoaU0Pgh3Q== X-Received: by 2002:a05:6512:3703:: with SMTP id z3mr22508451lfr.358.1618323431274; Tue, 13 Apr 2021 07:17:11 -0700 (PDT) MIME-Version: 1.0 References: <20210413065153.63431-1-songmuchun@bytedance.com> <20210413065153.63431-6-songmuchun@bytedance.com> In-Reply-To: <20210413065153.63431-6-songmuchun@bytedance.com> From: Shakeel Butt Date: Tue, 13 Apr 2021 07:16:58 -0700 Message-ID: Subject: Re: [PATCH 5/7] mm: memcontrol: simplify the logic of objcg pinning memcg To: Muchun Song Cc: Roman Gushchin , Johannes Weiner , Michal Hocko , Andrew Morton , Vladimir Davydov , LKML , Linux MM , Xiongchun duan , fam.zheng@bytedance.com Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Apr 12, 2021 at 11:58 PM Muchun Song wrote: > > The obj_cgroup_release() and memcg_reparent_objcgs() are serialized by > the css_set_lock. We do not need to care about objcg->memcg being > released in the process of obj_cgroup_release(). So there is no need > to pin memcg before releasing objcg. Remove those pinning logic to > simplfy the code. > > There are only two places that modifies the objcg->memcg. One is the > initialization to objcg->memcg in the memcg_online_kmem(), another > is objcgs reparenting in the memcg_reparent_objcgs(). It is also > impossible for the two to run in parallel. So xchg() is unnecessary > and it is enough to use WRITE_ONCE(). > > Signed-off-by: Muchun Song > Acked-by: Johannes Weiner Reviewed-by: Shakeel Butt