Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp4805632pxb; Mon, 15 Feb 2021 01:29:28 -0800 (PST) X-Google-Smtp-Source: ABdhPJzAvSx8NkeqzLnNICA4dmtZM3rM3r8SLjoubwNwUFZSpu9yIVzJu6GNjmnyh+x4GIlpq0NG X-Received: by 2002:aa7:c408:: with SMTP id j8mr3336475edq.337.1613381368783; Mon, 15 Feb 2021 01:29:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613381368; cv=none; d=google.com; s=arc-20160816; b=IGV1Smkx659QI5CFDBZEENx2YXByFB5zBNs2tT0VsF9mtmx4KLCYa760WUTiDPTpOU 7BJmd8srXbRaeWULrr6tZu7YKZTBUuk7NgJR3iMKqHPFNR9isU6ObvOxq6s4TPbqpkva oy0513YU1Fsy4HjqdWDjgmNfYCLjQO+0Ci7f6/ek2fTzinAiGl4mygWtPt1VQzwyVnGE /ohc6w0NXMdoqju93TLYRC/tfD8v1hS2j3/kK8/1QMD1fzq/ZEQb3L1KCKfp01OMUeT/ NOHsf7Kdqh4I36AECeNRyZsT82v3qLLdM6gcOkXYaOzc1W5rv4rmhvqHqpXlC7xP0dFE FZcg== 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=xB5MBNbB1QLYYTbvCj1weox/L1QyvBLNycXdZJ/J33s=; b=Yh4/yFObB1SbjUbQ2H5lQudsiKepGcanxklexcvCd6+Zd5wGLPYC9cwAKg+f7rIVu8 RpSCED4SHKY16CmQHsK9Ao1hNbkGo6d1gkU5RaIqF5GptZ4yAuxGmXaKE1Tvlw4AqTUO 7CDMksoJoTCs5rIyfOdbgzZsI9YpFaXN3m78W/oUTtb2gxKvpCaZCvNSrCn/9FgCX6a4 9BmdTqFim5qa8TLnEXHDmyK2NVhyDu6kEuMKn5bdlgUteCS0u4UEWpFbxZpKOtBBgDDF f16hstsOyt0tvYJnr5VmT/51FBapUYqy8/4Rv3ep4jX35th009vMtN0rSRuEeXPy7R0l 64PQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=msIiFaMG; 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=QUARANTINE sp=NONE dis=NONE) header.from=suse.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p31si5068249edb.298.2021.02.15.01.29.05; Mon, 15 Feb 2021 01:29: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=@suse.com header.s=susede1 header.b=msIiFaMG; 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=QUARANTINE sp=NONE dis=NONE) header.from=suse.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230131AbhBOJZn (ORCPT + 99 others); Mon, 15 Feb 2021 04:25:43 -0500 Received: from mx2.suse.de ([195.135.220.15]:50880 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230046AbhBOJZf (ORCPT ); Mon, 15 Feb 2021 04:25:35 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1613381086; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=xB5MBNbB1QLYYTbvCj1weox/L1QyvBLNycXdZJ/J33s=; b=msIiFaMGkdJ4pDCv0zyVzZbaNCFRTvzOfXRSNRzqy3NRtv9ZBePOOmmS5Aicny13IwoBJR cOnnBmTXrlauKa0ifYK8IfQd8C24XTIjw4Y7qX0E0tuRGrIu60sL/0UThYl+CsPbdYZWsm sfYS0TqbdIhAmdfPROvuM5Tk0ePE4OU= Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id B5BA5AD19; Mon, 15 Feb 2021 09:24:46 +0000 (UTC) Date: Mon, 15 Feb 2021 10:24:45 +0100 From: Michal Hocko To: Muchun Song Cc: hannes@cmpxchg.org, vdavydov.dev@gmail.com, akpm@linux-foundation.org, cgroups@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/4] mm: memcontrol: remove memcg check from memcg_oom_recover Message-ID: References: <20210212170159.32153-1-songmuchun@bytedance.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210212170159.32153-1-songmuchun@bytedance.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat 13-02-21 01:01:56, Muchun Song wrote: > The memcg_oom_recover() almost never do anything but the test (because > oom_disabled is a rarely used) is just waste of cycles in some hot > paths (e.g. kmem uncharge). And it is very small, so it is better to > make it inline. Also, the parameter of memcg cannot be NULL, so removing > the check can reduce useless check. You probably wanted to make this patch follow the second one in the series. As there is no oom recover form the kmem uncharge path now. Also I believe that I've asked you to split the memcg check to its separate patch. Regarding the inlining, I would add it along with a static key check in memcg_oom_recover. > Signed-off-by: Muchun Song > --- > mm/memcontrol.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/mm/memcontrol.c b/mm/memcontrol.c > index 8c035846c7a4..7afca9677693 100644 > --- a/mm/memcontrol.c > +++ b/mm/memcontrol.c > @@ -1925,7 +1925,7 @@ static int memcg_oom_wake_function(wait_queue_entry_t *wait, > return autoremove_wake_function(wait, mode, sync, arg); > } > > -static void memcg_oom_recover(struct mem_cgroup *memcg) > +static inline void memcg_oom_recover(struct mem_cgroup *memcg) > { > /* > * For the following lockless ->under_oom test, the only required > @@ -1935,7 +1935,7 @@ static void memcg_oom_recover(struct mem_cgroup *memcg) > * achieved by invoking mem_cgroup_mark_under_oom() before > * triggering notification. > */ > - if (memcg && memcg->under_oom) > + if (memcg->under_oom) > __wake_up(&memcg_oom_waitq, TASK_NORMAL, 0, memcg); > } > > -- > 2.11.0 -- Michal Hocko SUSE Labs