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 486663DDDD2 for ; Wed, 8 Jul 2026 08:55:58 +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=1783500959; cv=none; b=f1h2CssYWYZoNaTBHk+KMKL1NjsBdlyQJQ74J4nAYv8opAYn0cFHq+lWLzfsw5DEbL+OWcMc4sfBAPrdi8cnA1T8nyWLpN/rpVQXm/ObtfSs9gsl6GfkozJRym8RP4JFp+Vg8ACrkMbvca1T3u24/saebRPeDRprRyohJ3mLb/E= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783500959; c=relaxed/simple; bh=hvxo0k1MrjhNygA/KP1UD+xDX6qJaRVTlMh+2Jzokh4=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=sfZJksuhnVETjxAw6CyiqsLOlykw+JVeLalHhg8NFki9e/bRyF8t8Q1OssKw0WFTgUV3Ii4pXyLe/kzZPE5a66Id/gBgs4llGV1gFhTHmZ/May6cn18WHObfklnMh9kjauUe33pTCKHPG6kQ/UrbL21qbOFsKSJZlbkyNIyhboY= 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=fffacYUf; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b=iGDKGnqC; 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="fffacYUf"; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b="iGDKGnqC" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1783500957; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=IbP35j/x3DTm7o/Yn1OIdMEqiWJ44P60wi1DTKxILpo=; b=fffacYUfhgTW5h6bxzOp1Y+4cSAPeLDB+cAH9DME/CyALa1kBnBSOzCY1YX4+lkk5082/T EAZ+3Vp1PttNnunkPcEJDQEYb0rCQALR5SX5ff7N9PM5tdAzq7tZ7Ktg+HVVRtxBQeEuCM /qPpH6j0cI48/Y7AB3R7aLWa/9vSsJc= Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-178-J6bQNwULPQGAQgq0LNNeQQ-1; Wed, 08 Jul 2026 04:55:56 -0400 X-MC-Unique: J6bQNwULPQGAQgq0LNNeQQ-1 X-Mimecast-MFC-AGG-ID: J6bQNwULPQGAQgq0LNNeQQ_1783500955 Received: by mail-wm1-f70.google.com with SMTP id 5b1f17b1804b1-492488f8583so10774335e9.2 for ; Wed, 08 Jul 2026 01:55:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1783500955; x=1784105755; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:content-language:from :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=IbP35j/x3DTm7o/Yn1OIdMEqiWJ44P60wi1DTKxILpo=; b=iGDKGnqC8no4D4pk81ZehNPW1n6HuwtsNx6SAQToBt48vqGHGHjUw1FIq3Z/ZOgN2L 42EB3wAV7MuiI/jJvLqCOfGKnpf/L29J9v0zy4txREZdhLocd2tHFHqg9lJrOrEQbJcc kZVc8+UZKb8d1vCt2nZmOEwoCtBW9e/kxfQCzOYe6vdg/aF2BbQNS+WG/7ozkiIR2F5n uCZ4k4suvbrZNb5WuFnQ0YOnkUPm9KlUGNtyzcuRojjX3roINk435DI8CRQpv04Vjpje KdUQx1Ad6SSMRUBrCfmqqTKd/oiABRUcbhE29Hd0UHL0umlWlnXg7AeBYqlc2bn8UMh3 EMIA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783500955; x=1784105755; h=content-transfer-encoding:in-reply-to:content-language:from :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=IbP35j/x3DTm7o/Yn1OIdMEqiWJ44P60wi1DTKxILpo=; b=B/4VjJYWCZj5LYr5mXQtS1XQgNxZij/ij+nf7w9P9tMwpGR5JwosbPSHU2uifxyDR/ VKzD+aPyhpodCPd0Vci24ygmr/2FC2ekQf2fWclEbBWz+/BDiV3SntadVuUcAEWFINhG YwW2VkTcqKe90+37AoDv+OnvyhcDPyfbyEA6auYkBqg0rcuAoT+n3I5BvW+KN+w5LGpY 6Gr4CpEy6KCVfKCGpBsM/0ipsoQ/Js9s4bN9TfyZDhWH6jC1CVLt9eMHAb61riC1XIa3 MmvvBDlPERTC397nX50xkUpUavsuD4zP/qYp7vJ9gqwoJBH78Bo/afEJJ4+IAW3aliWj 3BZw== X-Forwarded-Encrypted: i=1; AHgh+RrAr4hezsy+3gK8hv9nIZRRkhyd0PPfJdGwwcdSxos7wbDqr1kClUcBnNQUIFloFsC426Mb7mBLpGVj2Wk=@vger.kernel.org X-Gm-Message-State: AOJu0Yw+DTDmRWn2WrAIWRdl94SzOuhWNnC9LaImse+JGfvP/gSVwPQ0 XSS4EPvk/8r1zl/jpqQKMpMw+mGDIJ72WpRL3YIOGCPx+0JKEYH7t66ug5K3cyolpjIDjcSRHF0 tq/ToUCAdyfOFvY3+SpLLyYHmyX9fFrywu24f5cE4+TpiWKwvXGo2Jlga9AEc4mVE5g== X-Gm-Gg: AfdE7cn8xce7dsXiLD7LLvQXpmIbqAlYeS0BBNCjL29ezTx0sfLZ21ll+FfvYLYESm6 8yUC+qcOObiiSc3304ZziDU149bBIj4ubw9SZT+GMkjsqL+ljztovsQGsKbqbMssLkxfG28yCqy TMsyvuNNNxdfIKqM977Ul1VnnRQ1eLVxneQw970X9KSzxE6DclSmjn8akmCzU+ks1tVlzQ8bP+K hEj8EctZiw4xTKoUELjX/6fi0XW4kwERvYLuX3K6ffchAs8zK+4xa3WqA6CRxEgFiqfsuvZV8Cw cMvh97Vo05o5RShC4sjpLrHbLY3u+8MP8QwCHNToJvZ9uHR7FI2dyfshBOCSwWEYxJpinNde9UM lXCxwcELjTy+nTdRu9En0296jx5iwSusQQXhrwmJ4Rl4R71rSIPD45J+Jx0m/XUHnUZZe0l2WGU GIs8+mPqk40hX2 X-Received: by 2002:a05:600c:548d:b0:493:b8d9:f28b with SMTP id 5b1f17b1804b1-493e68c7f63mr16435315e9.23.1783500954938; Wed, 08 Jul 2026 01:55:54 -0700 (PDT) X-Received: by 2002:a05:600c:548d:b0:493:b8d9:f28b with SMTP id 5b1f17b1804b1-493e68c7f63mr16435005e9.23.1783500954522; Wed, 08 Jul 2026 01:55:54 -0700 (PDT) Received: from ?IPV6:2a0d:3344:5521:6b10:58fd:68f:7756:389d? ([2a0d:3344:5521:6b10:58fd:68f:7756:389d]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-493e5a6240fsm34114935e9.2.2026.07.08.01.55.53 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 08 Jul 2026 01:55:54 -0700 (PDT) Message-ID: <3832c190-b5b7-49a2-902d-7f75598b0789@redhat.com> Date: Wed, 8 Jul 2026 10:55:51 +0200 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 0/4] drivers/net: replace __get_free_pages() with kmalloc() To: Johannes Berg Cc: Brian Norris , Francesco Dolcini , Jakub Kicinski , b43-dev@lists.infradead.org, libertas-dev@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-wireless@vger.kernel.org, netdev@vger.kernel.org, "Mike Rapoport (Microsoft)" References: <20260701-b4-drivers-wireless-v1-0-60264cdf2efe@kernel.org> From: Paolo Abeni Content-Language: en-US In-Reply-To: <20260701-b4-drivers-wireless-v1-0-60264cdf2efe@kernel.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 7/1/26 3:59 PM, Mike Rapoport (Microsoft) wrote: > This is a (small) part of larger work of replacing page allocator calls > with kmalloc. > > My initial intention a few month ago was to remove ugly casts [1], but then > willy pointed out that Linus objected to something like this [2] and it > looks like more than a decade old technical debt. > > Largely, anything that doesn't need struct page (or a memdesc in the > future) should just use kmalloc() or kvmalloc() to allocate memory. > kmalloc() guarantees alignment, physical contiguity and working > virt_to_phys() and beside nicer API that returns void * on alloc and > doesn't require to know the allocation size on free, kmalloc() provides > better debugging capabilities than page allocator. > > Another thing is that touching these allocation sites gives the reviewers > opportunity to see if a PAGE_SIZE buffer is actually needed or maybe > another size is appropriate. > > For larger allocations that don't need physically contiguous memory > kvmalloc() can be a better option that __get_free_pages() because under > memory pressure it's is easier to allocate several order-0 pages than a > physically contiguous chunk with the same number of pages. > > And last, but not least, removing needless calls to page allocator should > help with memdesc (aka project folio) conversion. There will be way less > places to audit to see if the user was actually using struct page. > > Also in git: > https://git.kernel.org/pub/scm/linux/kernel/git/rppt/linux.git gfp-to-kmalloc/drivers-net-wireless > > [1] https://lore.kernel.org/all/20251018093002.3660549-1-rppt@kernel.org/ > [2] https://lore.kernel.org/all/CA+55aFwp4iy4rtX2gE2WjBGFL=NxMVnoFeHqYa2j1dYOMMGqxg@mail.gmail.com/ > > --- @Johannes: just an head-up, I assume this series will go via your tree (despite the slightly misleading subj) /P