[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20140611151647.GA21158@redhat.com>
Date: Wed, 11 Jun 2014 17:16:47 +0200
From: Oleg Nesterov <oleg@...hat.com>
To: Rasmus Villemoes <linux@...musvillemoes.dk>
Cc: Linus Torvalds <torvalds@...ux-foundation.org>,
Ingo Molnar <mingo@...hat.com>,
Peter Zijlstra <peterz@...radead.org>,
Andrew Morton <akpm@...ux-foundation.org>,
Rik van Riel <riel@...hat.com>,
David Rientjes <rientjes@...gle.com>,
"Eric W. Biederman" <ebiederm@...ssion.com>,
Davidlohr Bueso <davidlohr@...com>,
Michal Simek <michal.simek@...inx.com>,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/2] wait: Introduce per-task wait_queue_t
On 06/10, Rasmus Villemoes wrote:
>
> This introduces a single wait_queue_t into the task structure.
> Functions which need to wait, but which do not call other functions
> that might wait while on the wait queue, may use current->__wq
I am not going to argue, but I am not sure that wait_event() (changed
by the next patch) meets this criteria...
wait_event(wq, something_nontrivial_which_uses_wait_event_too()) is
legal currently although perhaps nobody does this.
> +static inline wait_queue_t *current_wq_get(void)
> +{
> + wait_queue_t *wq = ¤t->__wq;
> + BUG_ON(wq->flags != WQ_FLAG_AVAILABLE);
> + wq->flags = 0;
> + return wq;
> +}
> +static inline void current_wq_put(wait_queue_t *wq)
> +{
> + BUG_ON(wq != ¤t->__wq);
> + wq->flags = WQ_FLAG_AVAILABLE;
> +}
Or, perhaps, current_wq_get() can simply check list_empty(->task_list)
initialized by copy_process().
This way you do not need current_wq_put(), WQ_FLAG_AVAILABLE, and you
can kill INIT_LIST_HEAD() in ___wait_event().
Honestly, I am not sure about this patch... sizeof(wait_queue_t) is not
that large, and otoh it is not good to have yet another "rarely used"
member in the already huge task_struct. But again, I won't insist.
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