Received: by 2002:a05:6a10:c604:0:0:0:0 with SMTP id y4csp3712891pxt; Tue, 10 Aug 2021 09:36:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzopLMpaLkP3+TxmJ/oxRX8V1uucvZeMNRdBzZDyxkZxIB38GvyiQsDv2LGqkZ5hRieKCVz X-Received: by 2002:a17:907:990d:: with SMTP id ka13mr28827937ejc.392.1628613402662; Tue, 10 Aug 2021 09:36:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628613402; cv=none; d=google.com; s=arc-20160816; b=dQh1wT1Kw0qXXFiV2g7zINjcxals7YEgHM/D8wzso5wHQEUlBPRnPQ4A55/804+HJV UrOw556YZ8K/Df3LeBrYHc01dMpPf8We6mwyPAfCL6+Gt8+0EjP3WTeGl2xvv1SM0vf8 bUN5PsFYKQrheSG8KPWoBTfN40PpQhYl6vI9/lS1goin4sZHJtvz4oUMqS7rruIZ7EjE zmROwICdteemVDymZuTMxIKkQE60rXriessRarlQ87axOdosJf1kFbs2DRpknhMXY1cF 5E2QIx14jAKN7848LFt4HTvJegwt1sObCQP5YSewMPlusgj6saxDijdF2+o9pbCgRv1C mU7w== 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=5o2X/hCLV7cpukH2oc7YrdoxcLinZ80KA7F0XExRIIQ=; b=xgbkZ5t1aMxM/aFqSz8d5/UutqxWnEXuadhw4M1KN1kEgKLdGR2dsngD+BlxZoLAc4 bQa4+m9MjpLCCBtq9//3qnZuWen8bST0YbkP6/ngYPhOAZMMAyCxYUMyHHj7jc4qY9rb hlP6CsCJ9QSLRQkrtuZXW280uXdsTWgH/iQLR8Rdc0M7citCpMHlTCyqB+0TwlnHEv9W qRf2xtHqtqz+dGvyofkkZYlxQrBG+9RbrmSZY+cSCRFTIfCFzKaFBwm3FJy3jfE4FTb8 tpo/HVABSMPrTydPaD1Bzx3B1a7xrluoOHtQBFWiN5gKrYHqlCZwmruGb9rTqixxgN7Y f7Lg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=G7JNfDn2; 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 b9si6673521ejv.423.2021.08.10.09.36.15; Tue, 10 Aug 2021 09:36:42 -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=G7JNfDn2; 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 S242106AbhHJOJo (ORCPT + 99 others); Tue, 10 Aug 2021 10:09:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59576 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241805AbhHJOJb (ORCPT ); Tue, 10 Aug 2021 10:09:31 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 174E2C0613D3; Tue, 10 Aug 2021 07:09:06 -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=5o2X/hCLV7cpukH2oc7YrdoxcLinZ80KA7F0XExRIIQ=; b=G7JNfDn2E3Yqko3QMw5vmP2NW2 ioSwGdje9u+wA6M5Y0AlzbnP1x+YGPiFcjLq8UK0nhfFiuM9R3jdBoVvhn4td7tEUywlRmqE0QwUf 5OY2S869MiBiQMcecsZVtd9qtk4sotUTXTbKqw+1xVDaKrrsSOFhLboCKmfaJR8cMyf4/e1JtpkhM by1+c+X6twREHyKgD2J1Lnul+zwZJDAUu1jgiyJhLBh4QyA0Y4SNJ0+G2J3sCjwRyRCnihFH0fq/v KSrWIiphg7cUXidSSULbagNVzERZ9yvY4Kf44hNXeBZkPnadyyFp+LFYTbL99Ncw0QB3eBCC+wXqC VSIWKBDw==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1mDSQX-00CC2G-5a; Tue, 10 Aug 2021 14:08:27 +0000 Date: Tue, 10 Aug 2021 15:08:21 +0100 From: Matthew Wilcox To: Christoph Hellwig Cc: Vishal Moola , linux-block@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [RFC PATCH] Page Cache Allowing Hard Interrupts Message-ID: References: <20210730213630.44891-1-vishal.moola@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Aug 10, 2021 at 01:33:28PM +0100, Christoph Hellwig wrote: > On Tue, Aug 10, 2021 at 01:09:45PM +0100, Matthew Wilcox wrote: > > On Tue, Aug 10, 2021 at 09:15:28AM +0100, Christoph Hellwig wrote: > > > Stupid question, but where do we ever do page cache interaction from > > > soft irq context? > > > > test_clear_page_writeback() happens in _some_ interrupt context (ie > > the io completion path). We had been under the impression that it was > > always actually softirq context, and so this patch was safe. However, > > it's now clear that some drivers are calling it from hardirq context. > > Writeback completions are clearly not latency sensitive and so can > > be delayed from hardirq to softirq context without any problem, so I > > think fixing this is just going to be a matter of tagging requests as > > "complete in softirq context" and ensuring that blk_mq_raise_softirq() > > is called for them. > > > > Assuming that DIO write completions _are_ latency-sensitive, of course. > > Maybe all write completions could be run in softirqs. > > I really don't really see any benefit in introducing softirqs into > the game. The benefit is not having to disable interrupts while manipulating the page cache, eg delete_from_page_cache_batch(). > If we want to simplify the locking and do not care too much > about latency, we should just defer to workqueue/thread context. It's not a bad idea. I thought BH would be the better place for it because it wouldn't require scheduling in a task. If we are going to schedule in a task though, can we make it the task which submitted the I/O (assuming it still exists), or do we not have the infrastructure for that? > For example XFS already does that for all writeback except for pure > overwrites. Those OTOH can be latency critical for O_SYNC writes, but > you're apparently looking into that already. To my mind if you've asked for O_SYNC, you've asked for bad performance. The writethrough improvement that I'm working on skips dirtying the page, but still marks the page as writeback so that we don't submit overlapping writes to the device. The O_SYNC write will wait for the writeback to finish, so it'll still be delayed by one additional scheduling event ... unless we run the write completion in the context of this task.