Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp9898706imu; Wed, 5 Dec 2018 12:12:54 -0800 (PST) X-Google-Smtp-Source: AFSGD/UaJCtz9cQDwBc4sGUerpJaNba+5GKDAelw+r3JXW7Ebk/llXy9Ld6puE5mX0IOSQ5R481T X-Received: by 2002:a63:e545:: with SMTP id z5mr21671286pgj.195.1544040774637; Wed, 05 Dec 2018 12:12:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544040774; cv=none; d=google.com; s=arc-20160816; b=zGx46afB0+oMS1CWBouJxzL4JmzW2AoI4qfTN0hW1T3ONc91IK1rVFHtksLgxCXCge Q+tUVJ/HBL9aLILccARuK7vbVKjD7HvPb7VMWKmshsVGKSTURnAtEfenlVK6+5Vh7cH8 0mBlT0oemNtqvyH9ZZDif2luKddRiQtfwSQmtvPkNtNkiHy1JWxG9YUi0kWn2kZU88SU e9RScIg/RAeb3H+Hp2hyjWal1j+x4LDBdA65InCFOVv4jczUGciRiSDjAk1N1LWvi97T XObcMzj8aq/m84WHO1Uudh1eTPsIJGt0Hot8DYL+FDvFIxtiHYwEp/Z436nclngjtxz8 uq2Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:message-id:references :in-reply-to:subject:cc:to:from:date:content-transfer-encoding :mime-version; bh=LvW3HfelvQaMlg4UqckEyrOzrrbkvyB0nsU70lZX9Tc=; b=A+0SAYJ5abGu1JGCgWr/cOzCUzjZ/tpFGAiyLqUqgygM2KKpMJ77GgSNWqJBAlSZ6c q0qOdlDeWIZYhjTW/WuENImr4yPdvL6B48p2l41fn7JnTHgdzY+qvJcNelx8QKrQRlfG vyEjDtHfT8ad/SThLp2Wiubd1SBSH4bC5xDEEMy4sjqdHD9z98to5Dc4eYaxSd01afBu H4Yyt4kZhkNE/4viRzL12SEmI/qMZy9dMb1Hwrgk7/UNZrpky7MjiebTKyOsq0qyXqT/ 2154o9U7N/XfXqiDP4aAJRTiR0uFt7Lbkz31PHjuFwVxvOZyBZxvz02ojKLewBXemzhC 0keg== 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 3si15565069plv.258.2018.12.05.12.12.39; Wed, 05 Dec 2018 12:12:54 -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 S1728331AbeLEUL5 (ORCPT + 99 others); Wed, 5 Dec 2018 15:11:57 -0500 Received: from mx2.suse.de ([195.135.220.15]:51304 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727257AbeLEUL5 (ORCPT ); Wed, 5 Dec 2018 15:11:57 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 22BDCADC8; Wed, 5 Dec 2018 20:11:55 +0000 (UTC) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Wed, 05 Dec 2018 21:11:54 +0100 From: Roman Penyaev To: Jason Baron Cc: Alexander Viro , "Paul E. McKenney" , Linus Torvalds , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [RFC PATCH 1/1] epoll: use rwlock in order to reduce ep_poll_callback() contention In-Reply-To: References: <20181203110237.14787-1-rpenyaev@suse.de> <45bce871-edfd-c402-acde-2e57e80cc522@akamai.com> <38cc83144a2ec332dead4e21214ea068@suse.de> Message-ID: <1c214a8b9e6c06589c912b55d2ef5f37@suse.de> X-Sender: rpenyaev@suse.de User-Agent: Roundcube Webmail Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2018-12-05 17:38, Jason Baron wrote: > > I think it might be interesting for, at least testing, to see if not > grabbing > wq.lock improves your benchmarks any further? fwiw, epoll only recently > started > grabbing wq.lock bc lockdep required it. That's easy! I've just tested with the following hunk applied to my patch on top: +++ b/fs/eventpoll.c @@ -1228,7 +1228,7 @@ static int ep_poll_callback(wait_queue_entry_t *wait, unsigned mode, int sync, v break; } } - wake_up(&ep->wq); + wake_up_locked(&ep->wq); } Run time: threads w/ wq.lock w/o wq.lock ------- ---------- ----------- 8 8581ms 8602ms 16 13800ms 13715ms 32 24167ms 23817ms No big difference. According to perf the contention is on read lock and on try_to_wake_up(), the p->pi_lock, which serializes access exactly like vanished wq.lock. - 24.41% 5.39% a.out [kernel.kallsyms] [k] ep_poll_callback - 19.02% ep_poll_callback + 11.88% _raw_read_lock_irqsave + 5.74% _raw_read_unlock_irqrestore - 1.39% __wake_up_common - 1.22% try_to_wake_up + 0.98% _raw_spin_lock_irqsave -- Roman