# Re: \[PATCH v2 0/9\] Free user PTE page table pages

- From: Jason Gunthorpe \<jgg@ziepe.ca\>
- Date: 2021-09-15 14:59:38 
- List: linux-doc
- Page: https://ratatoskr.run/linux-doc/2021/09/1509483
- Thread: https://ratatoskr.run/linux-doc/2021/08/1482406/t.md

```text
On Wed, Sep 15, 2021 at 10:52:40PM +0800, Qi Zheng wrote:
> I am going to split this patch series as follows:
> 
> 1. Introduce the new dummy APIs, which is an empty implementation.
>    But I will explain its semantics.
> 2. Merge #6, #7 and #8, and call these dummy APIs in any necessary
>    location, and split some special cases into single patches, such as
>    pagefault and gup, etc. So that we can explain in more detail the
>    concurrency in these cases. For example, we don't need to hold any
>    pte_refcount in the fast path in gup on the x86_64 platform. Because
>    the PTE page can't be freed after the local CPU interrupt is closed
>    in the fast path in gup.
> 3. Introduce CONFIG_FREE_USER_PTE and implement these empty dummy APIs.
> 4. Add a description document.
> 
> And I try to add a function that combines pte_offset_map() and
> pte_try_get(). Maybe the func name is pte_try_map() recommended by
> Jason, or keep the pte_offset_map() unchanged?

It is part of the transformation, add a
pte_try_map()/pte_undo_try_map() and replace all the pte_offset_map()
callsites that can use the new API with it. The idea was that try_map
would incorporate the pmd_trans_unstable/etc mess so searching for
trans_unstable is a good place to start finding candidates. Some are
simple, some are tricky.

When you get to step 3 you just change pte_try_map() and the callsites
don't need changing.

Jason
```
