From mboxrd@z Thu Jan 1 00:00:00 1970 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 1BD81C77B73 for ; Fri, 5 May 2023 03:46:53 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5392E6B0075; Thu, 4 May 2023 23:46:52 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 4E91F6B0078; Thu, 4 May 2023 23:46:52 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3FF3D6B007B; Thu, 4 May 2023 23:46:52 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from out-38.mta0.migadu.com (out-38.mta0.migadu.com [91.218.175.38]) by kanga.kvack.org (Postfix) with ESMTP id 212A36B0075 for ; Thu, 4 May 2023 23:46:52 -0400 (EDT) Content-Type: text/plain; charset=us-ascii DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1683258410; h=from:from: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:in-reply-to:references:references; bh=QdstHLLK2gjOImYQV2bW8W6qJ+VMebC2r6lpW7ASjOQ=; b=xpmr4J6VcuQA8arCmDuI/+V4og63KJIFBlBzrrrblGmtHqWON1ivEOMglN2h2Qg1/o2CmT PbGxWGdhKcG8mr/PRQxdIZQ0x2lMKuu0yKmnKqz6/P6PSOSqzbU0b2CJ1QqGfpf6owumUc JiLrELiAIJ/U3ooS/lf+LknWuujeGds= MIME-Version: 1.0 Subject: Re: [PATCH v2 1/2] memcg: use seq_buf_do_printk() with mem_cgroup_print_oom_meminfo() X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Muchun Song In-Reply-To: <20230428132406.2540811-2-yosryahmed@google.com> Date: Fri, 5 May 2023 11:46:10 +0800 Cc: Johannes Weiner , Michal Hocko , Roman Gushchin , Shakeel Butt , Andrew Morton , Sergey Senozhatsky , Steven Rostedt , Petr Mladek , Chris Li , cgroups@vger.kernel.org, Linux Memory Management List , linux-kernel@vger.kernel.org, Michal Hocko Content-Transfer-Encoding: 7bit Message-Id: <5BE37965-9A20-4743-A2BC-E407D89C53D1@linux.dev> References: <20230428132406.2540811-1-yosryahmed@google.com> <20230428132406.2540811-2-yosryahmed@google.com> To: Yosry Ahmed X-Migadu-Flow: FLOW_OUT 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: > On Apr 28, 2023, at 21:24, Yosry Ahmed wrote: > > Currently, we format all the memcg stats into a buffer in > mem_cgroup_print_oom_meminfo() and use pr_info() to dump it to the logs. > However, this buffer is large in size. Although it is currently working > as intended, ther is a dependency between the memcg stats buffer and the > printk record size limit. > > If we add more stats in the future and the buffer becomes larger than > the printk record size limit, or if the prink record size limit is > reduced, the logs may be truncated. > > It is safer to use seq_buf_do_printk(), which will automatically break > up the buffer at line breaks and issue small printk() calls. > > Refactor the code to move the seq_buf from memory_stat_format() to its > callers, and use seq_buf_do_printk() to print the seq_buf in > mem_cgroup_print_oom_meminfo(). > > Signed-off-by: Yosry Ahmed > Acked-by: Michal Hocko > Reviewed-by: Sergey Senozhatsky Reviewed-by: Muchun Song Thanks.