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: <20070411120431.GB165@tv-sign.ru>
Date:	Wed, 11 Apr 2007 16:04:31 +0400
From:	Oleg Nesterov <oleg@...sign.ru>
To:	"Eric W. Biederman" <ebiederm@...ssion.com>
Cc:	Andrew Morton <akpm@...ux-foundation.org>,
	Davide Libenzi <davidel@...ilserver.org>,
	Jan Engelhardt <jengelh@...ux01.gwdg.de>,
	Ingo Molnar <mingo@...e.hu>,
	Linus Torvalds <torvalds@...ux-foundation.org>,
	Robin Holt <holt@....com>, Roland McGrath <roland@...hat.com>,
	"Serge E. Hallyn" <serge@...lyn.com>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] kthread: Don't depend on work queues

On 04/10, Eric W. Biederman wrote:
> 
> +int kthreadd(void *unused)
> +{
> +	/* Setup a clean context for our children to inherit. */
> +	kthreadd_setup();
> +
> +	current->flags |= PF_NOFREEZE;
> +
> +	for (;;) {
> +		wait_event(kthread_create_work,
> +			   !list_empty(&kthread_create_list));
> +
> +		spin_lock(&kthread_create_lock);
> +		while (!list_empty(&kthread_create_list)) {

Do we need to check the condition under lock? We can miss an event,
but then it will be noticed by wait_event() above.

> +			struct kthread_create_info *create;
> +
> +			create = list_entry(kthread_create_list.next,
> +					    struct kthread_create_info, list);
> +			list_del_init(&create->list);
> +			spin_unlock(&kthread_create_lock);
> +
> +			create_kthread(create);
> +
> +			spin_lock(&kthread_create_lock);
> +		}
> +		spin_unlock(&kthread_create_lock);
> +	}

IOW,

	for (;;) {
		wait_event(kthread_create_work,
			   !list_empty(&kthread_create_list));

		while (!list_empty(&kthread_create_list)) {
			struct kthread_create_info *create;

			spin_lock(&kthread_create_lock);
			create = list_entry(kthread_create_list.next,
					    struct kthread_create_info, list);
			list_del_init(&create->list);
			spin_unlock(&kthread_create_lock);

			create_kthread(create);
		}
	}

Oleg.

-
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