Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp371079rwr; Thu, 4 May 2023 21:13:38 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7KoAL0EtYSSU74c9bkdlmJKMIiYYUpmVe21y20F41wmy86FVpi8cc6QB37vGL7yP6807F3 X-Received: by 2002:a17:902:d507:b0:1ac:310d:872d with SMTP id b7-20020a170902d50700b001ac310d872dmr63688plg.52.1683260018649; Thu, 04 May 2023 21:13:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683260018; cv=none; d=google.com; s=arc-20160816; b=FahMygyfhEhs/TAyhqs1qS8BpvWhJqU+17twek3mfgvyjJGDBVSjYDYwgDYZfqMHy7 El8YFODEoLhdm+E002eEmbiPsI0dEmqC0UuchoDhAqnQfwyx4sqs0xrgoZI0KZ0JrdR+ upI1P7Y27UM5NCRF2vmSW6VXh6cQUx5hLTwgX5/4MEX7f5BTE40cPgNKB/tPX0BKZcaD jVFs2zP8Yi7vunbIdnNNnkkgZHHMQD0KqpO2RuuXZ47s+dRSgVtyYLqSIHYV4vT4Wbnw 0tjwxJ/upFh3ILDAIWrNX/VdlkAtbtMQSsdhmclMdhsQ3CRo26cHADrKFV7mbeco2wgn nkqw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:references:message-id :content-transfer-encoding:cc:date:in-reply-to:from:subject :mime-version:dkim-signature; bh=QdstHLLK2gjOImYQV2bW8W6qJ+VMebC2r6lpW7ASjOQ=; b=nNYyZ0QS5UIDsNqHT9ZCWv0bLnWYjQHzEZ7TGjD3zyNi6xBwG1y2elEs/uiVxz8a51 IxvndRmHIUaOjU8VaVY7usYeQH6x6R9EP2c1CBJKr93MF5Y1brWbhqQ+umnKppfU3dB+ ZG4DwY/nd5/Ws6x3AiBS6oNGhNV+1j+66D4NvdFS6jidJF9VF3JFtNMIi/dHJQGwbzIB NXU++jrJTPuPPuZDyU0Hde6sReCOJMi328tpptGjYC18sld86kMjBemaw7snhZ5f0Bcc SFA48GkKdDqJgVXHz4ocLAvZZ3yhO/KjkNc7Bgfmf3bpCmkvEEMiCNjHs/QnYEz6DqH6 vFoA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=xpmr4J6V; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k2-20020a170902694200b001a80c0abba4si744471plt.184.2023.05.04.21.13.21; Thu, 04 May 2023 21:13:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=xpmr4J6V; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229577AbjEEDyh (ORCPT + 99 others); Thu, 4 May 2023 23:54:37 -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 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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.