lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Mon, 19 Dec 2016 16:32:28 +0900
From:   Sergey Senozhatsky <sergey.senozhatsky.work@...il.com>
To:     Vlastimil Babka <vbabka@...e.cz>
Cc:     Michal Hocko <mhocko@...nel.org>,
        Andrew Morton <akpm@...ux-foundation.org>,
        Mel Gorman <mgorman@...e.de>,
        Johannes Weiner <hannes@...xchg.org>,
        Joonsoo Kim <js1304@...il.com>, linux-mm@...ck.org,
        LKML <linux-kernel@...r.kernel.org>,
        Michal Hocko <mhocko@...e.com>, Petr Mladek <pmladek@...e.cz>,
        Sergey Senozhatsky <sergey.senozhatsky@...il.com>
Subject: Re: [PATCH] mm: simplify node/zone name printing

Hello,

On (12/19/16 08:00), Vlastimil Babka wrote:
[..]
> > @@ -4421,7 +4421,6 @@ void show_free_areas(unsigned int filter)
> >  		printk("lowmem_reserve[]:");
> >  		for (i = 0; i < MAX_NR_ZONES; i++)
> >  			printk(KERN_CONT " %ld", zone->lowmem_reserve[i]);
> > -		printk(KERN_CONT "\n");
> 
> So there's really no functional difference between terminating line
> explicitly with "\n", and doing a followup printk() without KERN_CONT?
> I agree that a KERN_CONT line just to print "\n" is ugly, just want to
> be sure we are really safe without it, considering how KERN_CONT has
> been recently changed etc.

depending on what will follow. if another KERN_CONT printk then
without this explicit '\n' printk may assume that we are still
in cont printing; if something else -- printk should flush.

kernel/printk/printk.c

	/*
	 * If an earlier line was buffered, and we're a continuation
	 * write from the same process, try to add it to the buffer.
	 */
	if (cont.len) {
		if (cont.owner == current && (lflags & LOG_CONT)) {
			if (cont_add(facility, level, lflags, text, text_len))
				return text_len;
		}
		/* Otherwise, make sure it's flushed */
		cont_flush();
	}


as far as I can tell, now for_each_populated_zone() iterations are
split by non-CONT printk() from show_zone_node(), which previously
has been   printk(KERN_CONT "%s: ", zone->name), so pr_cont(\n)
between iterations was important, but now that non-CONT printk()
should do the trick. it's _a bit_ hacky, though.

	-ss

> >  	}
> >  
> >  	for_each_populated_zone(zone) {
> > @@ -4431,8 +4430,7 @@ void show_free_areas(unsigned int filter)
> >  
> >  		if (skip_free_areas_node(filter, zone_to_nid(zone)))
> >  			continue;
> > -		show_node(zone);
> > -		printk(KERN_CONT "%s: ", zone->name);
> > +		show_zone_node(zone);
> >  
> >  		spin_lock_irqsave(&zone->lock, flags);

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ