Thread (57 messages) 57 messages, 7 authors, 2023-05-28

Re: [PATCH v2 05/34] mm: add utility functions for ptdesc

From: Mike Rapoport <rppt@kernel.org>
Date: 2023-05-25 20:26:06
Also in: kvm, linux-arch, linux-arm-kernel, linux-m68k, linux-mips, linux-mm, linux-riscv, linux-s390, linux-sh, linux-um, loongarch, sparclinux, xen-devel

On Thu, May 25, 2023 at 11:04:28AM -0700, Vishal Moola wrote:
On Thu, May 25, 2023 at 2:10 AM Mike Rapoport [off-list ref] wrote:
quoted
quoted
+
+static inline struct ptdesc *ptdesc_alloc(gfp_t gfp, unsigned int order)
+{
+     struct page *page = alloc_pages(gfp | __GFP_COMP, order);
+
+     return page_ptdesc(page);
+}
+
+static inline void ptdesc_free(struct ptdesc *pt)
+{
+     struct page *page = ptdesc_page(pt);
+
+     __free_pages(page, compound_order(page));
+}
The ptdesc_{alloc,free} API does not sound right to me. The name
ptdesc_alloc() implies the allocation of the ptdesc itself, rather than
allocation of page table page. The same goes for free.
I'm not sure I see the difference. Could you elaborate?
I read ptdesc_alloc() as "allocate a ptdesc" rather than as "allocate a
page for page table and return ptdesc pointing to that page". Seems very
confusing to me already and it will be even more confusion when we'll start
allocating actual ptdescs.
 
-- 
Sincerely yours,
Mike.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help