On Mon 2023-05-29 16:42:09, Matthew Wilcox wrote: > On Mon, May 29, 2023 at 05:27:29PM +0200, Petr Mladek wrote: > > On Sun 2023-05-28 17:01:59, Hyeonggon Yoo wrote: > > > The code mostly looks fine and the patch makes sense to me. > > > But I'm not sure if it's a nice behavior to print garbage when it does not > > > have a page type, although I can hardly imagine users of this flag other > > > than __dump_page(). I'd rather keep printk part unchanged and add > > > page_has_type() check in __dump_page(). > > > > I agree with Hyeonggon. The change in __dump_page() makes sense. > > But vsprintf() should stay clever and do not print garbage. > > The caller (and, let's face it, there's only ever going to be one > caller) shouldn't pass garbage in the first place. By other words you say that vsprintf() might produce "garbage" when the given value is invalid. And the check is not worth the complexity. It might make sense. Well, we should keep test of the invalid value in test_printf.c. And it would need to be updated when a new page_type is added because it would produce another garbage. From this POV, I would prefer to keep the check in vsprintf.c. All in all. It is about a compromise. I can't judge how much the extra page_type_has_type() complicates mm code. Best Regards, Petr