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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2691CC77B75 for ; Fri, 5 May 2023 03:54:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230186AbjEEDyj (ORCPT ); Thu, 4 May 2023 23:54:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58560 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229905AbjEEDyg (ORCPT ); Thu, 4 May 2023 23:54:36 -0400 X-Greylist: delayed 463 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Thu, 04 May 2023 20:54:35 PDT Received: from out-38.mta0.migadu.com (out-38.mta0.migadu.com [91.218.175.38]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2AD8A11562 for ; Thu, 4 May 2023 20:54:35 -0700 (PDT) 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 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > 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.