Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp384836pxk; Thu, 17 Sep 2020 05:54:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwdoQ4xt8tblPh8RYtigmj/dLnBw0v2i7kZRqNoNiddu08/hyKYWYdwe71PNqINM/yW2vT5 X-Received: by 2002:a17:906:aacb:: with SMTP id kt11mr30307524ejb.294.1600347241848; Thu, 17 Sep 2020 05:54:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600347241; cv=none; d=google.com; s=arc-20160816; b=RkuPQvoe0TzLVk/1XT8JvLnaJ6jCUZVU9vvaCLC8Z5cAiEE+LM+EYi1lo84axRiqPj RBKeGduUzFPM97oEUTXKWkE5ywa2h7xQfSo5rD6b9qzDMSL+lyUNb+w6u3XReGdAF1lc TAD4uOE6t3Iwk5xtBgx7chbmF5P8+aa77F7N6DyMKYOSp0wRnSjvN/x/tQ4AzT4GEDtY 875Fjh7G2zn59b/p99RNPbbMVdAQZeU0VI/BbAiVp8qX63OHsN5H1XmiwU1KY3LCk1ra 4S9EXZD0YnMqWOtxvOZ/1YViCnYw18yld+2yf1CnXUT2hD/psDQXkxTBWJPAaPzhypYU ynxQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=SMn65b1Ip8Ki5T6DVuzVOZrtWMuF5zN5A9x9ed/EeiM=; b=nlR/ccjm7RnJgueh5LG8kRxyjzEEBUKsZ/d3Z9Ju/fqEEKZtFZNg7bbYO/EglRQBm+ 3XViBrU51S4aUQ9nJBVM3i4vJhxBJECNFoj/PDGqY5sBdBAGEivtJhlCr0RrZCtErr2N WZ9mMKT/8FbFmhmAGZl/G/VCdNQIgTSTacQDwKaLJ73lHcfbjD6mQNsxugiFhb8rCwDZ u/Y7HpBEOEZ1sakkXCAOavZ9MIOunC2/voExsIx7tvMvHjrJJE96rwC81kG5CQcWdvy5 kvoEslegPGZU+0H6Y6b/juu/FU0qU+yxf3AJhZaqyQNG2JB7gF9Jlq4qkF+rnLxGsj4Q aIGQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=DwWnLbTR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ba30si14475165edb.44.2020.09.17.05.53.37; Thu, 17 Sep 2020 05:54:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=DwWnLbTR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727095AbgIQMwk (ORCPT + 99 others); Thu, 17 Sep 2020 08:52:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43170 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727047AbgIQMts (ORCPT ); Thu, 17 Sep 2020 08:49:48 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 886F4C06174A; Thu, 17 Sep 2020 05:48:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=SMn65b1Ip8Ki5T6DVuzVOZrtWMuF5zN5A9x9ed/EeiM=; b=DwWnLbTRETJm4THXgzUPgbIB8/ SC1nOfGV2bZdTxx+07wbcuWc8lb9XWM5j9y335xTIHsHypuOD7qzOsHC4odGHFOcCSYcH+AmL/Gq1 iblgnQWzT40BL1wzR758SRxNkHWAkom/+X+guJ+XE4+SRxL7Pwv+H6MLIf3MOqvP37LDcleJZ30gR SRHgSRXwpI2i53nFf67X4a0DdM7mMQrb8hP0qEYBz07UHcBjUP8Z7inoike2zBOMKs7EosLgAr3bx hHq3yw/cC+Rq27i5N9EwjmHWmgeVYxfdfVIuGj7soXOcmrBO4YOExyPqSVxL+Efg5o3vYJa+Ug+u6 BB1qTPIQ==; Received: from willy by casper.infradead.org with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1kItL4-0000g3-MY; Thu, 17 Sep 2020 12:48:39 +0000 Date: Thu, 17 Sep 2020 13:48:38 +0100 From: Matthew Wilcox To: Oleg Nesterov Cc: Boaz Harrosh , Hou Tao , peterz@infradead.org, Ingo Molnar , Will Deacon , Dennis Zhou , Tejun Heo , Christoph Lameter , linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, Jan Kara Subject: Re: [RFC PATCH] locking/percpu-rwsem: use this_cpu_{inc|dec}() for read_count Message-ID: <20200917124838.GT5449@casper.infradead.org> References: <20200915140750.137881-1-houtao1@huawei.com> <20200915150610.GC2674@hirez.programming.kicks-ass.net> <20200915153113.GA6881@redhat.com> <20200915155150.GD2674@hirez.programming.kicks-ass.net> <20200915160344.GH35926@hirez.programming.kicks-ass.net> <20200917120132.GA5602@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200917120132.GA5602@redhat.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Sep 17, 2020 at 02:01:33PM +0200, Oleg Nesterov wrote: > IIUC, file_end_write() was never IRQ safe (at least if !CONFIG_SMP), even > before 8129ed2964 ("change sb_writers to use percpu_rw_semaphore"), but this > doesn't matter... > > Perhaps we can change aio.c, io_uring.c and fs/overlayfs/file.c to avoid > file_end_write() in IRQ context, but I am not sure it's worth the trouble. If we change bio_endio to invoke the ->bi_end_io callbacks in softirq context instead of hardirq context, we can change the pagecache to take BH-safe locks instead of IRQ-safe locks. I believe the only reason the lock needs to be IRQ-safe is for the benefit of paths like: mpage_end_io page_endio end_page_writeback test_clear_page_writeback Admittedly, I haven't audited all the places that call end_page_writeback; there might be others called from non-BIO contexts (network filesystems?). That was the point where I gave up my investigation of why we use an IRQ-safe spinlock when basically all page cache operations are done from user context.