Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp546489pxb; Sat, 10 Apr 2021 10:49:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyYOf09Mve2iRg/BNvI2NiixhoiNx25ZyI4Wu17crS3uZyAoZOzjZaL5Kh5r3hh8r9eAvBm X-Received: by 2002:a17:90a:eb04:: with SMTP id j4mr8027763pjz.156.1618076986532; Sat, 10 Apr 2021 10:49:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618076986; cv=none; d=google.com; s=arc-20160816; b=S1mncn6OI7UxHEvEi7W/KhMKVagss5qUcc9PuwTjOZaFCO88PEcMUaI5FN61Y9uDKe vVEqzCG6QZLbRm02StYAvsonMtuGuNjrFiObWhkHeEtQvOBnwjSxup9g7P0KMAItDwhE mzoIPoxs8eZOL0RdYafukHnPhERjwYQe9/4JqJAv/bymDQG4J4rJql0bOSIOccChGZzk LFTSvPxMgRK2QWNjI44VDbaDuGUcSiqhe02JjqQbc/M45Xml/j1Jf6CqBFiLjT8h3Nte LOhMyatYZlGRhejjYW3kHuR62YgcCKlqN3YoyRJJS9lOwOenNlYsAyGwXjdSj3+pqjFK 3Z5Q== 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=YgtCeA1Y4wCp3r4IZqk+RljjksiftqBoFrg1EOiiX98=; b=r+DjZfSxngrjU1VsmKFxdAE42nBvzRKFJRIFsyyJMnZKvO6mEQfinOacDYBsydRWKo UwHm0OweySu0xrQdV75o32ckdVzmEh3AIHYYmWWVEcSM59n33uzyVid7ZRpAuswBjhrn tfJQvh7ORCAyNb2JSH8ifB80iv90cdxclEHH/71GpvyfA54vN12ZOZUz/oReI5C4VAIE +9qXpEMqX/Zl2pQQEgwqnz7Awhx5bFbLF7K8NLa+APuvS3Zl5amlIBjQEPyxkq/3bQ2i nzXcst94cVbLtaeHNoKBqPM0PpO1mDxu5mHyt5wG5i5FVhpuC6MrUAd8VWEbFe0RnepV DXcg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=LpEUse8M; 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 u10si1639284pgg.279.2021.04.10.10.49.34; Sat, 10 Apr 2021 10:49:46 -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=LpEUse8M; 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 S234911AbhDJRri (ORCPT + 99 others); Sat, 10 Apr 2021 13:47:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42536 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234392AbhDJRri (ORCPT ); Sat, 10 Apr 2021 13:47:38 -0400 Received: from mail-lf1-x136.google.com (mail-lf1-x136.google.com [IPv6:2a00:1450:4864:20::136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 173FEC06138A for ; Sat, 10 Apr 2021 10:47:23 -0700 (PDT) Received: by mail-lf1-x136.google.com with SMTP id r8so14636637lfp.10 for ; Sat, 10 Apr 2021 10:47:23 -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=YgtCeA1Y4wCp3r4IZqk+RljjksiftqBoFrg1EOiiX98=; b=LpEUse8MvSsBjR/LUs2dYtDHrydq5lyD4O4gsodi1yEPM1SHXLqHM0JxMtitWaQN9H EjVClxjmcjV/R3akgoMCcpKdQjKgXDny3p99W67WidjZKzmra53wR4VT60QnK8HQT7Hy KObIDGfQuKYiK1rQUpzwWidXgMky7nMhfZX9nHu6GsS+z9cbbFKMC668EiZU2TKXuBnW RfcXHqLce4uv0mbDhLIJT8IYwd775JtTIMO6SeuVcDDtLfC89Dm67GRetRPt4ju4w0EF SjMbS/9O6WMx3RjMRPCEDRyXXXviVegPcT2E+QzPNL4qy1wqzPD2ylChZxW2hPoRbF+p akVg== 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=YgtCeA1Y4wCp3r4IZqk+RljjksiftqBoFrg1EOiiX98=; b=phySlrFJPrQ5458OPpRNI4foACBUOlNFIvES73hUyGWKADqutjzXQBPGVrz655twwu Oqk+5QDxiOrSDNKWDOBn83CipjIV1/mvZ+ae9wdElnkhtunFIWX+EOIYY3bDdma7JMvW xqR+hGM+FswFIOTkr97muTYFSKkLqNFQT3wdLm8mbwnu/i3cGsKpE6n9K865g17aCixR yNXR1PMGsKNt9CqRRC5ut6PRI0dx+mjKC9IVRDld0FCOr9/c9ky/2XTjynCH8w3oHYi8 QyR9QUTBhulh6G3C8JNv4v1phXyve/Ig+D4KAKJrmfIoKPWoBt0jtmMrIEZY6rv/nG8T QwWQ== X-Gm-Message-State: AOAM532Dw7lSZ966J05LD2H6LrxKXie9WLA+A2p2vODXyjsrheNRoRqI 0OTwAzGes7H+QpesMhE7s2gmkmfrHclbI0VbTn1l5Q== X-Received: by 2002:a05:6512:2019:: with SMTP id a25mr4230772lfb.347.1618076841358; Sat, 10 Apr 2021 10:47:21 -0700 (PDT) MIME-Version: 1.0 References: <20210409122959.82264-1-songmuchun@bytedance.com> <20210409122959.82264-3-songmuchun@bytedance.com> In-Reply-To: <20210409122959.82264-3-songmuchun@bytedance.com> From: Shakeel Butt Date: Sat, 10 Apr 2021 10:47:08 -0700 Message-ID: Subject: Re: [RFC PATCH v2 02/18] mm: memcontrol: bail out early when !mm in get_mem_cgroup_from_mm To: Muchun Song Cc: Roman Gushchin , Johannes Weiner , Michal Hocko , Andrew Morton , Vladimir Davydov , LKML , Linux MM , Xiongchun duan , fam.zheng@bytedance.com, Balbir Singh , Yang Shi , Alex Shi , Dan Schatzberg Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Apr 9, 2021 at 5:32 AM Muchun Song wrote: > > When mm is NULL, we do not need to hold rcu lock and call css_tryget for > the root memcg. And we also do not need to check !mm in every loop of > while. So bail out early when !mm. > > Signed-off-by: Muchun Song > Acked-by: Johannes Weiner Reviewed-by: Shakeel Butt