From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-qv1-f53.google.com (mail-qv1-f53.google.com [209.85.219.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1757E3590C3 for ; Fri, 26 Jun 2026 18:22:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.53 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782498155; cv=none; b=tr8u6pLUa2gpSCR7vX0GbWJ0j1nRrRBnuKcj88SNlo35fewuS8gc30HEDklNILRUO5osStaEBFKIeY3wqmng60Xg/6l8VUuSsCh+9VeA+P3AE6DughSF6TtUXNso5NZzjFIKzUC49hAs9QDbrL1m/r5lp7qsAtRNFPL7QINJ7ZM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782498155; c=relaxed/simple; bh=hhkCYao/BUSFKVyjVASKS1Y80bj+WMH+MXStSHwDaSM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=kZi62xV6G+55dzRKKEbBoxbQvG3KS/OVf4UB9EQrUPn6qnRNsB8t94fC0zZjBBFNe1jWRyyrFVwR6mnbbqS4pmZ6K8QTUUeFunWCv68pswXtjueKyM3ChZpdBo8+kqx7pqvfJuJHv6UoUVid1D/yEilb23+d7iOW09fNtHoYZc8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=cmpxchg.org; spf=pass smtp.mailfrom=cmpxchg.org; dkim=pass (2048-bit key) header.d=cmpxchg.org header.i=@cmpxchg.org header.b=pCzykbhW; arc=none smtp.client-ip=209.85.219.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=cmpxchg.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=cmpxchg.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=cmpxchg.org header.i=@cmpxchg.org header.b="pCzykbhW" Received: by mail-qv1-f53.google.com with SMTP id 6a1803df08f44-8dc87f7d68bso13762696d6.3 for ; Fri, 26 Jun 2026 11:22:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cmpxchg.org; s=google; t=1782498153; x=1783102953; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=xNnQvDlpVbdSBzQMZkREgFp+pXIUFVREki7kHSxzZi4=; b=pCzykbhWcJHfY1MrcZu1CZ1POsxGNh+YHpRKA+NsscGpl/4KIexOk+tgwx8Df/NyST GaXvGv5V3Rjxbf6QNkESobnP4EBS5sv5Fpr0Dt+W+utzSOoX4cpSFOukU7FWfWDp+6sb opIsqcoH1adiFSNzrllKCCbefQXGlCPYLCOGSokQ3vADPgidsyVhnEvHUjXRLk2mfneR GdRsmDZEJ84K01Fp07PmAo8t00Jww9WgGTmcfAt/sMP+giHiw8yNw1U5thBbEYUXT55b G53nBWd5rMGf1AjiswssiGUqmwWeGNkNXBxPwvC8QLdanxn//la9pRG9dz1l+oCMejhC 7tkg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1782498153; x=1783102953; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=xNnQvDlpVbdSBzQMZkREgFp+pXIUFVREki7kHSxzZi4=; b=bXxLhx+qSfIQ7JXbga2pGktLn8hWt+XxkrXcl9/qC3/5qKe9aG1wclYM9WU2sP1MrA g3Yy9kpnjb5euP+yePoMO/FcvDnnSGOnBO2DXckjeQn6CTt+Gvlj8catijppB1VKF2+3 CZU/QvMCDznMcJnHdhw7UlJRf23PS7crN3Snk/8UEiDLiX1sZmo1l3IAmYGiZuvPMUG/ pTFl91Noozl7knqR3pIUkMCclrLFtFBUuhK9r3PARlee4ydIsKw277fb+kbsmaRjHQNy 62IIQZ18JaISC9JjgVpatTd1ErxYoUVCjoPYvgsORJpR62YI5TXb1Co2r0JlDzhMkP+a tLiQ== X-Forwarded-Encrypted: i=1; AHgh+RoDihxxwn08kHhgdGU1bqLN17w0L+yloAFUSnR276aH6xY3HIMxuQ/em5kAxIxAURqLzEiZ2EKLRbSDQ8o=@vger.kernel.org X-Gm-Message-State: AOJu0Yx2feFbDVDw/BUmz1E5yY5Rp9ryacq2jW3uNuEN04JuAEsQ0swu 9EYuMjc6f4+q8JQ+lNA2XB5rw2RKydqtDX0P9L5o0kxlKNEpEOem6x4kI7ETeEIQ26w= X-Gm-Gg: AfdE7cloZjnTFG0ct3vZiN5b8GQtMCn3nG99EyGtFoc0w6tJ7pWLNxaNKQSA5jVboAE uLopOzghXWjIH+p1bjF9p8x8NXZ68BqmWPeyxeXtLhRGCaZkwSuwTH5ScNvFI9WOftHi5Kju+eY /uKW/o3h2tKea4jS1lXySRyrjJod77PgCkrdkdfTaJdvLWCJciC6XEpWpPJmhKmptiCVh13ya5W XOPDXTQMd5LqkKw9F+yJSbEOVVhEHWAw3FWY1BJtZj2JOmXnAQyGDNhRRCxxDVnB2r4NCy3yaj+ GRCqRNeMmjzwZnhNsceEMYFz/rrWUphNNaYneG2bJewsOw9XS9A11lzwyMhG6P8x7VKG4dEa/ki 7J5VdF1XeXdHmC/LOrPUewgYakmWAVJ9o+kQEZvQLj06HJJglXwfGZ6jykgPo+lgYmd69XYyiso w4foRTForhwEY= X-Received: by 2002:a05:6214:40a:b0:8ca:2559:8886 with SMTP id 6a1803df08f44-8e6d88d9babmr138437776d6.13.1782498152835; Fri, 26 Jun 2026 11:22:32 -0700 (PDT) Received: from localhost ([2603:7001:f100:500:365a:60ff:fe62:ff29]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-8df81fcb55csm217910836d6.34.2026.06.26.11.22.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Jun 2026 11:22:32 -0700 (PDT) From: Johannes Weiner To: Andrew Morton , Vlastimil Babka Cc: Suren Baghdasaryan , Michal Hocko , Brendan Jackman , Zi Yan , David Hildenbrand , Lorenzo Stoakes , "Liam R. Howlett" , Mike Rapoport , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/4] mm: page_alloc: __GFP_FS lockdep annotation for direct compaction Date: Fri, 26 Jun 2026 14:21:17 -0400 Message-ID: <20260626182215.1107966-2-hannes@cmpxchg.org> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260626182215.1107966-1-hannes@cmpxchg.org> References: <20260626182215.1107966-1-hannes@cmpxchg.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit A subsequent patch will have some order-0 allocations participate in compaction under defrag_mode, to stave off extfrag events. Since this is a sprawling expansion of entry points, and compaction can enter filesystem paths, add lockdep annotations that catches __GFP_FS passing errors. Direct reclaim has had this annotation for a while, and since reclaim and compaction are usually used in conjunction, this is unlikely to unearth old bugs. It's more about future proofing and peace of mind. Signed-off-by: Johannes Weiner --- mm/page_alloc.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mm/page_alloc.c b/mm/page_alloc.c index ee902a468c2f..cb422505c6ef 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -4152,12 +4152,14 @@ __alloc_pages_direct_compact(gfp_t gfp_mask, unsigned int order, psi_memstall_enter(&pflags); delayacct_compact_start(); + fs_reclaim_acquire(gfp_mask); noreclaim_flag = memalloc_noreclaim_save(); *compact_result = try_to_compact_pages(gfp_mask, order, alloc_flags, ac, prio, &page); memalloc_noreclaim_restore(noreclaim_flag); + fs_reclaim_release(gfp_mask); psi_memstall_leave(&pflags); delayacct_compact_end(); -- 2.54.0