From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S936530AbdJQPih (ORCPT ); Tue, 17 Oct 2017 11:38:37 -0400 Received: from mx2.suse.de ([195.135.220.15]:51521 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934161AbdJQPiV (ORCPT ); Tue, 17 Oct 2017 11:38:21 -0400 Date: Tue, 17 Oct 2017 08:37:37 -0700 From: Davidlohr Bueso To: Jason Baron Cc: akpm@linux-foundation.org, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, Alexander Viro , Salman Qazi Subject: Re: [PATCH] epoll: avoid calling ep_call_nested() from ep_poll_safewake() Message-ID: <20171017153737.kvrzzhvy55ocgb7u@linux-n805> References: <1507920533-8812-1-git-send-email-jbaron@akamai.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: <1507920533-8812-1-git-send-email-jbaron@akamai.com> User-Agent: NeoMutt/20170421 (1.8.2) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 13 Oct 2017, Jason Baron wrote: >The ep_poll_safewake() function is used to wakeup potentially nested epoll >file descriptors. The function uses ep_call_nested() to prevent entering >the same wake up queue more than once, and to prevent excessively deep >wakeup paths (deeper than EP_MAX_NESTS). However, this is not necessary >since we are already preventing these conditions during EPOLL_CTL_ADD. This >saves extra function calls, and avoids taking a global lock during the >ep_call_nested() calls. This makes sense. > >I have, however, left ep_call_nested() for the CONFIG_DEBUG_LOCK_ALLOC >case, since ep_call_nested() keeps track of the nesting level, and this is >required by the call to spin_lock_irqsave_nested(). It would be nice to >remove the ep_call_nested() calls for the CONFIG_DEBUG_LOCK_ALLOC case as >well, however its not clear how to simply pass the nesting level through >multiple wake_up() levels without more surgery. In any case, I don't think >CONFIG_DEBUG_LOCK_ALLOC is generally used for production. This patch, also >apparently fixes a workload at Google that Salman Qazi reported by >completely removing the poll_safewake_ncalls->lock from wakeup paths. I'm a bit curious about the workload (which uses lots of EPOLL_CTL_ADDs) as I was tackling the nested epoll scaling issue with loop and readywalk lists in mind. > >Signed-off-by: Jason Baron >Cc: Alexander Viro >Cc: Andrew Morton >Cc: Salman Qazi Acked-by: Davidlohr Bueso >--- > fs/eventpoll.c | 47 ++++++++++++++++++----------------------------- > 1 file changed, 18 insertions(+), 29 deletions(-) Yay for getting rid of some of the callback hell. Thanks, Davidlohr