Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp1349962pxf; Fri, 2 Apr 2021 08:09:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwEPPefZgJ20RaZQyFTevcuX7K7kU1RVL9TbC5hF9x/iil0cB2VLT1+aSBrjcl4TfNLJah4 X-Received: by 2002:a17:906:4dce:: with SMTP id f14mr14222299ejw.349.1617376177301; Fri, 02 Apr 2021 08:09:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617376177; cv=none; d=google.com; s=arc-20160816; b=0lW+AaiU3OhHPeppEhG4s+M54hyR1HAYcvpGQx/LwPq21yLRdFbbxoCYeDCDbgEu1p +WYN1DyXCqvQJm61QXNsKOWLn2IuWkniB4uYQznS1BBZWu4jqYH6Dea5KhpMQIeWsMVJ 8G78E5YYnXWbyPaDNYoOPpJiGHIDRl2EYvKaQ4u/ikqSaR/ZdS3oJt4yIb7o+SzIYRiw QJJL4S4+EkNSDBHjTvUoJ5kE2LVibb2Ld0Lo7AmnQaqSd0KiXXuUGcVTQvUDjJE5NPId dfZrrRuvsSMHicW20KFXlCU449Y91k7OSTVR9F+tiHH2wHncoJMMcdp5gacF6g5hqNh2 bvrg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=wQrnvPmgQ6qoU6cE/YM7bFQYQMf4u2P6Aw0WF5mGCKQ=; b=Ty5eK7DE8sUzy72slVCdzfT2tO03QhMui8VIhFGRdDqjRND27za6i09gtR8eA7OanL arpO4ebAheKod+bXnamKSUSTjLYoj/FJ14Jf9rxrmn5nDlzGIEH6ff96IE2ooXilBR/m KNkHXF/iOnnB8qBa95vzDKL1QOtb6j+SD6ErCARkOch+pl7UgL/7TLbPWKWFPe+w6HwO pV13pu0UMmvV4gcdTqNzYkr4TRu5LvnT5X6vnYUYlaOKtixm5eudABH3DkVTOkgHCy2L aPNrWASORXty+YYxG8uVO9mcuiil+hh/rf0Im7lZdYbY9M0DIzQB29Y1iMEo972H8GGc qsEA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cmpxchg-org.20150623.gappssmtp.com header.s=20150623 header.b=soEf7o4u; 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=fail (p=NONE sp=NONE dis=NONE) header.from=cmpxchg.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id fb9si6017013ejc.138.2021.04.02.08.09.13; Fri, 02 Apr 2021 08:09:37 -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=@cmpxchg-org.20150623.gappssmtp.com header.s=20150623 header.b=soEf7o4u; 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=fail (p=NONE sp=NONE dis=NONE) header.from=cmpxchg.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235139AbhDBPIn (ORCPT + 99 others); Fri, 2 Apr 2021 11:08:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54482 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229553AbhDBPIm (ORCPT ); Fri, 2 Apr 2021 11:08:42 -0400 Received: from mail-qv1-xf32.google.com (mail-qv1-xf32.google.com [IPv6:2607:f8b0:4864:20::f32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 164CAC0613E6 for ; Fri, 2 Apr 2021 08:08:41 -0700 (PDT) Received: by mail-qv1-xf32.google.com with SMTP id by2so2593596qvb.11 for ; Fri, 02 Apr 2021 08:08:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cmpxchg-org.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=wQrnvPmgQ6qoU6cE/YM7bFQYQMf4u2P6Aw0WF5mGCKQ=; b=soEf7o4uAGlR8/3IIWjii9z5BYCoxP8IMb+pEB5sAxBW1TtPlXWO1ZNG0c2iYhaLJc zjYcTheQxWUm1rBlZ5sW6aoGr5KKX0DMFhR1zyIrgiZ1cvXlOrEsXPK4N5GHcMHqp2ko E+kp4giH0V9+y1zHWlTaUz+xMoGf3VWxvKR4Pog75+WW27irDqxMGl77XrTswEj7qhd6 esa5NAvFzti7TUtLsN1fQZ/PtPgyWb3FaYwZp1McYHIjLpGAVz7jJXD/VxgVulu+4zXT nJRU5Vg3bERufdWPlrA2ioFeIWmc+sZVgiwQMAn5ahKobritjRvdg2bJcrNn2KazmZxr 91Bg== 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; bh=wQrnvPmgQ6qoU6cE/YM7bFQYQMf4u2P6Aw0WF5mGCKQ=; b=Eb6u+XloguGbEG+zz0uu9jH/WOjuwnTx7yP3CDEO8x9yWKXccZZPeHbcDuqBfBtsSQ gE+k7Xj3yM0TTE7F2v903F/o4W03fsWX3dhoDQFP7sCQSjl4jFBwe5bMmXw1AdGwcKAI pUyuX6NiLRZwcu0k52QVpjQNfrNGz+WQsuqGK66tfV7SQpLT/hFcXHWdSJZGJaoIdgQm V9RfS8x9P+pmvt60YbRCK/1fpYo7HUq7lEgET52ffPytN1XErqoAsGt3Xw1VTVFMiW0G qV0zYsJssCJwpKxEty+OAewh+bpHD/2pSZw6APzLW5iCt8CyMUOd3SFHdF0AaCuytBBP idmQ== X-Gm-Message-State: AOAM531LYkPLn7xhFDeYTCawPhOwsjUE2fmaxHXql1lCKxcoAd6/rspV 66caQyta0m8LonqDu3YFKMODWw== X-Received: by 2002:ad4:410d:: with SMTP id i13mr13015900qvp.44.1617376120417; Fri, 02 Apr 2021 08:08:40 -0700 (PDT) Received: from localhost ([2620:10d:c091:480::1:8ca7]) by smtp.gmail.com with ESMTPSA id 75sm7322604qkd.114.2021.04.02.08.08.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Apr 2021 08:08:39 -0700 (PDT) Date: Fri, 2 Apr 2021 11:08:38 -0400 From: Johannes Weiner To: Muchun Song Cc: guro@fb.com, mhocko@kernel.org, akpm@linux-foundation.org, shakeelb@google.com, vdavydov.dev@gmail.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org, duanxiongchun@bytedance.com Subject: Re: [RFC PATCH 02/15] mm: memcontrol: bail out early when !mm in get_mem_cgroup_from_mm Message-ID: References: <20210330101531.82752-1-songmuchun@bytedance.com> <20210330101531.82752-3-songmuchun@bytedance.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210330101531.82752-3-songmuchun@bytedance.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Mar 30, 2021 at 06:15:18PM +0800, 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 Good observation. Acked-by: Johannes Weiner