Thread (74 messages) 74 messages, 6 authors, 2017-01-13

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

From: Petr Mladek <pmladek@suse.com>
Date: 2016-12-15 10:16:55
Subsystem: printk, the rest · Maintainers: Petr Mladek, Linus Torvalds

On Thu 2016-12-15 07:35:52, Michal Hocko wrote:
On Thu 15-12-16 10:11:42, Sergey Senozhatsky wrote:
quoted
On (12/13/16 18:06), Michal Hocko wrote:
[..]
quoted
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@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help