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: <CAJd=RBB2Hcn7mAdAXF-K7sM=5pxpd8sre6rEJExC79LUO3iEbA@mail.gmail.com>
Date:	Sat, 9 Feb 2013 21:11:25 +0800
From:	Hillf Danton <dhillf@...il.com>
To:	Michel Lespinasse <walken@...gle.com>
Cc:	linux-kernel@...r.kernel.org, anton@...ba.org, hpa@...or.com,
	mingo@...nel.org, arjan@...ux.intel.com, a.p.zijlstra@...llo.nl,
	torvalds@...ux-foundation.org, alex.shi@...el.com,
	yuanhan.liu@...ux.intel.com, dhowells@...hat.com,
	akpm@...ux-foundation.org
Subject: Re: [PATCH 3/4] rwsem: implement write lock stealing

On Sat, Feb 9, 2013 at 3:42 PM, Michel Lespinasse <walken@...gle.com> wrote:
> On Fri, Feb 8, 2013 at 11:30 PM, Hillf Danton <dhillf@...il.com> wrote:
>> On Sat, Feb 9, 2013 at 10:45 AM, Michel Lespinasse <walken@...gle.com> wrote:
>>> +               if (waiter->type != RWSEM_WAITING_FOR_WRITE) {
>>> +                       list_del(&waiter->list);
>>> +
>>> +                       /* Set RWSEM_WAITING_BIAS before waking the last reader
>>> +                        * so we know there will be a remaining active locker.
>>> +                        */
>>> +                       if (!(--readers) && !list_empty(&sem->wait_list))
>>> +                               rwsem_atomic_add(RWSEM_WAITING_BIAS, sem);
>>> +
>>> +                       tsk = waiter->task;
>>> +                       smp_mb();
>>
>> For what with mb?
>
> This is the same mb that used to be before the readers_only label
> before this change.
> The intention is that the write to waiter->task must be the last
> access to waiter - after that, the reader is granted the lock so it
> could do anything, including deallocating the waiter structure as it
> gets out of rwsem_down_read_failed() and possibly deallocating the
> task structure if it exits
>
Perhaps the waiting process needs to see if no more wait needed,
	/* wait to be given the lock */
	for (;;) {
		if (!waiter.task)
			break;
		schedule();
		set_task_state(tsk, TASK_UNINTERRUPTIBLE);
	}
and another mb do exist at the beginning of try_to_wake_up().

And I want to change
+       /* Block until there are no active lockers. */
+       do {
+               schedule();
+               set_task_state(tsk, TASK_UNINTERRUPTIBLE);
+       } while (sem->count & RWSEM_ACTIVE_MASK);

to
	/* Block until there are no active lockers. */
	while (sem->count & RWSEM_ACTIVE_MASK) {
		schedule();
		set_task_state(tsk, TASK_UNINTERRUPTIBLE);
	}
for sure that we have to wait.
--
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