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]
Message-ID: <1345475530.23018.50.camel@twins>
Date:	Mon, 20 Aug 2012 17:12:10 +0200
From:	Peter Zijlstra <peterz@...radead.org>
To:	Oleg Nesterov <oleg@...hat.com>
Cc:	Dave Jones <davej@...hat.com>,
	Linux Kernel <linux-kernel@...r.kernel.org>,
	Thomas Gleixner <tglx@...utronix.de>,
	rostedt <rostedt@...dmis.org>, dhowells <dhowells@...hat.com>,
	Al Viro <viro@...iv.linux.org.uk>
Subject: Re: lockdep trace from posix timers

On Mon, 2012-08-20 at 17:05 +0200, Oleg Nesterov wrote:
> On 08/20, Peter Zijlstra wrote:
> >
> > +static void __task_work_run(struct callback_head *tail)
> >  {
> > -	struct task_struct *task = current;
> > -	struct callback_head *p, *q;
> > -
> > -	while (1) {
> > -		raw_spin_lock_irq(&task->pi_lock);
> > -		p = task->task_works;
> > -		task->task_works = NULL;
> > -		raw_spin_unlock_irq(&task->pi_lock);
> > -
> > -		if (unlikely(!p))
> > -			return;
> > -
> > -		q = p->next; /* head */
> > -		p->next = NULL; /* cut it */
> > -		while (q) {
> > -			p = q->next;
> > -			q->func(q);
> > -			q = p;
> > +	struct callback_head **head = &current->task_works;
> > +
> > +	do {
> > +		struct callback_head *work = xchg(head, NULL);
> > +		while (work) {
> > +			struct callback_head *next = ACCESS_ONCE(work->next);
> > +
> > +			WARN_ON_ONCE(work == &dead);
> > +
> > +			work->func(work);
> > +			work = next;
> >  		}
> > -	}
> > +	} while (cmpxchg(head, NULL, tail) != NULL);
> 
> Yes, we can add the explicit argument to __task_work_run(), but it can
> check PF_EXITING instead, this looks simpler to me.

I guess we could.. but I thought the explicit callback was simpler ;-)

> Note also your patch breaks fifo, but this is fixable.

Why do you care about the order? Iterating a single linked queue in fifo
seems more expensive than useful.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ