From patchwork Sun Mar 30 06:47:29 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luis Chamberlain X-Patchwork-Id: 14032835 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 D1999C36013 for ; Sun, 30 Mar 2025 06:47:55 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 166D3280185; Sun, 30 Mar 2025 02:47:52 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id F222F28018C; Sun, 30 Mar 2025 02:47:51 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CB4A0280188; Sun, 30 Mar 2025 02:47:51 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 85B6D280189 for ; Sun, 30 Mar 2025 02:47:51 -0400 (EDT) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 96A1AC0A12 for ; Sun, 30 Mar 2025 06:47:52 +0000 (UTC) X-FDA: 83277287184.21.EF59A74 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) by imf07.hostedemail.com (Postfix) with ESMTP id 0685F40006 for ; Sun, 30 Mar 2025 06:47:50 +0000 (UTC) Authentication-Results: imf07.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=wLMgxrFk; dmarc=fail reason="No valid SPF, DKIM not aligned (relaxed)" header.from=kernel.org (policy=quarantine); spf=none (imf07.hostedemail.com: domain of mcgrof@infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=mcgrof@infradead.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1743317271; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:references:dkim-signature; bh=onIgRtrD6Nz7xiHJP06V1b9T8bhfAqun/9iFQD7ExnE=; b=JbkLjDHG+Y6GV6Nx6NWlerToPe1NV2jPzg0ROjpzmKq7s3P2Duw8beth3HoNfvepMWfqcH joTwRj+q7xbSywbfPl229ap11NjSE+BoC3pYyrkLdZOCHIIzLEGxnrQBINLQNBy9v1NFjW qrqeeWBwvNDxQeXt4eugMTqO0IvCM8c= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1743317271; a=rsa-sha256; cv=none; b=j8MXjHv3ssXnUjmBp96DTF5cmPQnHV1thta1YD0FQzHio6qg9l78TsEhlKfaY/Gh/Ee79w npgrQlomPWZ04uKok6ei2tePLyzloL0SbipcokwHN0Fi5NvoYXfr3zvzbviC/YbokuIQtE 0bBx2W6bCKLQPfDtpqu5OWguk/UOaf4= ARC-Authentication-Results: i=1; imf07.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=wLMgxrFk; dmarc=fail reason="No valid SPF, DKIM not aligned (relaxed)" header.from=kernel.org (policy=quarantine); spf=none (imf07.hostedemail.com: domain of mcgrof@infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=mcgrof@infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Sender:Content-Transfer-Encoding: MIME-Version:Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-Type: Content-ID:Content-Description:In-Reply-To:References; bh=onIgRtrD6Nz7xiHJP06V1b9T8bhfAqun/9iFQD7ExnE=; b=wLMgxrFkz6RqAFPXNuvnYeq12f 5bSya1Py6vwHH0CVpx39eIsb6/UXSOBGCbMJW8R6L3ndD9p9F2thqCvw/1YMqFLbvqJG0ty5TXQV+ JEiBumJAXM5KdYy5/BZpf2aijL5v1+dl+AN0TOGqrkmdrJiCLHggSJgUPTiSaGMCBhrohClOwL1N/ NB8V+OmymtA4tru3MvjmAqAFqEVOmXc2pEskzexy7e9GKR2n85+03P5rxLFrlrY+2vFKlOMLy12n/ gxpQhvAGP1EDtkbjD80PuOEW51KMtKo+50LGKQDA/lj1QobP65W4CjrzqEinA5wxs4JTdgrK3KGlZ eXsohaEw==; Received: from mcgrof by bombadil.infradead.org with local (Exim 4.98.1 #2 (Red Hat Linux)) id 1tymSJ-0000000Fre8-1xZf; Sun, 30 Mar 2025 06:47:39 +0000 From: Luis Chamberlain To: brauner@kernel.org, jack@suse.cz, tytso@mit.edu, adilger.kernel@dilger.ca, linux-ext4@vger.kernel.org, riel@surriel.com Cc: willy@infradead.org, hannes@cmpxchg.org, oliver.sang@intel.com, dave@stgolabs.net, david@redhat.com, axboe@kernel.dk, hare@suse.de, david@fromorbit.com, djwong@kernel.org, ritesh.list@gmail.com, linux-fsdevel@vger.kernel.org, linux-block@vger.kernel.org, linux-mm@kvack.org, gost.dev@samsung.com, p.raghav@samsung.com, da.gomez@samsung.com, mcgrof@kernel.org Subject: [PATCH 0/3] mm: move migration work around to buffer-heads Date: Sat, 29 Mar 2025 23:47:29 -0700 Message-ID: <20250330064732.3781046-1-mcgrof@kernel.org> X-Mailer: git-send-email 2.49.0 MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Queue-Id: 0685F40006 X-Rspamd-Server: rspam07 X-Stat-Signature: mger3iapx6m1h8nprfcyjy9pudfhdakg X-Rspamd-Pre-Result: action=add header; module=dmarc; Action set by DMARC X-Rspam: Yes X-HE-Tag: 1743317270-165264 X-HE-Meta: U2FsdGVkX19U6i10XThK8KIc33MHGvzj8A0R7gcHoJIt5jyBAXgvcxk4Owo7cYocDz632mx89yaVAzFH6bU8lriDvWUz9LXjBWEXvQuE0sm1/sjFFNXYaeSxZhAvuckmat+7kd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M6c+l+BrsRR6g0EVSFy2dSwptmfPD7NKOwjX67QvWzlSlR2cjJdicy6ZSxzuMZNuxthHfZy4yufSgWeyNKFSJiXeJ36g/VOrMlk6mrn3yF5PXvfd+RrxdedSTfrlVx/VxD+05XOSW01fOjp7RVloGPS1EpvcFrE9YGMYxQN7fsHzFXDZOQfN0gbTkbJ0FYR4ka+T8Z3UvkfHnkgH6HeWGNySqJJWFOS07dVwnx/IrS+3cw+4XV9GhOoa5MGV7BujQrDMaf7ldCpVxayVwA== 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: We have an eye-sore of a spin lock held during page migration which was added for a ext4 jbd corruption fix for which we have no clear public corruption data. We want to remove the spin lock on mm/migrate so to help buffer-head filesystems embrace large folios, since we can cond_resched() on large folios on folio_mc_copy(). I've managed to reproduce a corruption by just removing the spinlock and stressing ext4 with generic/750, a corruption happens after 3 hours. The spin lock was added to help ext4 jbd and other users of buffer_migrate_folio_norefs(), so the block device cache and nilfs2. This does the work to move the heuristic needed to avoid page migration to back to the buffere-head code on __find_get_block_slow() and only to users of buffer_migrate_folio_norefs(). I have ran generic/750 over 20 hours and don't see the corruption issue. I've also ran this patchset against all the following ext4 profiles on all fstests tests and have found no regression, I've published the baseline based on linux-next tag next-20250328 onto kdevops [0]. For further sanity I've also tested this patchset against blktests as well and found no regressions. ext4-defaults ext4-1k ext4-2k ext4-4k ext4-bigalloc16k-4k ext4-bigalloc32k-4k ext4-bigalloc64k-4k ext4-bigalloc1024k-4k ext4-bigalloc2048k-4k ext4-advanced-features [0] https://github.com/linux-kdevops/kdevops/commit/3ecd638e67b14162b76b733a120e6e1b55698cc9 Luis Chamberlain (3): mm/migrate: add might_sleep() on __migrate_folio() fs/buffer: avoid races with folio migrations on __find_get_block_slow() mm/migrate: avoid atomic context on buffer_migrate_folio_norefs() migration fs/buffer.c | 9 +++++++++ mm/migrate.c | 6 +++--- 2 files changed, 12 insertions(+), 3 deletions(-)