Re: [PATCH v3 1/1] iommu/sva: Invalidate KVA range on kernel TLB flush
From: Baolu Lu
Date: Mon Aug 25 2025 - 21:27:44 EST
On 8/26/25 06:36, Dave Hansen wrote:
On 8/22/25 20:26, Baolu Lu wrote:
+static struct {
+ /* list for pagetable_dtor_free() */
+ struct list_head dtor;
+ /* list for __free_page() */
+ struct list_head page;
+ /* list for free_pages() */
+ struct list_head pages;
+ /* protect all the ptdesc lists */
+ spinlock_t lock;
+ struct work_struct work;
Could you explain a bit why this now needs three separate lists? Seems
like pure overkill.
Yes, sure.
The three separate lists are needed because we're handling three
distinct types of page deallocation. Grouping the pages this way allows
the workqueue handler to free each type using the correct function.
- pagetable_dtor_free(): This is for freeing PTE pages, which require
specific cleanup of a ptdesc structure.
- __free_page(): This is for freeing a single page.
- free_pages(): This is for freeing a contiguous block of pages that
were allocated together.
Using separate lists for each type ensures that every page is handled
correctly without having to check the page's type at runtime.
This seems like overkill, it was chosen to ensure functional
correctness. Any better solution?
Thanks,
baolu