Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1715900imu; Wed, 12 Dec 2018 03:06:48 -0800 (PST) X-Google-Smtp-Source: AFSGD/WE4pISe2BPd5NroXN7jmqsv9IegFmwbL6sNoc9DGV7PSmsBGq71loCTCOovuCvE6ZkZtIH X-Received: by 2002:a63:1b48:: with SMTP id b8mr17967872pgm.187.1544612807979; Wed, 12 Dec 2018 03:06:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544612807; cv=none; d=google.com; s=arc-20160816; b=QyobkBPNsPmLTN8X/1o371j7WN7+XewtNwY/zj4JKSWuvSOH7eZKdXxPLgRWdf9ntA E+SDLbqlaMiZRLoHiMNrVXY5SwOolGOR6/ZkAf93uM5hHDHggglqFVFl1KNMxgwNicBD mfPrCPbLc5PZWYF1AG1hJtMNWXGl0z1ToLnwea7SY6ow7VIWZpuXALq6qeajQhmCpZSZ 1SgsxVcj42b1BENGI5EPkFA+X6q4IX7kfIKkepyE638Qqus8J0JSZQLvG+Tx3ebZS5LA j7WEEXVtaSlJyhLg6D5BpS0BUfqWAMObw8jRyznd03OoxjK14QNa6RlergpTiSYIZUrX jRpg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:content-transfer-encoding:mime-version :message-id:date:subject:cc:from; bh=QuVDYjp6wjRujUrJt9tH20UbsKQBnsK/7Ph3PVP3d1E=; b=k6wR5N2zfs4ReyYAcaGSr0VdIxlQ67eqnkcg3t+rF29yfy7/AlBBgRtMAuZ3cIgeFr G32yhi7qmBHynkOq1nWvKbTQWaRokGXn4VuNwTTKwQLQ8ibiKa5r4N+prM0M9W/dI6Rw SfoYF3F1AyOOO5kGj7Cd24livWaIQc7xSRCyIyGJldQNSP8DjLuoqm3l4OWb/gnkvOfj q/Pxtm6C4OKV79CalJe9iiukxmIl+lb84WRueUEdFS61X0+JQoy5TcyjQqwbiYEmKoB/ C3s34jOIbC64WSX2rqJ3jlIYLm32DGKB2ChDze+nRqmp985I9fOUBBXqwu19neU4esjx h+OQ== 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 s5si14166373plp.139.2018.12.12.03.06.33; Wed, 12 Dec 2018 03:06:47 -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 S1727164AbeLLLEd (ORCPT + 99 others); Wed, 12 Dec 2018 06:04:33 -0500 Received: from mx2.suse.de ([195.135.220.15]:46020 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726856AbeLLLEc (ORCPT ); Wed, 12 Dec 2018 06:04:32 -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 63DC2ACBA; Wed, 12 Dec 2018 11:04:31 +0000 (UTC) From: Roman Penyaev Cc: Roman Penyaev , Davidlohr Bueso , Jason Baron , Al Viro , "Paul E. McKenney" , Linus Torvalds , Andrew Morton , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 0/3] use rwlock in order to reduce ep_poll_callback() contention Date: Wed, 12 Dec 2018 12:03:54 +0100 Message-Id: <20181212110357.25656-1-rpenyaev@suse.de> X-Mailer: git-send-email 2.19.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit To: unlisted-recipients:; (no To-header on input) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The last patch targets the contention problem in ep_poll_callback(), which can be very well reproduced by generating events (write to pipe or eventfd) from many threads, while consumer thread does polling. The following are some microbenchmark results based on the test [1] which starts threads which generate N events each. The test ends when all events are successfully fetched by the poller thread: spinlock ======== threads events/ms run-time ms 8 6402 12495 16 7045 22709 32 7395 43268 rwlock + xchg ============= threads events/ms run-time ms 8 10038 7969 16 12178 13138 32 13223 24199 According to the results bandwidth of delivered events is significantly increased, thus execution time is reduced. This series is based on linux-next/akpm and differs from RFC in that additional cleanup patches and explicit comments have been added. [1] https://github.com/rouming/test-tools/blob/master/stress-epoll.c Roman Penyaev (3): epoll: make sure all elements in ready list are in FIFO order epoll: loosen irq safety in ep_poll_callback() epoll: use rwlock in order to reduce ep_poll_callback() contention fs/eventpoll.c | 127 ++++++++++++++++++++++++++++++++++++------------- 1 file changed, 93 insertions(+), 34 deletions(-) Signed-off-by: Roman Penyaev Cc: Davidlohr Bueso Cc: Jason Baron Cc: Al Viro Cc: "Paul E. McKenney" Cc: Linus Torvalds Cc: Andrew Morton Cc: linux-fsdevel@vger.kernel.org Cc: linux-kernel@vger.kernel.org -- 2.19.1