Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp7401681imu; Wed, 14 Nov 2018 17:05:26 -0800 (PST) X-Google-Smtp-Source: AJdET5fvb1lTaD+Aczt5FtWa4St2NgxemCsoOOLCva2k2Cce7e3XOAUXg9hkACZ/xvSN7PtbPXT+ X-Received: by 2002:a63:2946:: with SMTP id p67mr3906605pgp.317.1542243926737; Wed, 14 Nov 2018 17:05:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542243926; cv=none; d=google.com; s=arc-20160816; b=b6PApGD4FUM0MRG100AFJpVkYuLknObaQeRquW7qODRvlkqlEJKFSavQ+HPa9NMqzV lyZ4NjAAgqBa/qzrLigtcdTlwJNmUMjDGSijOhwoIzyjVD57sNMpfef6vmQNkhkoM8DN f7Qe+ZOp2bjtCQA+bWdPldlnQB1mQdtmKvS9eqhhUgQXBkFqfLu5IMEIVSSfwQWJXBAy sGhg2ZeNIXe7r8ZI+X14bsD++9/63WVewUfCw/IczLMpI32S2tFBdyqRsjr9mPYb5Wfa w/07nynokRX3H42/du86QWRarMgK3NUg2jnkYCbGUl54t5hQw/JF5HXpBTNQfqxcVFli gOUA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=Cl7k7js5q8i0mA70wF4DPOnOeZc666bBOByu5eMFFkI=; b=G/zjvt0PYbIAXMhqgN6Z/jnJb2BOT/gosc5Zg3eyUv8ZQZ5x9yewwQ6nW+YjvjPsAb HhOFBfd+bf+R0E5XL6prgBhHD7Up6vbTItISTg9Pq/WqDzVVicFrRyDGAjzajAjjP2OZ 0WtGxjd99XHa9WyfHJgxkIRTke8964ngHJHAHgrkd2gIuKnwsUb2sBDi7DCRbze978Io m5uAoCKhDXNyxcbB7/4Fqzg7uA3BwECGR4HvRKdGDHn+hszD4wGRZnk4RFhtNy34/RdN AahJKWHwSUF0XyFLR/axrsfo2jTQhZgj4XgVnkGs9x0e8kqa6Z3eBzFc9KyKT6El25mq Bd3Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c4-v6si24919262plo.69.2018.11.14.17.05.01; Wed, 14 Nov 2018 17:05:26 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726970AbeKOLKA (ORCPT + 99 others); Thu, 15 Nov 2018 06:10:00 -0500 Received: from mx2.suse.de ([195.135.220.15]:48722 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725895AbeKOLKA (ORCPT ); Thu, 15 Nov 2018 06:10:00 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id AE687ACB5; Thu, 15 Nov 2018 01:04:21 +0000 (UTC) Date: Wed, 14 Nov 2018 17:04:15 -0800 From: Davidlohr Bueso To: Andrew Morton Cc: jbaron@akamai.com, viro@zeniv.linux.org.uk, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Davidlohr Bueso Subject: Re: [PATCH 2/2] fs/epoll: deal with wait_queue only once Message-ID: <20181115010415.2hgkc6w35m6jvh4g@linux-r8p5> References: <20181114182532.27981-1-dave@stgolabs.net> <20181114182532.27981-2-dave@stgolabs.net> <20181114145119.2e00ce7530d32fc4958c3707@linux-foundation.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: <20181114145119.2e00ce7530d32fc4958c3707@linux-foundation.org> User-Agent: NeoMutt/20180323 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 14 Nov 2018, Andrew Morton wrote: >Why was this moved to before the ep_reset_busy_poll_napi_id() call? >That movement placed the code ahead of the block comment which serves >to explain its function. Yikes, that was a brain fart. > > >This? Which also fixes that comment and reflows it to use 80 cols. Looks good, thanks. > >--- a/fs/eventpoll.c~fs-epoll-deal-with-wait_queue-only-once-fix >+++ a/fs/eventpoll.c >@@ -1787,15 +1787,6 @@ fetch_events: > if (eavail) > goto send_events; > >- if (!waiter) { >- waiter = true; >- init_waitqueue_entry(&wait, current); >- >- spin_lock_irq(&ep->wq.lock); >- __add_wait_queue_exclusive(&ep->wq, &wait); >- spin_unlock_irq(&ep->wq.lock); >- } >- > /* > * Busy poll timed out. Drop NAPI ID for now, we can add > * it back in when we have moved a socket with a valid NAPI >@@ -1804,10 +1795,18 @@ fetch_events: > ep_reset_busy_poll_napi_id(ep); > > /* >- * We don't have any available event to return to the caller. >- * We need to sleep here, and we will be wake up by >- * ep_poll_callback() when events will become available. >+ * We don't have any available event to return to the caller. We need >+ * to sleep here, and we will be woken by ep_poll_callback() when events >+ * become available. > */ >+ if (!waiter) { >+ waiter = true; >+ init_waitqueue_entry(&wait, current); >+ >+ spin_lock_irq(&ep->wq.lock); >+ __add_wait_queue_exclusive(&ep->wq, &wait); >+ spin_unlock_irq(&ep->wq.lock); >+ } > > for (;;) { > /* >_ >