Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp3262887imm; Fri, 20 Jul 2018 13:07:11 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcrGJXUFMei5RCzoEmkLsU9EmNPhEmtXo6YkMeSZQdUmWX/hiEHVXMMk5nbgmkidPCzC3XT X-Received: by 2002:a62:98d6:: with SMTP id d83-v6mr3568602pfk.186.1532117230967; Fri, 20 Jul 2018 13:07:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532117230; cv=none; d=google.com; s=arc-20160816; b=IGWUzuILUn+9SHtZdMjKcYrz+1eqwR660Fjt9+N+T9KlgI89x4aomNCBn4oaBjpJk1 SvdgaqzyDP/oWy1cD9VMyuuTq4+GjbBVyr/jZEPZ7RqQjNdXzffLt/QiQh18df6zuXbX YNAmsIfKg/hCG4/4OtuG1mOD332skCk/Sog24/ynOZ7n3UnQPrGzbWn9NNZRDEfj9lAg guhKzinGkUYNSeGpuH5hvdVCse0gOUaTgmYSYqfq+vIZipeRtGFUb4j1ZCE3/5W25RUU m372tr4tE11mh/mI8/XDpLUYR9nJKtyMgqykGXLVlOxknruNyshP9yKxl5Zn8A7m4cvH Mfbw== 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=DNFN/ducJiL7oWERHb7rbpNERakMQp0P93kEBGq3FVQ=; b=EIim7YdPugEbd5oP3l7Smkbx5Is1eM5dNTB6AGParbG56/zA7Ox+SDfA+8pLw4cAIf fQTgx1SjJZeS9wsZJlDwbglncYh1wSplxsXCxppUDn/DK5XYzX9NQWm5lx9vRo+LO9sx C/KlNDfK5D66YOP3qCbc1MEZXzb0RgMfLsGMTFCZ64wFIbVVgVHYSaxyYFJxJAdUeO8v dgU2eO5xJ91Hu9oK2JNutrKDSZSFHO9j/WVuTZS753skKMAluBvK8fUtFin5NiqeLEUR wJ5EeJ/pwkvT1JvpcEvGz1LpjWuR4piJ7EmR3L/mtpZfVNPg6Qy4pcvJ9IL0RwvmEqEK zeBA== 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 u19-v6si2621897pgb.629.2018.07.20.13.06.56; Fri, 20 Jul 2018 13:07:10 -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 S1728221AbeGTUz6 (ORCPT + 99 others); Fri, 20 Jul 2018 16:55:58 -0400 Received: from mx2.suse.de ([195.135.220.15]:53600 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727412AbeGTUzz (ORCPT ); Fri, 20 Jul 2018 16:55:55 -0400 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 4E340ADAB; Fri, 20 Jul 2018 20:06:06 +0000 (UTC) Date: Fri, 20 Jul 2018 13:05:59 -0700 From: Davidlohr Bueso To: Andrew Morton Cc: jbaron@akamai.com, viro@zeniv.linux.org.uk, linux-kernel@vger.kernel.org, Peter Zijlstra Subject: Re: [PATCH -next 0/2] fs/epoll: loosen irq safety when possible Message-ID: <20180720200559.27nc7j2rrxpy5p3n@linux-r8p5> References: <20180720172956.2883-1-dave@stgolabs.net> <20180720124212.7260d76d83e2b8e5e3349ea5@linux-foundation.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: <20180720124212.7260d76d83e2b8e5e3349ea5@linux-foundation.org> User-Agent: NeoMutt/20170912 (1.9.0) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 20 Jul 2018, Andrew Morton wrote: >On Fri, 20 Jul 2018 10:29:54 -0700 Davidlohr Bueso wrote: > >> Hi, >> >> Both patches replace saving+restoring interrupts when taking the >> ep->lock (now the waitqueue lock), with just disabling local irqs. >> This shows immediate performance benefits in patch 1 for an epoll >> workload running on Xen. > >I'm surprised. Is spin_lock_irqsave() significantly more expensive >than spin_lock_irq()? Relative to all the other stuff those functions >are doing? If so, how come? Some architectural thing makes >local_irq_save() much more costly than local_irq_disable()? For example, if you compare x86 native_restore_fl() to xen_restore_fl(), the cost of Xen is much higher. And at least considering ep_scan_ready_list(), the lock is taken/released twice, to deal with the ovflist when the ep->wq.lock is not held. To the point that it yields measurable results (see patch 1) across incremental thread counts. > >> The main concern we need to have with this >> sort of changes in epoll is the ep_poll_callback() which is passed >> to the wait queue wakeup and is done very often under irq context, >> this patch does not touch this call. > >Yeah, these changes are scary. For the code as it stands now, and for >the code as it evolves. Yes which is why I've been throwing lots of epoll workloads at it. > >I'd have more confidence if we had some warning mechanism if we run >spin_lock_irq() when IRQs are disabled, which is probably-a-bug. But >afaict we don't have that. Probably for good reasons - I wonder what >they are? > >> Patches have been tested pretty heavily with the customer workload, >> microbenchmarks, ltp testcases and two high level workloads that >> use epoll under the hood: nginx and libevent benchmarks. >> >> Details are in the individual patches. >> >> Applies on top of mmotd. > >Please convince me about the performance benefits? As for number I only have patch 1. Thanks, Davidlohr