From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 3F58F37D for ; Sat, 27 May 2023 00:50:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B2CF1C433D2; Sat, 27 May 2023 00:50:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1685148604; bh=PctGZlrrzibp7UAnk07C/sOmUfyQ9mUKgJg38V2xuBU=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=b5IVwgYRE/2EVTpq7191D0vqSuCOLDLA9yxTg8kzF2RTtrFlASvkrFmPLaJtaVukQ dx5NKWsr6CkQoGLe9DVthIsfhGRUMLCIhOM3QVgrl7be2FWaDy+DnfW190vcVwTJ2s zU16jMx+fgyZWf833+TKCK1dS9ojn0TwISpmHXXc4A6MxBBQ/0mOPvMaIk698Velpj TprITEm52LvMpvY15nmUsfSBRWn/PIGwebDUf9F7yPhJw536eOoYIVLCUc4Fu6rjuw 5mKxlb8geTfkhmlqwBdxW8lU1ju4L3hTlb8r95qR77Md4eoESwaMNVfTOzd1VQdYKQ 4GtDL57/Vxi2w== Date: Fri, 26 May 2023 17:50:02 -0700 From: Jakub Kicinski To: David Howells Cc: netdev@vger.kernel.org, "David S. Miller" , Eric Dumazet , Paolo Abeni , Willem de Bruijn , David Ahern , Matthew Wilcox , Jens Axboe , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Jeroen de Borst , Catherine Sullivan , Shailend Chand , Felix Fietkau , John Crispin , Sean Wang , Mark Lee , Lorenzo Bianconi , Matthias Brugger , AngeloGioacchino Del Regno , Keith Busch , Jens Axboe , Christoph Hellwig , Sagi Grimberg , Chaitanya Kulkarni , Andrew Morton , linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-nvme@lists.infradead.org Subject: Re: [PATCH net-next 04/12] mm: Make the page_frag_cache allocator use multipage folios Message-ID: <20230526175002.2591ccae@kernel.org> In-Reply-To: <20230524153311.3625329-5-dhowells@redhat.com> References: <20230524153311.3625329-1-dhowells@redhat.com> <20230524153311.3625329-5-dhowells@redhat.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit On Wed, 24 May 2023 16:33:03 +0100 David Howells wrote: > - offset = nc->offset - fragsz; > - if (unlikely(offset < 0)) { > - page = virt_to_page(nc->va); > - > - if (page_ref_count(page) != nc->pagecnt_bias) > + offset = nc->offset; > + if (unlikely(fragsz > offset)) { > + /* Reuse the folio if everyone we gave it to has finished with > + * it. > + */ > + if (!folio_ref_sub_and_test(folio, nc->pagecnt_bias)) { > + nc->folio = NULL; > goto refill; > + } > + > if (unlikely(nc->pfmemalloc)) { > - page_ref_sub(page, nc->pagecnt_bias - 1); > - __free_pages(page, compound_order(page)); > + __folio_put(folio); This is not a pure 1:1 page -> folio conversion. Why mix conversion with other code changes?