Re: [PATCH] printk: inject caller information into the body of message

From: Sergey Senozhatsky
Date: Fri Sep 14 2018 - 08:22:25 EST


On (09/14/18 21:03), Tetsuo Handa wrote:
> > 80 bytes is quite short for OOM, agreed.
> >
> >> static char oom_print_buf[1024];
> >> DEFINE_PR_LINE_BUF(level, oom_print_buf);
> >
> > Do I get it right that you suggest to drop the "size" param?
>
> No. I just forgot to add params. ;-)
>
> > Do OOM people agree on 1024 bytes stack usage?
>
> I won't allocate oom_print_buf on the stack. Since its usage is serialized
> by oom_lock mutex, we don't need to allocate from stack. Since memory
> allocation request might happen when stack is already tight, we should not
> try to allocate much from stack.

... by "OOM people" I meant "MM people".
"MM people" is a subset of "OOM people".

OK, so I didn't notice the "static" part of the `oom_print_buf'.
I need some rest, I guess.

The "SMP-safe" comment becomes a bit tricky when pr_line is used with a
static buffer. Either we need to require synchronization - umm... and
document it - or to provide some means of synchronization in pr_line().
Let's think what pr_line API should do about it.

Any thoughts?

-ss