Re: [PATCH] mm/page_alloc: Wait for oom_lock before retrying.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu 2016-12-15 07:35:52, Michal Hocko wrote:
> On Thu 15-12-16 10:11:42, Sergey Senozhatsky wrote:
> > On (12/13/16 18:06), Michal Hocko wrote:
> > [..]
> > > What if we lower the loglevel as much as possible to only see KERN_ERR
> > > should be sufficient to see few oom killer messages while suppressing
> > > most of the other noise. Unfortunatelly, even messages with level >
> > > loglevel get stored into the ringbuffer (as I've just learned) so
> > > console_unlock() has to crawl through them just to drop them (Meh) but
> > > at least it doesn't have to go to the serial console drivers and spend
> > > even more time there. An alternative would be to tweak printk to not
> > > even store those messaes. Something like the below
> > > 
> > > diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c
> > > index f7a55e9ff2f7..197f2b9fb703 100644
> > > --- a/kernel/printk/printk.c
> > > +++ b/kernel/printk/printk.c
> > > @@ -1865,6 +1865,15 @@ asmlinkage int vprintk_emit(int facility, int level,
> > >  				lflags |= LOG_CONT;
> > >  			}
> > >  
> > > +			if (suppress_message_printing(kern_level)) {
> > 
> > aren't we supposed to check level here:
> > 				suppress_message_printing(level)?
> > 
> > kern_level is '0' away from actual level:
> > 
> > 	kern_level = printk_get_level(text)
> > 	switch (kern_level)
> > 	case '0' ... '7':
> > 		level = kern_level - '0';
> 
> Yes you are right. The patch would be broken for KERN_CONT so I think it
> doesn't make much sense to pursue it for testing.

It should help to do the check later when "level" variable has
the final value:

diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c
index b3c454b733da..97f2737c3380 100644
--- a/kernel/printk/printk.c
+++ b/kernel/printk/printk.c
@@ -1774,6 +1774,14 @@ asmlinkage int vprintk_emit(int facility, int level,
 	if (level == LOGLEVEL_DEFAULT)
 		level = default_message_loglevel;
 
+	if (suppress_message_printing(level)) {
+		logbuf_cpu = UINT_MAX;
+		raw_spin_unlock(&logbuf_lock);
+		lockdep_on();
+		local_irq_restore(flags);
+		return 0;
+	}
+
 	if (dict)
 		lflags |= LOG_PREFIX|LOG_NEWLINE;
 

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxx.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>



[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]