Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753992AbZD2JRt (ORCPT ); Wed, 29 Apr 2009 05:17:49 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751580AbZD2JRg (ORCPT ); Wed, 29 Apr 2009 05:17:36 -0400 Received: from mx3.mail.elte.hu ([157.181.1.138]:49141 "EHLO mx3.mail.elte.hu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751490AbZD2JRf (ORCPT ); Wed, 29 Apr 2009 05:17:35 -0400 Date: Wed, 29 Apr 2009 11:16:37 +0200 From: Ingo Molnar To: Eric Dumazet Cc: linux kernel , Andi Kleen , David Miller , cl@linux.com, jesse.brandeburg@intel.com, netdev@vger.kernel.org, haoki@redhat.com, mchan@broadcom.com, davidel@xmailserver.org Subject: Re: [PATCH] poll: Avoid extra wakeups in select/poll Message-ID: <20090429091637.GA29874@elte.hu> References: <49F3308B.1030507@cosmosbay.com> <20090426.020411.157511269.davem@davemloft.net> <49F43B8F.2050907@cosmosbay.com> <87ab60rh8t.fsf@basil.nowhere.org> <49F71B63.8010503@cosmosbay.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <49F71B63.8010503@cosmosbay.com> User-Agent: Mutt/1.5.18 (2008-05-17) X-ELTE-VirusStatus: clean X-ELTE-SpamScore: -1.5 X-ELTE-SpamLevel: X-ELTE-SpamCheck: no X-ELTE-SpamVersion: ELTE 2.0 X-ELTE-SpamCheck-Details: score=-1.5 required=5.9 tests=BAYES_00 autolearn=no SpamAssassin version=3.2.3 -1.5 BAYES_00 BODY: Bayesian spam probability is 0 to 1% [score: 0.0000] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1103 Lines: 32 * Eric Dumazet wrote: > @@ -418,8 +429,16 @@ int do_select(int n, fd_set_bits *fds, struct timespec *end_time) > if (file) { > f_op = file->f_op; > mask = DEFAULT_POLLMASK; > - if (f_op && f_op->poll) > + if (f_op && f_op->poll) { > + if (wait) { > + wait->key = POLLEX_SET; > + if (in & bit) > + wait->key |= POLLIN_SET; > + if (out & bit) > + wait->key |= POLLOUT_SET; > + } > mask = (*f_op->poll)(file, retval ? NULL : wait); > + } > fput_light(file, fput_needed); > if ((mask & POLLIN_SET) && (in & bit)) { > res_in |= bit; Please factor this whole 'if (file)' branch out into a helper. Typical indentation levels go from 1 to 3 tabs - 4 should be avoided if possible and 5 is pretty excessive already. This goes to eight. Ingo -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/