Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp2694279pxb; Mon, 31 Jan 2022 02:10:42 -0800 (PST) X-Google-Smtp-Source: ABdhPJxSdJ5mqkY9KxLh+mUBzzsREK2OQY2zpUMB+cbnolYPxGKCcbBvtpVgWHF0NRc7DwJ1ucV9 X-Received: by 2002:a05:6402:1ac5:: with SMTP id ba5mr20020065edb.337.1643623842562; Mon, 31 Jan 2022 02:10:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643623842; cv=none; d=google.com; s=arc-20160816; b=V2EQGdEm96vHFr7aCs1EZLDUdRkB63qBBDM4QJ6KQLT+kWN2XwAjN2lH3wz8Ty/9cH M3jnN3Omv9+ruo85Fl27h9mF+q0meloQEEnbZyM1TEDnlUhMbPAyeOl0C8S/e3uE1zmn LHG41vtFLw/QvO/Z115YjL6/Zvg1lhmGuajT/kIvEBhjJXBuAnwm1tKRE6CFy8WLLw34 VqFEJTJkXjlJfnRoD3qe08bjQuRz/Fp8M3Qo2u+YWIq4HdR3KtAeEoTcjBycmmJS7M17 MznQpXdNYNo7nYFVyuELgB7pjg1nSA9pJ5QJ40VL/zZ5rX3gY2XmoT2dvU9mdrRz9VWk O50w== 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=71M7m26qjEQDHZgi5jO+0z+MJXrkQnj7Uc4OCh8cPbY=; b=piaEqVCkdHj7Q/5p/qAGLwOvC3zvfCuVuM6cUDbtagh7o/Gd1MjLQ2lxzeCkkje3Rx BzaBlCuAcOYNtudU0ZArEWt1vALFOs5VkzOsy+oisY0Qa9/0qNH8XN3kVJLUiS5uw+uE cd8K0UO8/rpBAbdiWuz1fPJQr1NF7XvV6TNoy5x9jNqV18iG3wB0YgR1dhmvW+gJpLWk SVZIRaaNojYxX+lMjtZhfMdUOPj46lz+zExAGFOsfU/IYaMoQDZboOfQE6bQDPOo0nKT tEZ4ftXQnfUwMp94zkRtwz5yCALTPfPAJ4ctx9jfxmr5MpPUI5ZueC0jpAKjzWiJ7zuk Gyfw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=jKX1hcm5; 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 24si6997871eje.241.2022.01.31.02.10.03; Mon, 31 Jan 2022 02:10:42 -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=jKX1hcm5; 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 S234612AbiA1MXg (ORCPT + 99 others); Fri, 28 Jan 2022 07:23:36 -0500 Received: from smtp-out1.suse.de ([195.135.220.28]:33492 "EHLO smtp-out1.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229568AbiA1MXf (ORCPT ); Fri, 28 Jan 2022 07:23:35 -0500 Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id A06F6212B7; Fri, 28 Jan 2022 12:23:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1643372614; 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=71M7m26qjEQDHZgi5jO+0z+MJXrkQnj7Uc4OCh8cPbY=; b=jKX1hcm5THaAqw3fk9koUnFPbf1DYWasC685eJ5k5OmZpCbFLvlcaLCbf83tGypVN+PQPf 1lBWi/fxa9b4MBjz9Zsj4lJo8i1+Epa6tRyCCCBdoO4O13ti4AF2orK4JCDkQP7FOJAFX+ LOz7q195Ybp6GNUnke98QQCR3WBY0wU= Received: from suse.cz (unknown [10.100.201.86]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id 70006A3B83; Fri, 28 Jan 2022 12:23:34 +0000 (UTC) Date: Fri, 28 Jan 2022 13:23:33 +0100 From: Michal Hocko To: Shakeel Butt Cc: Vasily Averin , Johannes Weiner , Roman Gushchin , Andrew Morton , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] memcg: replace in_interrupt() with !in_task() Message-ID: References: <20220127162636.3461256-1-shakeelb@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220127162636.3461256-1-shakeelb@google.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu 27-01-22 08:26:36, Shakeel Butt wrote: > Replace the deprecated in_interrupt() with !in_task() because > in_interrupt() returns true for BH disabled even if the call happens in > the task context. in_task() is the right interface to differentiate > task context from NMI, hard IRQ and softirq contexts. Makes sense. I do not think this will have any visible effect. Except for removing a deprecated call, right? > Signed-off-by: Shakeel Butt Acked-by: Michal Hocko Thanks! > --- > mm/memcontrol.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/mm/memcontrol.c b/mm/memcontrol.c > index d067366002e6..215dfe325e9d 100644 > --- a/mm/memcontrol.c > +++ b/mm/memcontrol.c > @@ -2688,7 +2688,7 @@ static int try_charge_memcg(struct mem_cgroup *memcg, gfp_t gfp_mask, > READ_ONCE(memcg->swap.high); > > /* Don't bother a random interrupted task */ > - if (in_interrupt()) { > + if (!in_task()) { > if (mem_high) { > schedule_work(&memcg->high_work); > break; > @@ -6968,7 +6968,7 @@ void mem_cgroup_sk_alloc(struct sock *sk) > return; > > /* Do not associate the sock with unrelated interrupted task's memcg. */ > - if (in_interrupt()) > + if (!in_task()) > return; > > rcu_read_lock(); > -- > 2.35.0.rc0.227.g00780c9af4-goog -- Michal Hocko SUSE Labs