From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A77303233F4 for ; Mon, 11 May 2026 15:09:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778512183; cv=none; b=J2V+LekIh+hVZ3/DTKTCSx4+vi/8msAwMamZPxO6noC4HIj8R1qEire4Ew+K06urPUWyTCkVSZPOJA36j7f8NcCYalxScze5YtA7K+aT4amM7j875cUE+N/BED087JSRuy3dbNblelov8KkGT2Ny9Wnbbad9yZO7mEgzP16ayxc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778512183; c=relaxed/simple; bh=Dnf4+DfJsVd4W+XYmvPc8kClnijoEAXClbX5eCs6Bdc=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=VObgxWMykF0DyHDQQCXVJ3ZT1sggTFzm55tIZzGIfjjJATsguhRXCjqXfjnK2OLCdFDlidIPcdTVwR/gT29VkwsLM/o5K9e1CRtighs26YiOdKshCKaz6QMInaqmJ0XW0Qz9/tBYJXGSLKInVhUU9T0xd2FIS/6Sjn3KZpwJWf4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=N9eWfuaA; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b=ZTMF2FnP; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="N9eWfuaA"; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b="ZTMF2FnP" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1778512181; 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: in-reply-to:in-reply-to:references:references; bh=AizvbhkaHZmbiszzPT3Ur4sT9Sy5a6af0Jfvs/KZVvM=; b=N9eWfuaArunIzZ9S3noElNdrZY3YyjxVXpxIAZwRsTxoWTiS6pggMJVvwyn8RochlsuXRN pvokN6LAk+r0c0TBzA47kkISVZs4r2p0rt1wPTditaKWv7HarSkT3LuH9WlVIQDyrLRWmJ EnbcXkHC3pqtONvGhkLbYWEuEWrp1K8= Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-130-zIdbZYgaMQeAORyp5Okq_w-1; Mon, 11 May 2026 11:09:39 -0400 X-MC-Unique: zIdbZYgaMQeAORyp5Okq_w-1 X-Mimecast-MFC-AGG-ID: zIdbZYgaMQeAORyp5Okq_w_1778512178 Received: by mail-wm1-f72.google.com with SMTP id 5b1f17b1804b1-48e5eecd0aaso25304365e9.0 for ; Mon, 11 May 2026 08:09:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1778512178; x=1779116978; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=AizvbhkaHZmbiszzPT3Ur4sT9Sy5a6af0Jfvs/KZVvM=; b=ZTMF2FnPU7MlD5AYkyabbbNAWXDOQCsxZofmBXYyo7CKUQ0ggXR9nEJdCrjNGWUP0Y 1ZbBEGaw3im9ISXtHkoEwnC6wIxtFqbPkDJEu1eHEgSZI23c5ptondJJJmnXh97wNDqQ dzXX4v1FPzSTZYIAs4NPDbrT8x399hs6+87gNZ0yA55/cfj+vlW4Y2r0rUGYix1q8LLc VVWYR9G+Ql4EEzyJlYuEAI2nj4qjYHCPGeOd/nIADfNBP6tpIItvT2eknW6yviLRuHDe n4NldRqDhldaFFp2VvTtD8/XvGf+K8U7PKhcE1UIRGibzFKikgTCvwwMm0PEE4Eg9BZN knlw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1778512178; x=1779116978; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=AizvbhkaHZmbiszzPT3Ur4sT9Sy5a6af0Jfvs/KZVvM=; b=JDZI103KlgRd/C1eMCgFmwiWXyFSebGiNnN6EcTGwVYobjW4bm0A1C/6pLu2JtOWfQ /eu692vHuslXZ91pl8+dd9EWyNvGcoMaYkWD1EDwSloHsMUTr2RstOLPhplxhGUJjq8t TWfSOhM9WVZw94Fi8GMUxR2MmWvecdbOpl8byoCMUXp6FgXVfewHXLux5J1POLVFtWju m9C6tnEXr8yJ6eEqoukxYi12lll1RrXpDVK2zwtHFQ+YI10MmkDF2dVE5+PUAXf0PrVe xY1rlywZT9urTzHX2VGv/YPlO+FBMMD7D5Zvh+OdrTO/x9DjMKM0XjCk7WEE7k5HpKTT JHPg== X-Gm-Message-State: AOJu0YxsalxSkNjsKtumV3Xn1CMNvmT/js+bFLddFlbfFVH+Zg/OD0R/ 8xOVm8bPfrlQTgYSp40Ik+lgydQIHkpu+Roo4HwoiYhDP5zwByRBjBjX582ptmz40E7IIELSyXp IRW4Thl4X5CR9On6V+NLcRCW/WL2RR7PuIARL+Bj5DvVKfADBVTjXXfdghUsQgSgF1A== X-Gm-Gg: Acq92OGbXZIon9PpPNkS52PATxOJecv3ZmMu4D7E5feGj4YLCyYkqMZ+FYqWUFbfNLO /gxik5Ua3EYR8SGEjWX0W8AMz6VuyYyqwZEiQMYDgu9mfw/wDImJn5txJXOgz/3cVtCAW3xpGTT CEnoloFbRydZZKSk+zZ80lgTqN4AN8WPIH2bsx+w+P0cMUy2iDaB7zFS18+6kI1425yzRnpAdwZ h2j6fitBufkiDEMuVnRWFgJRnc73+34084kTzQDcGaoGCb0l0T4lgq3PohfU62ghzxhZdT/NUMg /WvzNnU5qDelQ5CY0oTxLZTkzsGFcCD7pjgszyOOM1zvnw7j8ul9A7KViry773gqan2hAlWJ7gp nAfhXKk3ea9EPOCHOTgO1qUGZ6mV8pByVvgojo2xO X-Received: by 2002:a05:600c:34c8:b0:486:fd5c:2b35 with SMTP id 5b1f17b1804b1-48e51f2f85emr427544185e9.13.1778512177772; Mon, 11 May 2026 08:09:37 -0700 (PDT) X-Received: by 2002:a05:600c:34c8:b0:486:fd5c:2b35 with SMTP id 5b1f17b1804b1-48e51f2f85emr427543085e9.13.1778512177160; Mon, 11 May 2026 08:09:37 -0700 (PDT) Received: from redhat.com (IGLD-80-230-48-7.inter.net.il. [80.230.48.7]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-48e702e0bf2sm334546605e9.4.2026.05.11.08.09.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 May 2026 08:09:36 -0700 (PDT) Date: Mon, 11 May 2026 11:09:31 -0400 From: "Michael S. Tsirkin" To: Gregory Price Cc: linux-kernel@vger.kernel.org, "David Hildenbrand (Arm)" , Jason Wang , Xuan Zhuo , Eugenio =?iso-8859-1?Q?P=E9rez?= , Muchun Song , Oscar Salvador , Andrew Morton , Lorenzo Stoakes , "Liam R. Howlett" , Vlastimil Babka , Mike Rapoport , Suren Baghdasaryan , Michal Hocko , Brendan Jackman , Johannes Weiner , Zi Yan , Baolin Wang , Nico Pache , Ryan Roberts , Dev Jain , Barry Song , Lance Yang , Hugh Dickins , Matthew Brost , Joshua Hahn , Rakie Kim , Byungchul Park , Ying Huang , Alistair Popple , Christoph Lameter , David Rientjes , Roman Gushchin , Harry Yoo , Axel Rasmussen , Yuanchu Xie , Wei Xu , Chris Li , Kairui Song , Kemeng Shi , Nhat Pham , Baoquan He , virtualization@lists.linux.dev, linux-mm@kvack.org, Andrea Arcangeli , "Liam R. Howlett" Subject: Re: [PATCH resend v6 01/30] mm: move vma_alloc_folio_noprof to page_alloc.c Message-ID: <20260511110719-mutt-send-email-mst@kernel.org> References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: On Mon, May 11, 2026 at 10:47:50AM -0400, Gregory Price wrote: > On Mon, May 11, 2026 at 05:01:44AM -0400, Michael S. Tsirkin wrote: > > +#ifdef CONFIG_NUMA > > +/** > > + * vma_alloc_folio - Allocate a folio for a VMA. > > + * @gfp: GFP flags. > > + * @order: Order of the folio. > > + * @vma: Pointer to VMA. > > + * @addr: Virtual address of the allocation. Must be inside @vma. > > + * > > + * Allocate a folio for a specific address in @vma, using the appropriate > > + * NUMA policy. The caller must hold the mmap_lock of the mm_struct of the > > + * VMA to prevent it from going away. Should be used for all allocations > > + * for folios that will be mapped into user space, excepting hugetlbfs, and > > + * excepting where direct use of folio_alloc_mpol() is more appropriate. > > + * > > + * Return: The folio on success or NULL if allocation fails. > > + */ > > +struct folio *vma_alloc_folio_noprof(gfp_t gfp, int order, > > + struct vm_area_struct *vma, unsigned long addr) > > +{ > > + struct mempolicy *pol; > > + pgoff_t ilx; > > + struct folio *folio; > > + > > + if (vma->vm_flags & VM_DROPPABLE) > > + gfp |= __GFP_NOWARN; > > + > > + pol = get_vma_policy(vma, addr, order, &ilx); > > + folio = folio_alloc_mpol_noprof(gfp, order, pol, ilx, numa_node_id()); > > + mpol_cond_put(pol); > > + return folio; > > +} > > +#else > > +struct folio *vma_alloc_folio_noprof(gfp_t gfp, int order, > > + struct vm_area_struct *vma, unsigned long addr) > > +{ > > + if (vma->vm_flags & VM_DROPPABLE) > > + gfp |= __GFP_NOWARN; > > + > > + return folio_alloc_noprof(gfp, order); > > +} > > +#endif > > Can this ifdef not reasonably be done in a header? It can't :( In patch 3 this will need to call __alloc_frozen_pages_noprof, and that's in internal.h > I know the old path relied on basically mempolicy.c being in/out of > scope based on CONFIG_NUMA, but we should make an attempt at keeping > page_alloc.c clean on this if possible. > > ~Gregory