From patchwork Wed Mar 13 17:02:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Pankaj Raghav (Samsung)" X-Patchwork-Id: 13591598 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id D78BDC54791 for ; Wed, 13 Mar 2024 17:03:14 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6424C80043; Wed, 13 Mar 2024 13:03:14 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 5F2F9940010; Wed, 13 Mar 2024 13:03:14 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4BAE180043; Wed, 13 Mar 2024 13:03:14 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 38395940010 for ; Wed, 13 Mar 2024 13:03:14 -0400 (EDT) Received: from smtpin13.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 048091A0BFB for ; Wed, 13 Mar 2024 17:03:13 +0000 (UTC) X-FDA: 81892636308.13.FCD29F0 Received: from mout-p-101.mailbox.org (mout-p-101.mailbox.org [80.241.56.151]) by imf03.hostedemail.com (Postfix) with ESMTP id 248AE20058 for ; Wed, 13 Mar 2024 17:03:03 +0000 (UTC) Authentication-Results: imf03.hostedemail.com; dkim=pass header.d=pankajraghav.com header.s=MBO0001 header.b=YJ9ERQs9; dmarc=pass (policy=quarantine) header.from=pankajraghav.com; spf=pass (imf03.hostedemail.com: domain of me@pankajraghav.com designates 80.241.56.151 as permitted sender) smtp.mailfrom=me@pankajraghav.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1710349384; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:in-reply-to: references:dkim-signature; bh=+31zPK3/xE4cPa56xvU1Q/V7CpxqVcLqveg5PJbjK2o=; b=d1uBzysFq9Z1/ez/qiZkLxhPOUnv1EWmFlL7ajQ3xYN7hKgFktfIkr7+Vt4e1icl6Kowlt GyzIvlX0MfpiYe+b1PQiOZT4Fg+DXXxi2xV3Lc1XVj2SD4nZV34uBVBxWmLeVel6TuIzzP MuMu5ka+acV73odRy1Y+ZngYzKS2LF0= ARC-Authentication-Results: i=1; imf03.hostedemail.com; dkim=pass header.d=pankajraghav.com header.s=MBO0001 header.b=YJ9ERQs9; dmarc=pass (policy=quarantine) header.from=pankajraghav.com; spf=pass (imf03.hostedemail.com: domain of me@pankajraghav.com designates 80.241.56.151 as permitted sender) smtp.mailfrom=me@pankajraghav.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1710349384; a=rsa-sha256; cv=none; b=3GJs4a0dcQCbbxC045rnaUxYZGOWYGU6t1htFezcj+tlUaICHqARQxORDBXPOCP2WHEII6 xipyyh/6epO8lDgcD2LryREQc2EPjk882vpLNwHdYxAL+eBzVU3jA5enS7uOcbzEZPG/tG ictkzeiZ6lryTPFosZI8dpU4AJsSbD8= Received: from smtp102.mailbox.org (smtp102.mailbox.org [10.196.197.102]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-101.mailbox.org (Postfix) with ESMTPS id 4TvxfB298rz9stG; Wed, 13 Mar 2024 18:02:58 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pankajraghav.com; s=MBO0001; t=1710349378; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=+31zPK3/xE4cPa56xvU1Q/V7CpxqVcLqveg5PJbjK2o=; b=YJ9ERQs9DogTXCegYDcipGUl7yqugYFeg2RJ3nO8fuWPStMUU93hIsuUYrbTOzREBvY2py 331cM4G70BV4jZplXsArvi7jV0hGBGilWxeZ58S6ehvJgiAP6Q+eZYZ2RK5Xsl/D1mjg96 dttySmWJH/HQquMprjMLdz7MY8kVicKjKZDcCDhOEFjgZObUNdmq+fmFhcpIrGfcfUgs6S ubRh2Vj1hiJcAyOHOOhtlK1xULZDVEThlmOV/wdPnPKaT9VNUcvBHzWpp4/E7FMDFKUdz+ vwRKicE0zXxIlE2PeidxjIsVd1PCrC/T0Fh2q8VKH0Z4929vqKW1F6KIrCAFZw== From: "Pankaj Raghav (Samsung)" To: willy@infradead.org, linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org Cc: gost.dev@samsung.com, chandan.babu@oracle.com, hare@suse.de, mcgrof@kernel.org, djwong@kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, david@fromorbit.com, akpm@linux-foundation.org, Pankaj Raghav Subject: [PATCH v3 00/11] enable bs > ps in XFS Date: Wed, 13 Mar 2024 18:02:42 +0100 Message-ID: <20240313170253.2324812-1-kernel@pankajraghav.com> MIME-Version: 1.0 X-Rspam-User: X-Stat-Signature: znd7saqyib8f3bs6674hb4q73ro5abds X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 248AE20058 X-HE-Tag: 1710349383-984987 X-HE-Meta: U2FsdGVkX19tvPRvi6dTmjNUv4J5JhBJSWu70btljX9/R0V8PR3h4QqyhXGnwfqWEpmP+ZDIxOIu3+w8mR1l3LqDlArdkzyNbpeAyc+OTd11NneYatrOJQWGjgdeWaKKQp/ruWotbqJtpregeUzPRwSRrzCBFhOrY87oHxDNh0f3awupOACpjook0vZ9IMnh1O9FkNMAS/kVYcSDPTcp3tYI7I7FqmqMaUw3dcqOSR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wGpWIUurVQChgb+1OGLXR8SQTWkJUf6ULXOUTypTrV2V1Q1qOGbZcRV0QsyhPIHWNRsOW/CSOqWz0oovRGN2y6ocZ8/HNgpKa/N9HssqUwX1zHR1Tq4MRVM17i4jZqKasX//EePWE/tpwYC9YbvTza+KyVL2xQM2quTW3BwSVWPCEeaoJHrkIUKqPdHQRI1j5rMClNmM5B57AOsZ5DNSRJg== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: From: Pankaj Raghav This is the third version of the series that enables block size > page size (Large Block Size) in XFS. The context and motivation can be seen in cover letter of the RFC v1[1]. We also recorded a talk about this effort at LPC [3], if someone would like more context on this effort. A lot of emphasis has been put on testing using kdevops. The testing has been split into regression and progression. Regression testing: In regression testing, we ran the whole test suite to check for *regression on existing profiles due to the page cache changes. No regression was found with the patches added on top. *Baseline for regression was created using SOAK_DURATION of 2.5 hours and having used about 7-8 XFS test clusters to test loop fstests over 70 times. We then scraped for critical failures (crashes, XFS or page cache asserts, or hung tasks) and have reported these to the community as well.[4] Progression testing: For progression testing, we tested for 8k, 16k, 32k and 64k block sizes. To compare it with existing support, an ARM VM with 64k base page system (without our patches) was used as a reference to check for actual failures due to LBS support in a 4k base page size system. There are some common failures upstream for bs=64k that needs to be fixed[5]. There are also some tests that assumes block size < page size that needs to be fixed. I have a tree with fixes for xfstests here [6], which I will be sending soon to the list. No new failures were found with the LBS support. We've done some preliminary performance tests with fio on XFS on 4k block size against pmem and NVMe with buffered IO and Direct IO on vanilla v6.8-rc4 Vs v6.8-rc4 + these patches applied, and detected no regressions. We also wrote an eBPF tool called blkalgn [7] to see if IO sent to the device is aligned and at least filesystem block size in length. Git tree: https://github.com/linux-kdevops/linux/tree/large-block-minorder-6.8 [1] https://lore.kernel.org/lkml/20230915183848.1018717-1-kernel@pankajraghav.com/ [2] https://lore.kernel.org/linux-xfs/20240213093713.1753368-1-kernel@pankajraghav.com/ [3] https://www.youtube.com/watch?v=ar72r5Xf7x4 [4] https://github.com/linux-kdevops/kdevops/blob/master/docs/xfs-bugs.md 489 non-critical issues and 55 critical issues. We've determined and reported that the 55 critical issues have all fall into 5 common XFS asserts or hung tasks and 2 memory management asserts. [5] https://lore.kernel.org/linux-xfs/fe7fec1c-3b08-430f-9c95-ea76b237acf4@samsung.com/ [6] https://github.com/Panky-codes/xfstests/tree/lbs-fixes [7] https://github.com/iovisor/bcc/pull/4813 Changes since v2: - Simplified the filemap and readahead changes. (Thanks willy) - Removed DEFINE_READAHEAD_ALIGN. - Added minorder support to readahead_expand(). Changes since v1: - Round up to nearest min nr pages in ra_init - Calculate index in filemap_create instead of doing in filemap_get_pages - Remove unnecessary BUG_ONs in the delete path - Use check_shl_overflow instead of check_mul_overflow - Cast to uint32_t instead of unsigned long in xfs_stat_blksize Changes since RFC v2: - Move order 1 patch above the 1st patch - Remove order == 1 conditional in `fs: Allow fine-grained control of folio sizes`. This fixed generic/630 that was reported in the previous version. - Hide the max order and expose `mapping_set_folio_min_order` instead. - Add new helper mapping_start_index_align and DEFINE_READAHEAD_ALIGN - don't call `page_cache_ra_order` with min order in do_mmap_sync_readahead - simplify ondemand readahead with only aligning the start index at the end - Don't cap ra_pages based on bdi->io_pages - use `checked_mul_overflow` while calculating bytes in validate_fsb - Remove config lbs option - Add a warning while mounting a LBS kernel - Add Acked-by and Reviewed-by from Hannes and Darrick. Changes since RFC v1: - Added willy's patch to enable order-1 folios. - Unified common page cache effort from Hannes LBS work. - Added a new helper min_nrpages and added CONFIG_THP for enabling mapping_large_folio_support - Don't split a folio if it has minorder set. Remove the old code where we set extra pins if it has that requirement. - Split the code in XFS between the validation of mapping count. Put the icache code changes with enabling bs > ps. - Added CONFIG_XFS_LBS option - align the index in do_read_cache_folio() - Removed truncate changes - Fixed generic/091 with iomap changes to iomap_dio_zero function. - Took care of folio truncation scenario in page_cache_ra_unbounded() that happens after read_pages if a folio was found. - Sqaushed and moved commits around - Rebased on top of v6.8-rc4 Hannes Reinecke (1): readahead: rework loop in page_cache_ra_unbounded() Luis Chamberlain (2): filemap: allocate mapping_min_order folios in the page cache readahead: round up file_ra_state->ra_pages to mapping_min_nrpages Matthew Wilcox (Oracle) (2): mm: Support order-1 folios in the page cache fs: Allow fine-grained control of folio sizes Pankaj Raghav (6): readahead: allocate folios with mapping_min_order in readahead mm: do not split a folio if it has minimum folio order requirement iomap: fix iomap_dio_zero() for fs bs > system page size xfs: expose block size in stat xfs: make the calculation generic in xfs_sb_validate_fsb_count() xfs: enable block size larger than page size support fs/iomap/direct-io.c | 13 ++++- fs/xfs/libxfs/xfs_ialloc.c | 5 ++ fs/xfs/libxfs/xfs_shared.h | 3 ++ fs/xfs/xfs_icache.c | 6 ++- fs/xfs/xfs_iops.c | 2 +- fs/xfs/xfs_mount.c | 10 +++- fs/xfs/xfs_super.c | 10 +--- include/linux/huge_mm.h | 7 ++- include/linux/pagemap.h | 100 ++++++++++++++++++++++++++++-------- mm/filemap.c | 26 ++++++---- mm/huge_memory.c | 36 +++++++++++-- mm/internal.h | 4 +- mm/readahead.c | 101 +++++++++++++++++++++++++++++-------- 13 files changed, 247 insertions(+), 76 deletions(-) base-commit: e8f897f4afef0031fe618a8e94127a0934896aba