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, 15 Aug 2011 22:21:41 +0800
From:	Wu Fengguang <fengguang.wu@...el.com>
To:	Andrea Righi <andrea@...terlinux.com>
Cc:	Peter Zijlstra <peterz@...radead.org>,
	"linux-fsdevel@...r.kernel.org" <linux-fsdevel@...r.kernel.org>,
	Andrew Morton <akpm@...ux-foundation.org>,
	Jan Kara <jack@...e.cz>, Christoph Hellwig <hch@....de>,
	Dave Chinner <david@...morbit.com>,
	Greg Thelen <gthelen@...gle.com>,
	Minchan Kim <minchan.kim@...il.com>,
	Vivek Goyal <vgoyal@...hat.com>, linux-mm <linux-mm@...ck.org>,
	LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 4/5] writeback: per task dirty rate limit

Andrea,

> > @@ -1158,6 +1160,15 @@ void balance_dirty_pages_ratelimited_nr(
> >  	if (bdi->dirty_exceeded)
> >  		ratelimit = 8;
> >  
> > +	preempt_disable();
> > +	p = &__get_cpu_var(dirty_leaks);
> > +	if (*p > 0 && current->nr_dirtied < ratelimit) {
> > +		nr_pages_dirtied = min(*p, ratelimit - current->nr_dirtied);
> > +		*p -= nr_pages_dirtied;
> > +		current->nr_dirtied += nr_pages_dirtied;
> > +	}
> > +	preempt_enable();
> > +
> 
> I think we are still leaking some dirty pages, when the condition is
> false nr_pages_dirtied is just ignored.
> 
> Why not doing something like this?
> 
> 	current->nr_dirtied += nr_pages_dirtied;

You must mean the above line. Sorry I failed to provide another patch
before this one (attached this time). With that preparation patch, it
effectively become equal to the logic below :)

> 	if (current->nr_dirtied < ratelimit) {
> 		p = &get_cpu_var(dirty_leaks);
> 		if (*p > 0) {
> 			nr_pages_dirtied = min(*p, ratelimit -
> 							current->nr_dirtied);
> 			*p -= nr_pages_dirtied;
> 		} else
> 			nr_pages_dirtied = 0;
> 		put_cpu_var(dirty_leaks);
> 
> 		current->nr_dirtied += nr_pages_dirtied;
> 	}

Thanks,
Fengguang

> >  	if (unlikely(current->nr_dirtied >= ratelimit))
> >  		balance_dirty_pages(mapping, current->nr_dirtied);
> >  }
> > --- linux-next.orig/kernel/exit.c	2011-08-08 21:43:37.000000000 +0800
> > +++ linux-next/kernel/exit.c	2011-08-08 21:45:58.000000000 +0800
> > @@ -1039,6 +1039,8 @@ NORET_TYPE void do_exit(long code)
> >  	validate_creds_for_do_exit(tsk);
> >  
> >  	preempt_disable();
> > +	if (tsk->nr_dirtied)
> > +		__this_cpu_add(dirty_leaks, tsk->nr_dirtied);
> >  	exit_rcu();
> >  	/* causes final put_task_struct in finish_task_switch(). */
> >  	tsk->state = TASK_DEAD;

View attachment "writeback-accurate-task-dirtied.patch" of type "text/x-diff" (1227 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ