From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 22B3319BA6 for ; Thu, 7 Dec 2023 07:27:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=lst.de Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=bombadil.srs.infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="q8o2Ww2Q" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type: Content-ID:Content-Description:In-Reply-To:References; bh=pcip+qcShfpKiIdrtbE2krVPBRD3cmZ1GZq0o0dnBeM=; b=q8o2Ww2Q2d2/00K/DKOgyxjzNg tz0Y3gxLAOGXDMeu51iRxWdMpnefWUvbebmCHeILVJJ7bUH/RZ6Q2GeqldiqXYJeVtXOcZ8C4Xaf/ Owf7IrSBUhSGYfLPKuSs89YdFnroEx+G/aBUJY8muaqlIR1bcuXHBRYLV9AJn0QYzyfXjDaazUjQd j71vTIY4FC6O99RJdt8wCN3T4dkiH6nTK3bbhTXY3gFHEq911pDYhz/IR0F+sUN2XWVt97G56/Ete 6TpepAl1PcPbM6iu26THTIY778QOYUzijyvjepzoeEM3XQBwFhBD8aFctJ8HKkESUMOchwAzZ8AhX iUqExRsg==; Received: from [2001:4bb8:191:e7ca:4bf6:cea4:9bbf:8b02] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.96 #2 (Red Hat Linux)) id 1rB8mw-00C4wx-2I; Thu, 07 Dec 2023 07:27:15 +0000 From: Christoph Hellwig To: Christian Brauner Cc: "Darrick J. Wong" , Chandan Babu R , Zhang Yi , Ritesh Harjani , Jens Axboe , Andreas Gruenbacher , Damien Le Moal , Naohiro Aota , Johannes Thumshirn , linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-block@vger.kernel.org, gfs2@lists.linux.dev Subject: map multiple blocks per ->map_blocks in iomap writeback Date: Thu, 7 Dec 2023 08:26:56 +0100 Message-Id: <20231207072710.176093-1-hch@lst.de> X-Mailer: git-send-email 2.39.2 Precedence: bulk X-Mailing-List: gfs2@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Hi all, this series overhaults a large chunk of the iomap writeback code with the end result that ->map_blocks can now map multiple blocks at a time, at least as long as they are all inside the same folio. On a sufficiently large system (32 cores in my case) this significantly reduces CPU usage for buffered write workloads on xfs, with a very minor improvement in write bandwith that might be within the measurement tolerance. e.g. on a fio sequential write workload using io_uring I get these values (median out of 5 runs): before: cpu : usr=5.26%, sys=4.81%, ctx=4009750, majf=0, minf=13 WRITE: bw=1096MiB/s (1150MB/s), 1096MiB/s-1096MiB/s (1150MB/s-1150MB/s), io=970GiB (1042GB), run=906036-906036msec with this series: cpu : usr=4.95%, sys=2.72%, ctx=4084578, majf=0, minf=12 WRITE: bw=1111MiB/s (1165MB/s), 1111MiB/s-1111MiB/s (1165MB/s-1165MB/s), io=980GiB (1052GB), run=903234-903234msec On systems with a small number of cores the cpu usage reduction is much lower and barely visible. Changes since RFC: - various commit message typo fixes - minor formatting fixes - keep the PF_MEMALLOC check and move it to iomap_writepages - rename the offset argument to iomap_can_add_to_ioend to pos - fix missing error handling in an earlier patch (only required for bisection, no change to the end result) - remove a stray whitespace - refactor ifs_find_dirty_range a bit to make it more readable - add a patch to pass the dirty_len to the file system to make life for ext2 easier Diffstat: block/fops.c | 2 fs/gfs2/bmap.c | 2 fs/iomap/buffered-io.c | 576 +++++++++++++++++++++++-------------------------- fs/xfs/xfs_aops.c | 9 fs/zonefs/file.c | 3 include/linux/iomap.h | 19 + 6 files changed, 306 insertions(+), 305 deletions(-)