From patchwork Fri Jun 28 07:23:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xiu Jianfeng X-Patchwork-Id: 13715657 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 333A8C2BBCA for ; Fri, 28 Jun 2024 07:31:50 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 86C2C6B009F; Fri, 28 Jun 2024 03:31:49 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 81B106B00A0; Fri, 28 Jun 2024 03:31:49 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 731456B00A1; Fri, 28 Jun 2024 03:31:49 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 553D46B009F for ; Fri, 28 Jun 2024 03:31:49 -0400 (EDT) Received: from smtpin22.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id CDE15A49A3 for ; Fri, 28 Jun 2024 07:31:48 +0000 (UTC) X-FDA: 82279477896.22.6F903B9 Received: from szxga06-in.huawei.com (szxga06-in.huawei.com [45.249.212.32]) by imf30.hostedemail.com (Postfix) with ESMTP id F041980012 for ; Fri, 28 Jun 2024 07:31:45 +0000 (UTC) Authentication-Results: imf30.hostedemail.com; dkim=none; spf=pass (imf30.hostedemail.com: domain of xiujianfeng@huawei.com designates 45.249.212.32 as permitted sender) smtp.mailfrom=xiujianfeng@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1719559898; 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:content-transfer-encoding:in-reply-to: references; bh=JxMVqnKKi3au6qi94t/IG01I8vVY6ZQ4ULHirdsxzRo=; b=8otdk0TKw1053f8wANicMVKjPPjnRcQPdhJo6mbr2OQT4xp9wYqzKga8y74viMnuBUtMM7 8O4++hseAKKtSlfs9B3hKbSJJyS6ntw8YUPBaHBGSASvlzw5+ZJR3L+I8uBf9RWgq7FQqf K/EdU9pWlgA1pslv55aGKMOxq8yCx8s= ARC-Authentication-Results: i=1; imf30.hostedemail.com; dkim=none; spf=pass (imf30.hostedemail.com: domain of xiujianfeng@huawei.com designates 45.249.212.32 as permitted sender) smtp.mailfrom=xiujianfeng@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1719559898; a=rsa-sha256; cv=none; b=S8attfrVoy93s+xTNgQRzYX/wBTVrklHTPHNOh1Q/nVllgE63OAM3h3qZfqUzX8cOPArG5 ILLXVSVvygJgAFwI08rAIRsaTdjCVpYuab6XUdC9/5rsXA7zt7Px3IdRRr9KtAwra0lrMA HMp/iS4k7s6Xci179IdR3Lw8LtH7HVs= Received: from mail.maildlp.com (unknown [172.19.88.214]) by szxga06-in.huawei.com (SkyGuard) with ESMTP id 4W9Rsv3S7Lz1xt4G; Fri, 28 Jun 2024 15:30:11 +0800 (CST) Received: from dggpeml500023.china.huawei.com (unknown [7.185.36.114]) by mail.maildlp.com (Postfix) with ESMTPS id D2DCE1A016C; Fri, 28 Jun 2024 15:31:41 +0800 (CST) Received: from hulk-vt.huawei.com (10.67.174.26) by dggpeml500023.china.huawei.com (7.185.36.114) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.39; Fri, 28 Jun 2024 15:31:41 +0800 From: Xiu Jianfeng To: , , , , , CC: , , Subject: [PATCH -next] mm: memcg: adjust the warning when seq_buf overflows Date: Fri, 28 Jun 2024 07:23:33 +0000 Message-ID: <20240628072333.2496527-1-xiujianfeng@huawei.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Originating-IP: [10.67.174.26] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To dggpeml500023.china.huawei.com (7.185.36.114) X-Rspamd-Server: rspam03 X-Rspam-User: X-Rspamd-Queue-Id: F041980012 X-Stat-Signature: ue63yc66y41iuum5gud4e6qbybz5ynpp X-HE-Tag: 1719559905-724204 X-HE-Meta: U2FsdGVkX1/bqiTvnEDcQQ3SPH7/O4DC8bMBnkpqizPhPNja24MHWPEKpHD63KrMLrsFw+0aGRmWFK5zy4WuGye6MS6VNW56IhAe7aRGPPN08+KQBtZT4n7fJIJmJThhNVX1hg3yaxnjQuMh/JVpJbSJA9mf/nJgnmKZQW2Q1SY/hSfDFJH5DiWNWdrSKh2UX3gbiBYyHd8/KJ0ISfJAaQZ8BA2z6WCKGRkSkM0UdigPEIhYSaQUNZ2mGMZ8rEQvLC5EE5kSHJf8Omy4pvPWZzTSGXACwduZr36iJiFsftbADoIZpcauAeW6CpKNWJaELDZZHNuNVe057B8VeUott9AvC/iCj2lxlNd3R94dEKbfDeIXsL5Wryciy26iQ7MZtuXbojkaXrttSKH+LdbTQeXTQi2tZotYEWu3kEvpnJZxeKVonD+RIwIJ0NzTlkRGFkxP+r+5JsSVmCZMrKj49eiPHkGlc+8kNkyGEyp6eb8pngeRS5xmIiGB6efdezSClDLAW4UCw48IeNfJV2DtVvW8Ut7FPNWIKixUvnCE9j8ZnbQvG3Eyq8MhtdC0tACJC9WMCGklfqxopUAZ2DrttRDXMs1rN9xrIzccp5tU5dj5TAvCCQggdYT9TJ78ehiGEEh8KFTVIx6WReM+oZZ4VoPCkJbNXWADhDlRvi9Nn3MFpOCAF93p48Jq4HyYZ8isrA/nTsjKJHsHlTugNTXc4FI44djjErAJ1wVmQCrwTPLD7FZITNqx5eajLrHxVVugykE4JlIW69njLZS/8WaAYqJHMsxVSkBrX1GyaF7wI4Zh5uJCcM9JePkKUDblR0rJDIJFtIuC1JubXfo3gflN/4vV5pVU9GRFS6s5+14jQ9El/kQIkvmcCOHeSUYDybyUmm+V4BcsWCJ1NuzCe526xgylGtKtraZSF4BnlbKibxZY4ALvZz/Mk3sd/MN64zuV2AncBM82CK7dIdfFd4U TUoIwQaT 6myvUqgiAat3isItdoVQFCLzjh4HGj2ell3ji3v1bkwdI7V9eQuHMgAOmheC8Hp1FHQYoLYIFCfuYDoZI56sjhQYQ9da0WHGuA8DZ/tLbvKh6nIggDP0BiLpNRfI6mVq+Q215n+1nFRONH+DtwZknr/Hfp2+cHsoVRtkd9I2o9l/8h8tnogGa+E+27BTCBsFKIZbhuAJfh6dY6hXwbb6WYAj/WhFW1qbnLKkc2lPiDtn9oZNeDHOcmdqoxQ== 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: List-Subscribe: List-Unsubscribe: Currently it uses WARN_ON_ONCE() if seq_buf overflows when user reads memory.stat, the only advantage of WARN_ON_ONCE is that the splat is so verbose that it gets noticed. And also it panics the system if panic_on_warn is enabled. It seems like the warning is just an over reaction and a simple pr_warn should just achieve the similar effect. Suggested-by: Michal Hocko Signed-off-by: Xiu Jianfeng Acked-by: Michal Hocko --- mm/memcontrol.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mm/memcontrol.c b/mm/memcontrol.c index c251bbe35f4b..8e5590ac43d7 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -1484,7 +1484,8 @@ static void memory_stat_format(struct mem_cgroup *memcg, struct seq_buf *s) memcg_stat_format(memcg, s); else memcg1_stat_format(memcg, s); - WARN_ON_ONCE(seq_buf_has_overflowed(s)); + if (seq_buf_has_overflowed(s)) + pr_warn("%s: Warning, stat buffer overflow, please report\n", __func__); } /**