From patchwork Tue Mar 28 06:16:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yosry Ahmed X-Patchwork-Id: 13190557 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 E6FC5C761A6 for ; Tue, 28 Mar 2023 06:16:52 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8873A900003; Tue, 28 Mar 2023 02:16:52 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 83678280001; Tue, 28 Mar 2023 02:16:52 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 614D9900006; Tue, 28 Mar 2023 02:16:52 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 540F9900003 for ; Tue, 28 Mar 2023 02:16:52 -0400 (EDT) Received: from smtpin27.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 1DC7AC06BE for ; Tue, 28 Mar 2023 06:16:52 +0000 (UTC) X-FDA: 80617298664.27.E2A78F5 Received: from mail-pj1-f74.google.com (mail-pj1-f74.google.com [209.85.216.74]) by imf30.hostedemail.com (Postfix) with ESMTP id 496788000B for ; Tue, 28 Mar 2023 06:16:50 +0000 (UTC) Authentication-Results: imf30.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=FtVms547; spf=pass (imf30.hostedemail.com: domain of 3UYYiZAoKCBAE487Eqx2utw44w1u.s421y3AD-220Bqs0.47w@flex--yosryahmed.bounces.google.com designates 209.85.216.74 as permitted sender) smtp.mailfrom=3UYYiZAoKCBAE487Eqx2utw44w1u.s421y3AD-220Bqs0.47w@flex--yosryahmed.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1679984210; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=+vNiceMoZ2PdzrNG/xVeRzEo7O+ovCZNHcQMp7VClk4=; b=cJBfkeAoJVcSxcfbR2oxIfeSMejKbXVxE4+Z7OpbDpw2R21x0UTE8KkLK/IK5BkPqVJcJq cfb3Zz87Gr2geg1mQWNpXvRHy+xkeufIA7KEioQg2fbAAlvFqtQBn5g3xVdiVpTZJw+Eap F+bgKuUa1iq3ZMjMp4Go0HZykojA6kI= ARC-Authentication-Results: i=1; imf30.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=FtVms547; spf=pass (imf30.hostedemail.com: domain of 3UYYiZAoKCBAE487Eqx2utw44w1u.s421y3AD-220Bqs0.47w@flex--yosryahmed.bounces.google.com designates 209.85.216.74 as permitted sender) smtp.mailfrom=3UYYiZAoKCBAE487Eqx2utw44w1u.s421y3AD-220Bqs0.47w@flex--yosryahmed.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1679984210; a=rsa-sha256; cv=none; b=iI6G+AbXJExc/mdfgXIHfnE0NHDIp1TJg38H+balIzEUuEN4jh9oezmmzWjxytvcOOqfsm U7QEkd3BA1bZ/TA7OF8yWSt5RibUcLY8x9/0b8n0YhGO9gJQYKXpZdfcw7cRZvwjIJ+wQY 1emBQIQhvMz8MC8Mk5sFAS40OIAW2i8= Received: by mail-pj1-f74.google.com with SMTP id ie7-20020a17090b400700b0023f06808981so2970010pjb.8 for ; Mon, 27 Mar 2023 23:16:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; t=1679984209; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=+vNiceMoZ2PdzrNG/xVeRzEo7O+ovCZNHcQMp7VClk4=; b=FtVms547YGVdf9XAqjguoo0WST2Bomcq4pMeCW3qlg0ksZV5swPoVz0GmrxFu8vfrh HBzgJptVGGKy7geKpBPvC2PsWo0HmjT2F27i9dbdVA6zCF4EYemeZRNrh89DbSPqLObX h82tbSvZ/WCeLjLtii1Meb+k3BLVneGl+TdsHqmfTXT/vAFZIC+/S3Aw9k3ElSrpUy7X 9xgxQRUTlE19S9rQfATi59HRnf65TEpEpviTmJbLID2U9/qvSayVfcGFQGEl03zvUEu5 uDhGnK3XWBy1kJngfOB04Odcd1UeEO5WA33WjKyVDhleLQy8k50zMQSY0RXklX82o1Jn CmFQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679984209; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=+vNiceMoZ2PdzrNG/xVeRzEo7O+ovCZNHcQMp7VClk4=; b=0H6C4qQvoAytTZUPcy9PFmHYVmcYp4TUOkG3/hhBkxv32GVpWbdAUvH7jTyDkguksk +u6/WmMmBAHnzkBZ87htn1lh2Ujl0gTG8La0AT5juWgZhdyRb5PXuuhq0YQ0woNApjKP Rlo3kd0XcGKHNkQzFmMc6grjVziA4EkDamG46l6Fe9miWhAAZJkwuYqhs3uj1Bn3j73K v+wvr7c08+WP1PbVRPeGj5SEnagTcHAFvwVB3b55GHkbJpcE0JrNli8BZcmrnVhDo2Hz xPeWwSJT1MfQI1FJqJkrPJyWSvUfaB76rcSIt45Afj3/9M4l+JRergKLLNhneNfICBAP U01g== X-Gm-Message-State: AAQBX9fBNq4kYjjQ0Pd+f0JikTAjaH5JDb9H0TCSdrBpO0YKlubFpHde f2TABakJPfnnjvUPcnCJDJoQnv8+0RDf6zLO X-Google-Smtp-Source: AKy350az2ZQxKTBjGyFUiNza+YDGvWpTHjavWcHAugAuQk4rmOEm1wQoqfQkURL2u01jT9Cm3t+xr5muiADnxiOT X-Received: from yosry.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:2327]) (user=yosryahmed job=sendgmr) by 2002:a05:6a00:1a46:b0:625:c7de:48c1 with SMTP id h6-20020a056a001a4600b00625c7de48c1mr7269994pfv.4.1679984209151; Mon, 27 Mar 2023 23:16:49 -0700 (PDT) Date: Tue, 28 Mar 2023 06:16:33 +0000 In-Reply-To: <20230328061638.203420-1-yosryahmed@google.com> Mime-Version: 1.0 References: <20230328061638.203420-1-yosryahmed@google.com> X-Mailer: git-send-email 2.40.0.348.gf938b09366-goog Message-ID: <20230328061638.203420-5-yosryahmed@google.com> Subject: [PATCH v1 4/9] cgroup: rstat: add WARN_ON_ONCE() if flushing outside task context From: Yosry Ahmed To: Tejun Heo , Josef Bacik , Jens Axboe , Zefan Li , Johannes Weiner , Michal Hocko , Roman Gushchin , Shakeel Butt , Muchun Song , Andrew Morton , " =?utf-8?q?Michal_Koutn=C3=BD?= " Cc: Vasily Averin , cgroups@vger.kernel.org, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, bpf@vger.kernel.org, Yosry Ahmed X-Rspam-User: X-Rspamd-Server: rspam03 X-Stat-Signature: mpcpf5hoiyos4dhcjgof34usgoyw7ehh X-Rspamd-Queue-Id: 496788000B X-HE-Tag: 1679984210-355937 X-HE-Meta: U2FsdGVkX195XSQw41vXBNMOP8+532TDd/IFZwUeulpKFeYHAkeBI5FcQO5a+nnQmsVeuuRqiyIj80u045yH40ajDDg6dYRuEdaDHasp7S8H1VMtGgLlsZ/dS1Q6mQUZYJx9b28AmZpOxjRZ+zDDxMacfySZ59zZenyGOZxIbERJITIy90xUjY6vHj8EkPaSNN1uSUMsFY163rzeE66ZtTeahOey2T7upfEjy+szHQRJ4va+Di3YyQLn6fmQBT2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KrLknt/pJlSLSsEf2VKAFfoK2mGk/mvA8LiRfQ1wb2/1wnI6gc6oY6YUkGSY5I1DGgc1jOmX1Rlt5Zx4VpdNdV9kics+ZbF6QnzZ8+dFbNeWNQfRPB+Mgj8y9fGURzg6ZHG5sfTJ2OFuXbaNNx72uLXrL+Xt6GHTkzOpNjOQ1H332ujTM4b6hdUAN5ujVUgKJiky1ZZcFkLIyb8RmpUeRNyDYoAsvBFy6Io267S5XkVMuHRsC8G+UfsCp3OXbnjSFKwK0lVJmzLk908f7sRk6eudX7BMTeQY73OQAOP5qqJAfbJxg6Os0ZL9JME7xZPu2gGeop2dA4xyaNpHoYXpaaVioXpKrau3rL1fOvBRAqO0/Tu4Ml50wzwi7+X7q9wS7aggSasNQm4Ib3Vs0VGaKs X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: rstat flushing is too expensive to perform in irq context. The previous patch removed the only context that may invoke an rstat flush from irq context, add a WARN_ON_ONCE() to detect future violations, or those that we are not aware of. Signed-off-by: Yosry Ahmed Reviewed-by: Shakeel Butt --- kernel/cgroup/rstat.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/kernel/cgroup/rstat.c b/kernel/cgroup/rstat.c index d3252b0416b6..c2571939139f 100644 --- a/kernel/cgroup/rstat.c +++ b/kernel/cgroup/rstat.c @@ -176,6 +176,8 @@ static void cgroup_rstat_flush_locked(struct cgroup *cgrp, bool may_sleep) { int cpu; + /* rstat flushing is too expensive for irq context */ + WARN_ON_ONCE(!in_task()); lockdep_assert_held(&cgroup_rstat_lock); for_each_possible_cpu(cpu) {