Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp644588imm; Fri, 22 Jun 2018 02:52:11 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLs9dpqxHE4iCLAWCYcJOSTMM1FY+nTI/qI4HUd38ZixknGS2p4NLjX9YAY3LRM6zhtAx9f X-Received: by 2002:a62:c20e:: with SMTP id l14-v6mr969584pfg.185.1529661131483; Fri, 22 Jun 2018 02:52:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529661131; cv=none; d=google.com; s=arc-20160816; b=FmChpRM8wPMg/OnA4UvaR/45Vnz7ZYtN6xSYlpsOVzKG1Jwdst/+yw2wwKhhuAd3bk 840GgQCt8pSNo0Bh8Kf4RfIJmqv+skRKptAVRv1huGKOfDuZmZ0XvUdnjTi1dirIepGf xMX11z3csJk5lyoMcWER+oufxIwaskxQ17fjiMpy6SSFF6OG4eGupTpVvF6WpV0t2w9t ElKsz18mvAfply6JyyvqnudrmPMyTmUZuk2W7wNqqrzBDoHxcT6OmnvOO7s5Pt/l7odO ASCpoo7qiDfRNHPNmNsCkoM3o/5hfn5V13W8MWFzY4UrJgbonvunirdaf0kh0oxULJyF qBCA== 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:arc-authentication-results; bh=Exh9kKGI5JUir1wem761l2jPXTndqf+DBK8WXvZpjEU=; b=MpXvm6v9iSDAbJqI4+hKOdwLu8SD23/NI1pLllzvLsMpjIN44hw/IBDDzpiCGeUBgk 8l2Rbxb8XM6At47h14Y1xHvyDd5lk29orA3NM/uobzAo52YcsSXvi22ZtsvB1egEL6Xe q6RC9VR//hrUfrO8BK3L/5YZ3YFrGTO2fuNNqsHTBGEicUg5Y0SK7KSNu7tjHuNYd7tz bJf9auZs8mQPyC/f8OS9cIpt9OmLFoMLz+tfQhbo+wXUUGyqLPDZbwYY4jYBDiWkj3Ym en4zuA7uAEh3zjuJFbo7LPJ8a8HY1G5cdIv+Wt9+i/o8CTWUCU6fhtJZr/TTfTuL+woL DGPg== 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 m62-v6si7316209pfa.45.2018.06.22.02.51.57; Fri, 22 Jun 2018 02:52:11 -0700 (PDT) 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 S1754071AbeFVJuv (ORCPT + 99 others); Fri, 22 Jun 2018 05:50:51 -0400 Received: from verein.lst.de ([213.95.11.211]:55640 "EHLO newverein.lst.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751242AbeFVJuu (ORCPT ); Fri, 22 Jun 2018 05:50:50 -0400 Received: by newverein.lst.de (Postfix, from userid 2407) id D8C9668E45; Fri, 22 Jun 2018 12:00:14 +0200 (CEST) Date: Fri, 22 Jun 2018 12:00:14 +0200 From: Christoph Hellwig To: Linus Torvalds Cc: kernel test robot , Al Viro , Christoph Hellwig , Greg Kroah-Hartman , "Darrick J. Wong" , Linux Kernel Mailing List , LKP Subject: Re: [lkp-robot] [fs] 3deb642f0d: will-it-scale.per_process_ops -8.8% regression Message-ID: <20180622100014.GA12425@lst.de> References: <20180622082752.GX11011@yexl-desktop> <20180622095608.GA12263@lst.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180622095608.GA12263@lst.de> User-Agent: Mutt/1.5.17 (2007-11-01) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org And a version with select() also covered: --- From 317159003ae28113cf759c632b161fb39192fe3c Mon Sep 17 00:00:00 2001 From: Christoph Hellwig Date: Fri, 22 Jun 2018 11:36:26 +0200 Subject: fs: optimize away ->_qproc indirection for poll_mask based polling Signed-off-by: Christoph Hellwig --- fs/select.c | 38 +++++++++++++++++++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/fs/select.c b/fs/select.c index bc3cc0f98896..2c9d81892509 100644 --- a/fs/select.c +++ b/fs/select.c @@ -528,6 +528,24 @@ static int do_select(int n, fd_set_bits *fds, struct timespec64 *end_time) wait_key_set(wait, in, out, bit, busy_flag); mask = vfs_poll(f.file, wait); + if (f.file->f_op->poll) { + mask = f.file->f_op->poll(f.file, wait); + } else if (file_has_poll_mask(f.file)) { + struct wait_queue_head *head; + + head = f.file->f_op->get_poll_head(f.file, wait->_key); + if (!head) { + mask = DEFAULT_POLLMASK; + } else if (IS_ERR(head)) { + mask = EPOLLERR; + } else { + if (wait->_qproc) + __pollwait(f.file, head, wait); + mask = f.file->f_op->poll_mask(f.file, wait->_key); + } + } else { + mask = DEFAULT_POLLMASK; + } fdput(f); if ((mask & POLLIN_SET) && (in & bit)) { @@ -845,7 +863,25 @@ static inline __poll_t do_pollfd(struct pollfd *pollfd, poll_table *pwait, /* userland u16 ->events contains POLL... bitmap */ filter = demangle_poll(pollfd->events) | EPOLLERR | EPOLLHUP; pwait->_key = filter | busy_flag; - mask = vfs_poll(f.file, pwait); + if (f.file->f_op->poll) { + mask = f.file->f_op->poll(f.file, pwait); + } else if (file_has_poll_mask(f.file)) { + struct wait_queue_head *head; + + head = f.file->f_op->get_poll_head(f.file, pwait->_key); + if (!head) { + mask = DEFAULT_POLLMASK; + } else if (IS_ERR(head)) { + mask = EPOLLERR; + } else { + if (pwait->_qproc) + __pollwait(f.file, head, pwait); + mask = f.file->f_op->poll_mask(f.file, pwait->_key); + } + } else { + mask = DEFAULT_POLLMASK; + } + if (mask & busy_flag) *can_busy_poll = true; mask &= filter; /* Mask out unneeded events. */ -- 2.17.1