From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933265Ab3GWQPK (ORCPT ); Tue, 23 Jul 2013 12:15:10 -0400 Received: from mx1.redhat.com ([209.132.183.28]:14550 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932326Ab3GWQPI (ORCPT ); Tue, 23 Jul 2013 12:15:08 -0400 Organization: Red Hat UK Ltd. Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SI4 1TE, United Kingdom. Registered in England and Wales under Company Registration No. 3798903 From: David Howells In-Reply-To: <20130723120258.01024e81@tlielax.poochiereds.net> References: <20130723120258.01024e81@tlielax.poochiereds.net> <20130723154924.24306.42326.stgit@warthog.procyon.org.uk> To: Jeff Layton Cc: dhowells@redhat.com, torvalds@linux-foundation.org, linux-nfs@vger.kernel.org, linux-kernel@vger.kernel.org, linux-cachefs@redhat.com, Milosz Tanski , Yacine Belkadi Subject: Re: [PATCH] Fix __wait_on_atomic_t() to call the action func if the counter != 0 Date: Tue, 23 Jul 2013 17:15:02 +0100 Message-ID: <24785.1374596102@warthog.procyon.org.uk> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Jeff Layton wrote: > > @@ -333,7 +333,8 @@ int __wait_on_atomic_t(wait_queue_head_t *wq, struct wait_bit_queue *q, > > prepare_to_wait(wq, &q->wait, mode); > > val = q->key.flags; > > if (atomic_read(val) == 0) > > - ret = (*action)(val); > > + break; > > + ret = (*action)(val); > > } while (!ret && atomic_read(val) != 0); > > nit: can you now eliminate the check for "val" in the while condition? > It doesn't look like it harms anything, but eliminating it would > probably simplify the code slightly... Its presence means that we don't have to call prepare_to_wait() again if val became 0. David