Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp10518274imu; Thu, 6 Dec 2018 02:28:27 -0800 (PST) X-Google-Smtp-Source: AFSGD/XIyrvaUxSdedOjEpb4piMIGfvNnG8W9ihxuUz2IC5CwiECtoJ+81+fD8n3aeQYzyqS7u/L X-Received: by 2002:a63:8b41:: with SMTP id j62mr3468506pge.182.1544092107619; Thu, 06 Dec 2018 02:28:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544092107; cv=none; d=google.com; s=arc-20160816; b=KurUQPH8TSzujsGVeZ+7/+0Hq+81IYTPHAfWG6x8E+K3Ov8sA0ezVCoKp1zSTTUQta h7EJz3RBLeMWrmeYjXaCweR4vevQcQxFNly4kgd5GNajChm0wabqmm0cjCQ8+xSQREV3 lDr6NoIA7Vm2Lc5W7sIz7NIUP7sXnodoYE8650rNNVB7FZwi7L1xiT1KJCFvHlkLbKbg hRq6sgchFf2CC5/PqWORz/Z+XQv0uw0WlsQ8wfghRoWKGvcCriQ9U3ppGc1qoV15PmB2 e4/BweXPNT1WXqOPgzWB+3WbpeSUGhx+Fhi5GVZi0gOYQC4EDhgyW+9A18Bv0/kx3lIn RO/w== 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=J7FVHb7qjHOJWsr7h5DxgRxcWMRe6Esrq3OWSn5Uays=; b=MERG7D+SU/YPwS2nTthcYDDSvnYwv9xrHyFdVWYng6ZO6B45cZvTKWfXWbFn0T2j10 +Kwq07vVaG6vBy/JXdxdWzehXkmZpUXbfJGvaUP7hGd0yYJrI+eEk1OfgFc2nQGnOnIV Wklr9s0b+HFHaB23WqqEBt1qK7L5/Ukhb8p0OuS2Gtk3fnmOpLoAfxg49jIckrg3CiwL OLw7gSpqHLELCTGC7ZUrudubDdt1SLVZWRhlXDOvzHBDEgxQKD3QEZ+35xnHhmZq0vRk Chf2bfzKKSl/caP8D1dSafI02P5im7/09fzBoxqhLL4ysfhH94bhcsuVDlQrg8kQiM6V +SXQ== 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 u7si23401330pfu.270.2018.12.06.02.28.11; Thu, 06 Dec 2018 02:28:27 -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 S1729259AbeLFK0B (ORCPT + 99 others); Thu, 6 Dec 2018 05:26:01 -0500 Received: from mx2.suse.de ([195.135.220.15]:39292 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727575AbeLFK0A (ORCPT ); Thu, 6 Dec 2018 05:26:00 -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 EF3FBACA4; Thu, 6 Dec 2018 10:25:58 +0000 (UTC) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Thu, 06 Dec 2018 11:25:57 +0100 From: Roman Penyaev To: Davidlohr Bueso Cc: Jason Baron , Alexander Viro , "Paul E. McKenney" , Linus Torvalds , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, akpm@linux-foundation.org Subject: Re: [RFC PATCH 1/1] epoll: use rwlock in order to reduce ep_poll_callback() contention In-Reply-To: <20181206040430.d7wjik6lt7kr75m6@linux-r8p5> References: <20181203110237.14787-1-rpenyaev@suse.de> <45bce871-edfd-c402-acde-2e57e80cc522@akamai.com> <20181206040430.d7wjik6lt7kr75m6@linux-r8p5> Message-ID: <98d200aa103fd6086c02dd620b65e961@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-06 05:04, Davidlohr Bueso wrote: > On 12/3/18 6:02 AM, Roman Penyaev wrote: > >> The main change is in replacement of the spinlock with a rwlock, which >> is >> taken on read in ep_poll_callback(), and then by adding poll items to >> the >> tail of the list using xchg atomic instruction. Write lock is taken >> everywhere else in order to stop list modifications and guarantee that >> list >> updates are fully completed (I assume that write side of a rwlock does >> not >> starve, it seems qrwlock implementation has these guarantees). > > Its good then that Will recently ported qrwlocks to arm64, which iirc > had > a bad case of writer starvation. In general, qrwlock will maintain > reader > to writer ratios of acquisitions fairly well, but will favor readers > over > writers in scenarios where when too many tasks (more than ncpus). Thanks for noting that. Then that should not be a problem, since number of parallel ep_poll_callback() calls can't be greater then number of CPUs because of the wq.lock which is taken by the caller of ep_poll_callback(). BTW, did someone make any estimations how much does the latency on the write side increase if the number of readers is greater than CPUs? -- Roman