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:	Fri, 3 Jul 2015 14:36:42 +0200
From:	Jan Kara <jack@...e.cz>
To:	Tejun Heo <tj@...nel.org>
Cc:	Jan Kara <jack@...e.cz>, axboe@...nel.dk,
	linux-kernel@...r.kernel.org, hch@...radead.org,
	hannes@...xchg.org, linux-fsdevel@...r.kernel.org,
	vgoyal@...hat.com, lizefan@...wei.com, cgroups@...r.kernel.org,
	linux-mm@...ck.org, mhocko@...e.cz, clm@...com,
	fengguang.wu@...el.com, david@...morbit.com, gthelen@...gle.com,
	khlebnikov@...dex-team.ru
Subject: Re: [PATCH 44/51] writeback: implement bdi_wait_for_completion()

On Wed 01-07-15 23:06:24, Tejun Heo wrote:
> Hello, Jan.
> 
> On Wed, Jul 01, 2015 at 06:04:37PM +0200, Jan Kara wrote:
> > I'd find it better to extend completions to allow doing what you need. It
> > isn't that special. It seems it would be enough to implement
> > 
> > void wait_for_completions(struct completion *x, int n);
> > 
> > where @n is the number of completions to wait for. And the implementation
> > can stay as is, only in do_wait_for_common() we change checks for x->done ==
> > 0 to "x->done < n". That's about it...
> 
> I don't know.  While I agree that it'd be nice to have a generic event
> count & trigger mechanism in the kernel, I don't think extending
> completion is a good idea - the count then works both ways as the
> event counter && listener counter and effectively becomes a semaphore
> which usually doesn't end well.  There are very few cases where we
> want the counter works both ways and I personally think we'd be far
> better served if those rare cases implement something custom rather
> than generic mechanism becoming cryptic trying to cover everything.

Let me phrase my objection this differently: Instead of implementing custom
synchronization mechanism, you could as well do:

int count_submitted;	/* Number of submitted works we want to wait for */
struct completion done;
...
submit works with 'done' as completion.
...
while (count_submitted--)
	wait_for_completion(&done);

And we could also easily optimize that loop and put it in
kernel/sched/completion.c. The less synchronization mechanisms we have the
better I'd think...

								Honza
-- 
Jan Kara <jack@...e.cz>
SUSE Labs, CR
--
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