From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-ed1-f73.google.com (mail-ed1-f73.google.com [209.85.208.73]) (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 814F126738D for ; Tue, 9 Dec 2025 06:36:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.73 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765262217; cv=none; b=JluydJea2mRYW3r0xJwmWsO+8sHlQ6HakuE6kio3Mmf1TYlj9CfS7SsApCV1N9e4ga7s1DfU/EVo0VJsZSMqUEO9726JqvJMW9Tc1SUjiMj9ux5QnTsXum6MTlgBwwoI/wxlDexvNDNb/b8wKpeQ29d0j/5Z4NT4dfwCIuaS4Qw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765262217; c=relaxed/simple; bh=CtxGw9s0RDqWxS2+lFhayovZ9WKa0PlciIyDvC9j13w=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=dy2s9utW050JGuDhKsx0XDJlhfSE4ZkO7I/1GS7awx9hEPFBVvmSWU0e3RZfB3R/owMzlZj7VvJ9yWBpGq61LJ3ahmZWmLQm2WlrwonSIbaL0cz3Rwd8eAiG1nM/7rYluSBB6s2ReWcdWYy7D14x84u9XpYIqBRqbz27IpEzcQY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--jackmanb.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=AplEEVzt; arc=none smtp.client-ip=209.85.208.73 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--jackmanb.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="AplEEVzt" Received: by mail-ed1-f73.google.com with SMTP id 4fb4d7f45d1cf-6411c626af4so5432952a12.1 for ; Mon, 08 Dec 2025 22:36:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1765262212; x=1765867012; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=pBlg6N0YGJgNDGWLE0hR1gRUpuGlTlt32WJRdXYRD2Q=; b=AplEEVztgD6U8rh0VdPHN0Yk3hk8xYcQRNUFgJEChyJsm9VUZlizdkn4ZQz4asEca4 puB4uYQaNhV3cXo/eyb+iUhedujTAlMesvLyJRmaj3tYtPjuQzvpgdFrKpfPt2EQHr6R bBLHoBQnSfZ+ShVjdOL+JbQ2PJPKotuqJP7NtlA6NwCrIh777a7aZOLTt9YndelL73oy ps7mvXVzMoNZpSBonD7uSWFemhTyL+bCaW67MlvNGCEV6+gRtloZwtSM1/PFtAx33AQv BDan7mX6LhfkfOW51ocdxxRIeIf5qJ+zL+h3sGefhSIcyxlu0gNdmTnDsKQ4OVH158Yk dfcg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1765262212; x=1765867012; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=pBlg6N0YGJgNDGWLE0hR1gRUpuGlTlt32WJRdXYRD2Q=; b=YOxVqT91SUhoM+ZybTeA+4ygPXSYonEo2oBcxMoMcGAU7upSLlzM38RKlroVSxaJ65 nNFnAmBmGr6J+0z4tofHNwHuis5wShf56nVkCVNph09LeZOYV/MOKYF8ZZnZAlYP3DR1 4LXzYUkA9MEuLhr9+rJqNURbzsS31SGHQy9Bgh6RTY8jnCorSC55TYPppt6s0WaOMCws 7+takVxBlRznh1C1tt+Yr8mmA0R3bEeJ1fab4QnrObA+hyHVtFeW6/UYeuPHjnG+rUqP OJ+UoUWrcu1KjiVAHPVNqDVVre2IOiwmtJCD+IERJG/N0OBPca8ehPja/TKHUutsQJH/ 1yVA== X-Forwarded-Encrypted: i=1; AJvYcCVcVjTR1b2ts/TzXqWnZrprfKPQbasAv5R7+6kWNd9bVGBRBxn83XjJQf15+hzu+re0qcA/cVeQ+xNKaS8=@vger.kernel.org X-Gm-Message-State: AOJu0YzdJ5PkX0S8hcYYL/8Yfz0OrVHqxDcAdV/8T0D+XK8ixk15JMTs xqp0vTfhDGmnpr8SqOZ9VFS//usl0fHrdXGK3uR610o5+VYzZtr/Dkq+K3vYDHqqBVSvGwhUf53 2k41eHFqJTSayxw== X-Google-Smtp-Source: AGHT+IHCnkhtu+erinZRjzHU08DdBwFzraMet61P9UwT8esvB8HjyL7gPlKocQZ3b3SJKLvMZ7snSMNitdCnUA== X-Received: from edbek6.prod.google.com ([2002:a05:6402:3706:b0:647:5ed5:87dd]) (user=jackmanb job=prod-delivery.src-stubby-dispatcher) by 2002:a05:6402:2816:b0:647:57e7:472e with SMTP id 4fb4d7f45d1cf-6491abf2749mr7780459a12.22.1765262212352; Mon, 08 Dec 2025 22:36:52 -0800 (PST) Date: Tue, 09 Dec 2025 06:36:51 +0000 In-Reply-To: <20251209-b4-vmalloc-might_alloc-v2-1-2462ba26ead1@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20251209-b4-vmalloc-might_alloc-v2-1-2462ba26ead1@google.com> X-Mailer: aerc 0.21.0 Message-ID: Subject: Re: [PATCH v2] mm/vmalloc: clarify why vmap_range_noflush() might sleep From: Brendan Jackman To: Brendan Jackman , Andrew Morton , Uladzislau Rezki Cc: Anshuman Khandual , , Content-Type: text/plain; charset="UTF-8" On Tue Dec 9, 2025 at 5:44 AM UTC, Brendan Jackman wrote: > The only reason vmap_range_noflush() can sleep is because of pagetable > allocations. > > The actual allocation mechanism is arch-specific so might_alloc() > doesn't work here (what GFP flags would be used?). Hence, just add a > comment. > > Signed-off-by: Brendan Jackman > --- > Changes in v2: > - Switched from might_alloc() to keeping might_sleep() + comment > - Link to v1: https://lore.kernel.org/r/20251208-b4-vmalloc-might_alloc-v1-1-94a9bb8ecb08@google.com > --- > mm/vmalloc.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/mm/vmalloc.c b/mm/vmalloc.c > index a53c7462671bdd896f95712af71398ffbe22fb80..c23d378dd4446e2784505ec3d5bb9568fb0d3c9a 100644 > --- a/mm/vmalloc.c > +++ b/mm/vmalloc.c > @@ -305,6 +305,7 @@ static int vmap_range_noflush(unsigned long addr, unsigned long end, > int err; > pgtbl_mod_mask mask = 0; > > + /* Might allocate pagetables. */ I just realised that for x86, there's also TLB shootdowns in pud_free_pmd_page() etc. So I guess this is also a might_ for the the lockdep_assert_irqs_enabled() in smp_call_function_many_cond(). Should probably mention that too. Anything else I missed, before I send v3? > might_sleep(); > BUG_ON(addr >= end);