From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752125AbbGBDGg (ORCPT ); Wed, 1 Jul 2015 23:06:36 -0400 Received: from mail-qk0-f180.google.com ([209.85.220.180]:33821 "EHLO mail-qk0-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751772AbbGBDG2 (ORCPT ); Wed, 1 Jul 2015 23:06:28 -0400 Date: Wed, 1 Jul 2015 23:06:24 -0400 From: Tejun Heo To: Jan Kara Cc: axboe@kernel.dk, linux-kernel@vger.kernel.org, hch@infradead.org, hannes@cmpxchg.org, linux-fsdevel@vger.kernel.org, vgoyal@redhat.com, lizefan@huawei.com, cgroups@vger.kernel.org, linux-mm@kvack.org, mhocko@suse.cz, clm@fb.com, fengguang.wu@intel.com, david@fromorbit.com, gthelen@google.com, khlebnikov@yandex-team.ru Subject: Re: [PATCH 44/51] writeback: implement bdi_wait_for_completion() Message-ID: <20150702030624.GM26440@mtj.duckdns.org> References: <1432329245-5844-1-git-send-email-tj@kernel.org> <1432329245-5844-45-git-send-email-tj@kernel.org> <20150701160437.GG7252@quack.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150701160437.GG7252@quack.suse.cz> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. Thanks. -- tejun