Re: [PATCH 4/7] mm: Centralize & improve oom reporting in show_mem.c

From: Kent Overstreet
Date: Tue Nov 28 2023 - 12:54:52 EST


On Tue, Nov 28, 2023 at 11:07:18AM +0100, Michal Hocko wrote:
> On Wed 22-11-23 18:25:09, Kent Overstreet wrote:
> [...]
> > 00177 Shrinkers:
> > 00177 super_cache_scan: objects: 127
> > 00177 super_cache_scan: objects: 106
> > 00177 jbd2_journal_shrink_scan: objects: 32
> > 00177 ext4_es_scan: objects: 32
> > 00177 bch2_btree_cache_scan: objects: 8
> > 00177 nr nodes: 24
> > 00177 nr dirty: 0
> > 00177 cannibalize lock: 0000000000000000
> > 00177
> > 00177 super_cache_scan: objects: 8
> > 00177 super_cache_scan: objects: 1
>
> It would be really great to provide an example on how these numbers are
> useful for the oom evaluation.

I should've posted an example from the end of the patch series; I'll do
that later today.

> [...]
> > @@ -423,4 +426,21 @@ void __show_mem(unsigned int filter, nodemask_t *nodemask, int max_zone_idx)
> > #ifdef CONFIG_MEMORY_FAILURE
> > printk("%lu pages hwpoisoned\n", atomic_long_read(&num_poisoned_pages));
> > #endif
> > +
> > + buf = kmalloc(4096, GFP_ATOMIC);
>
> I really do not think we want to allow allocations from the OOM context.
> Is there any reason why this cannot be a statically allocated buffer?

You've made this claim before without ever giving any reasoning behind
it.

It's GFP_ATOMIC; it has to work from _interrupt_ context, OOM context is
fine.

And no, we don't want to burn 4k on a static buffer that is almost never
used; people do care about making the kernel run on small systems.