From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-qt1-f178.google.com (mail-qt1-f178.google.com [209.85.160.178]) (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 BB83D3624AB for ; Wed, 22 Jul 2026 15:00:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.178 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784732415; cv=none; b=SivVT4ynUQprHEPAuDgOMG41cf+3CpnuwS/SX5VLp1bXIEtR5nSyxteMz73ieSL3DUDkhQW/GDX7BgB0N/NhcAGqcj7t3uMZE1ga4pNcYfXyLT4q5ud/OrzD8TWnqfrhnyf4MQ6TG75jfgpFFSCY7Vl61QxsWDFTY84tJ3cBnYU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784732415; c=relaxed/simple; bh=EoGwkVjZ83g4P4XGelFN68Dd+/8XYcpHXKQhq0ckNng=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=LtkDvw/CBgI+LacH3Stc1UaqEoWCkD/jyp8QAGSPeIuQqWNexey7/noa9cy81HRPsDNZh9nb69gO5ePzDnt1MMhnKkUipe0x9KdCdR+PUeVPr9AIydPfqzNxA8u+NGiXEY5Hv04ywlnmPJi7FO/UGI6nrd5RklmOGDZrfQn4A/E= 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=o9Df/i1f; arc=none smtp.client-ip=209.85.160.178 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="o9Df/i1f" Received: by mail-qt1-f178.google.com with SMTP id d75a77b69052e-51a868b6962so145174371cf.2 for ; Wed, 22 Jul 2026 08:00:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cmpxchg.org; s=google; t=1784732412; x=1785337212; 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:content-type; bh=HEuJeVpO7/an9TIgcv/7XS3Xju/554aT8fkPf9kxlBg=; b=o9Df/i1fRfAP4PDXDf6UfU+xhakIH7Yh5iBEKt+g3QROZVusN1yCn+ct45gMVD7ddi 4M3El3WpTiONA5DXBDVOp325KYbOOIqQl8RE7tFtNzkbYLZwWwmjAcSKxS9mpzPrWcLS ojMxHoB2td1Am0NlyXNzejWcJxD4MPby2GYPfsABesqE6eKfy4OTkvSvE5DwpZZhrWbm NJ7q1RiOzdbN2VEIC0wWLadJLpgmBojjNCO3ud7dLEMdMw3nTAqAqGReABwNSYtaXBXK tVjsHbHYa2L9h0kkySGtouW2pqs2ygKRAM6mn4JUaY8ulw90txcMQvDGDWCH6vuGN4In vS3A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1784732412; x=1785337212; 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:content-type; bh=HEuJeVpO7/an9TIgcv/7XS3Xju/554aT8fkPf9kxlBg=; b=dEGI5uRVPo5419smASdJgKzUja0ZWNZQHNG/Xqn/ZebM4HGfu3Ecl77T96UDyFfe6D A5B6kr2eVi9iwWJhAeSfZFNXbKW0NLZjtb+o0zkjTwKH3e1Op2sO1DVkWY/+AE7K9Fac Ev2iIc4q+kvPj/6I6RNocy7wP8i6wN8GqUq19fwXgR8102z1RJS9DaygBJU1HujoggSX 7CQfTHKrvX2NxXEBeZH1+qf//Dyc3ccj5BF+UGN259YMGJKsPBtIvgcQBwK9jSezV+3u 9QfKynpDaP30BzP4+gTADMUOXdr90NLN/7VEmJClu9k7sI8xv3N145Hwp3TLbLgpOw6t pHng== X-Forwarded-Encrypted: i=1; AHgh+RqlfF24zVl5fotMASvxWk988wXCOEMZv8e5eyqZ3MQPvyy0hdrxuFI7t3KOhzWdPM5OJYKgoQZgx3pziIA=@vger.kernel.org X-Gm-Message-State: AOJu0YwxTFTV8hCNjKPQ/2vjudvKTgXTV4JVnoDCVTBEHfzMaJAoQdq+ pVVdqYOqJFzjZcJ9M5U8ojZEhahqY/XMz3Zf66bLrYLKkH44fpfpa0qhd6ILLNUwCqg= X-Gm-Gg: AR+sD10tmw1lDIZDXr4Qbxa+KYsX7uW41gotTCLmKpLUfj8yMfXO5dw5hItGvrgTagV Bdd9IZAM5mn3bCTQdBIGs/TcMKr2Yu763bIMakX1kw2mS3w89R73aCbjXB0kp5JDg2/lfyPNGvW ESc0uwl1w1Cb3VSMqm7lwBRwwZCJ+mXvf1t5MwpLInKpDRv+hb/xcuRtJKAtIyizE+XLHaywd8S mH3/lLVIIRRtR6oqg2mRB/07j5xDE0ZDhf9H+pwRmAolIAdBmjhSRl4Dz7P4dJWZ6p8JVupS+ad V8G8XKku5Nwp+UULrjkSzp2WrBDNZYEp5VqeOLmgRQYU/ykaWAg/GqPKZOHFN+cIIR5Dc0oT8M5 kZSDLeqiy/Yq8oUyEf3uPPrK60irpXD0pBIgrcXYCQ/g2mQfTGcgXreUWfIKQGXDCvh6gRJ6rIw AOVaCIM4fqAvU= X-Received: by 2002:a05:622a:1186:b0:517:6804:3732 with SMTP id d75a77b69052e-5213e77cf30mr202908201cf.55.1784732412231; Wed, 22 Jul 2026 08:00:12 -0700 (PDT) Received: from localhost ([2603:7001:f100:500:365a:60ff:fe62:ff29]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-907ba8d6180sm22721736d6.16.2026.07.22.08.00.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Jul 2026 08:00:11 -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 , Shakeel Butt , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 1/4] mm: page_alloc: __GFP_FS lockdep annotation for direct compaction Date: Wed, 22 Jul 2026 10:56:44 -0400 Message-ID: <20260722150006.3848560-2-hannes@cmpxchg.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260722150006.3848560-1-hannes@cmpxchg.org> References: <20260722150006.3848560-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. Reviewed-by: Vlastimil Babka (SUSE) Acked-by: Shakeel Butt 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.55.0