> On Apr 28, 2023, at 21:24, Yosry Ahmed <yosryahmed@xxxxxxxxxx> 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 <yosryahmed@xxxxxxxxxx> > Acked-by: Michal Hocko <mhocko@xxxxxxxx> > Reviewed-by: Sergey Senozhatsky <senozhatsky@xxxxxxxxxxxx> Reviewed-by: Muchun Song <songmuchun@xxxxxxxxxxxxx> Thanks.