Re: [PATCH] mm/hmm: Cleanup hmm_vma_walk_pud()/walk_pud_range()

From: Thomas HellstrÃm (VMware)
Date: Fri Dec 20 2019 - 10:55:01 EST


On 12/20/19 4:38 PM, Steven Price wrote:
There are a number of minor misuses of the page table APIs in
hmm_vma_walk_pud():

If the pud_trans_huge_lock() hasn't been obtained it might be because
the PUD is unstable, so we should retry.

If it has been obtained then there's no need for a READ_ONCE, and the
PUD cannot be pud_none() or !pud_present() so these paths are dead code.

Finally in walk_pud_range(), after a call to split_huge_pud() the code
should check pud_trans_unstable() rather than pud_none() to decide
whether the PUD should be retried.

Suggested-by: Thomas HellstrÃm (VMware) <thomas_os@xxxxxxxxxxxx>
Signed-off-by: Steven Price <steven.price@xxxxxxx>
---
This is based on top of my "Generic page walk and ptdump" series and
fixes some pre-existing bugs spotted by Thomas.

mm/hmm.c | 16 +++++-----------
mm/pagewalk.c | 2 +-
2 files changed, 6 insertions(+), 12 deletions(-)

LGTM.

Reviewed-by: Thomas Hellstrom <thellstrom@xxxxxxxxxx>