From patchwork Thu Jan 27 16:26:36 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shakeel Butt X-Patchwork-Id: 12727048 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id DFFB9C433EF for ; Thu, 27 Jan 2022 16:26:52 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6D1886B0083; Thu, 27 Jan 2022 11:26:52 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 67EE86B0087; Thu, 27 Jan 2022 11:26:52 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 546A96B0088; Thu, 27 Jan 2022 11:26:52 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0219.hostedemail.com [216.40.44.219]) by kanga.kvack.org (Postfix) with ESMTP id 419996B0083 for ; Thu, 27 Jan 2022 11:26:52 -0500 (EST) Received: from smtpin15.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 06BF59274A for ; Thu, 27 Jan 2022 16:26:52 +0000 (UTC) X-FDA: 79076595864.15.EC7831C Received: from mail-pl1-f201.google.com (mail-pl1-f201.google.com [209.85.214.201]) by imf06.hostedemail.com (Postfix) with ESMTP id 99FE7180009 for ; Thu, 27 Jan 2022 16:26:51 +0000 (UTC) Received: by mail-pl1-f201.google.com with SMTP id a9-20020a170902710900b0014c8132e8b8so1423257pll.10 for ; Thu, 27 Jan 2022 08:26:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:message-id:mime-version:subject:from:to:cc; bh=KUodK6JWWLQPTJW0rhbxzfsRrfCoLGdz3+B3g9F3RKc=; b=ll4Oa4ycdKHbS7VMAn+TqIdLrwfpkHqWzLIaXUTNgdnG7ik+KA/KF2oXNTJwlTXNBj U0CscAt0h9+Oaxt11SNbOTR7O9U25FDkC5mpzZRdQUOUgsZ2SR6y2l+/d5djldv23+1Z IlD7mhZbqpFfxb6+66HXcnxFIYMoNFuHMefKcqE2hT5bu4tniGUcxYiGi1VCEf6yz4av XMcQeoE2Px6Y9w6B0jSPglEyn4x/j9v11W2Z9FZwdFuiZVrB54M3Z1fHEubHvCMcK6vF 6mwlFe567ON++Y7CLEg3LXDqTryexif0pfofp9Aedo3CmL+MiuYQDeAmXimjMoSpk2gm XsMg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:message-id:mime-version:subject:from:to:cc; bh=KUodK6JWWLQPTJW0rhbxzfsRrfCoLGdz3+B3g9F3RKc=; b=hOwj1uXy6aHBqBXHRFKcKIDDFGSOXs8ml7DsSgBdIUhRafQtoSzofIEc5L1E1hCJPl N20nnaLslccnUrWs0xWFseVPW7smKe8cyv6KU4pa5/BFoZ3KBmY61Kl1jpR7U7BGIiNQ OWKi0KZiUkepuewRu1k9XTlqu4xCkzTBOnQ6DxMTnBX95B1pPSxMbjpCKmzLvfufXeFP qsri2BRGU2+3i/LXLHWeDuqvlQCFJr5xaiq5J3I4dSp/Un26yv8mpxYRdU8Kq6ZyPl0Z f1apAsQ58AgSH0wY2sruwEVNsUBx8OBzsW6+EPDoY2sY2arr+8N4yTwr/nImcIGHgMv1 9mQg== X-Gm-Message-State: AOAM530qAhgsS3ZksH7Iun8jM+zfbhkFFCYSxit5gvPQdngGGYFUeO/G 01/4+mDq8hddMuwuRXNYxO+UUuP7eYvCKQ== X-Google-Smtp-Source: ABdhPJwGVS5aKq0qBJtwUwgRjFFMbqhJ3nw1k25WYIuIOENgf8IKdho72AED5XohUnQelYpQlDHbEX3qLiuJvw== X-Received: from shakeelb.svl.corp.google.com ([2620:15c:2cd:202:e19:3c48:8d99:dd78]) (user=shakeelb job=sendgmr) by 2002:a63:4f4f:: with SMTP id p15mr3299238pgl.452.1643300810423; Thu, 27 Jan 2022 08:26:50 -0800 (PST) Date: Thu, 27 Jan 2022 08:26:36 -0800 Message-Id: <20220127162636.3461256-1-shakeelb@google.com> Mime-Version: 1.0 X-Mailer: git-send-email 2.35.0.rc0.227.g00780c9af4-goog Subject: [PATCH] memcg: replace in_interrupt() with !in_task() From: Shakeel Butt To: Vasily Averin , Johannes Weiner , Michal Hocko , Roman Gushchin Cc: Andrew Morton , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Shakeel Butt X-Stat-Signature: bewfipfcksoi5xkq5o65irhst8p1pcd7 X-Rspam-User: nil Authentication-Results: imf06.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=ll4Oa4yc; spf=pass (imf06.hostedemail.com: domain of 3ysfyYQgKCDspeXhbbiYdlldib.Zljifkru-jjhsXZh.lod@flex--shakeelb.bounces.google.com designates 209.85.214.201 as permitted sender) smtp.mailfrom=3ysfyYQgKCDspeXhbbiYdlldib.Zljifkru-jjhsXZh.lod@flex--shakeelb.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: 99FE7180009 X-HE-Tag: 1643300811-946409 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000221, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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. Signed-off-by: Shakeel Butt Acked-by: Michal Hocko --- 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();