All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mm: remove pte_lock_deinit()
@ 2018-11-28 23:55 Yu Zhao
  2018-11-29  2:42 ` Matthew Wilcox
  2018-11-29  8:39 ` Michal Hocko
  0 siblings, 2 replies; 3+ messages in thread
From: Yu Zhao @ 2018-11-28 23:55 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Hugh Dickins, Kirill A . Shutemov, Matthew Wilcox, Michal Hocko,
	Dan Williams, Pavel Tatashin, Souptick Joarder, Logan Gunthorpe,
	Keith Busch, linux-mm, linux-kernel, Yu Zhao

Pagetable page doesn't touch page->mapping or have any used field
that overlaps with it. No need to clear mapping in dtor. In fact,
doing so might mask problems that otherwise would be detected by
bad_page().

Signed-off-by: Yu Zhao <yuzhao@google.com>
---
 include/linux/mm.h | 11 ++---------
 1 file changed, 2 insertions(+), 9 deletions(-)

diff --git a/include/linux/mm.h b/include/linux/mm.h
index 5411de93a363..7c8f4fc9244e 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -1900,13 +1900,6 @@ static inline bool ptlock_init(struct page *page)
 	return true;
 }
 
-/* Reset page->mapping so free_pages_check won't complain. */
-static inline void pte_lock_deinit(struct page *page)
-{
-	page->mapping = NULL;
-	ptlock_free(page);
-}
-
 #else	/* !USE_SPLIT_PTE_PTLOCKS */
 /*
  * We use mm->page_table_lock to guard all pagetable pages of the mm.
@@ -1917,7 +1910,7 @@ static inline spinlock_t *pte_lockptr(struct mm_struct *mm, pmd_t *pmd)
 }
 static inline void ptlock_cache_init(void) {}
 static inline bool ptlock_init(struct page *page) { return true; }
-static inline void pte_lock_deinit(struct page *page) {}
+static inline void ptlock_free(struct page *page) {}
 #endif /* USE_SPLIT_PTE_PTLOCKS */
 
 static inline void pgtable_init(void)
@@ -1937,7 +1930,7 @@ static inline bool pgtable_page_ctor(struct page *page)
 
 static inline void pgtable_page_dtor(struct page *page)
 {
-	pte_lock_deinit(page);
+	ptlock_free(page);
 	__ClearPageTable(page);
 	dec_zone_page_state(page, NR_PAGETABLE);
 }
-- 
2.20.0.rc1.387.gf8505762e3-goog


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] mm: remove pte_lock_deinit()
  2018-11-28 23:55 [PATCH] mm: remove pte_lock_deinit() Yu Zhao
@ 2018-11-29  2:42 ` Matthew Wilcox
  2018-11-29  8:39 ` Michal Hocko
  1 sibling, 0 replies; 3+ messages in thread
From: Matthew Wilcox @ 2018-11-29  2:42 UTC (permalink / raw)
  To: Yu Zhao
  Cc: Andrew Morton, Hugh Dickins, Kirill A . Shutemov, Michal Hocko,
	Dan Williams, Pavel Tatashin, Souptick Joarder, Logan Gunthorpe,
	Keith Busch, linux-mm, linux-kernel

On Wed, Nov 28, 2018 at 04:55:25PM -0700, Yu Zhao wrote:
> Pagetable page doesn't touch page->mapping or have any used field
> that overlaps with it. No need to clear mapping in dtor. In fact,
> doing so might mask problems that otherwise would be detected by
> bad_page().
> 
> Signed-off-by: Yu Zhao <yuzhao@google.com>

Reviewed-by: Matthew Wilcox <willy@infradead.org>

I do have plans to use page->mapping for pt_mm, but this patch won't
get in my way when I find the round tuits to do that work.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] mm: remove pte_lock_deinit()
  2018-11-28 23:55 [PATCH] mm: remove pte_lock_deinit() Yu Zhao
  2018-11-29  2:42 ` Matthew Wilcox
@ 2018-11-29  8:39 ` Michal Hocko
  1 sibling, 0 replies; 3+ messages in thread
From: Michal Hocko @ 2018-11-29  8:39 UTC (permalink / raw)
  To: Yu Zhao
  Cc: Andrew Morton, Hugh Dickins, Kirill A . Shutemov, Matthew Wilcox,
	Dan Williams, Pavel Tatashin, Souptick Joarder, Logan Gunthorpe,
	Keith Busch, linux-mm, linux-kernel

On Wed 28-11-18 16:55:25, Yu Zhao wrote:
> Pagetable page doesn't touch page->mapping or have any used field
> that overlaps with it. No need to clear mapping in dtor. In fact,
> doing so might mask problems that otherwise would be detected by
> bad_page().

yes the layour of the structure has changed since Hugh introduced the
pte lock split

> Signed-off-by: Yu Zhao <yuzhao@google.com>

Acked-by: Michal Hocko <mhocko@suse.com>

> ---
>  include/linux/mm.h | 11 ++---------
>  1 file changed, 2 insertions(+), 9 deletions(-)
> 
> diff --git a/include/linux/mm.h b/include/linux/mm.h
> index 5411de93a363..7c8f4fc9244e 100644
> --- a/include/linux/mm.h
> +++ b/include/linux/mm.h
> @@ -1900,13 +1900,6 @@ static inline bool ptlock_init(struct page *page)
>  	return true;
>  }
>  
> -/* Reset page->mapping so free_pages_check won't complain. */
> -static inline void pte_lock_deinit(struct page *page)
> -{
> -	page->mapping = NULL;
> -	ptlock_free(page);
> -}
> -
>  #else	/* !USE_SPLIT_PTE_PTLOCKS */
>  /*
>   * We use mm->page_table_lock to guard all pagetable pages of the mm.
> @@ -1917,7 +1910,7 @@ static inline spinlock_t *pte_lockptr(struct mm_struct *mm, pmd_t *pmd)
>  }
>  static inline void ptlock_cache_init(void) {}
>  static inline bool ptlock_init(struct page *page) { return true; }
> -static inline void pte_lock_deinit(struct page *page) {}
> +static inline void ptlock_free(struct page *page) {}
>  #endif /* USE_SPLIT_PTE_PTLOCKS */
>  
>  static inline void pgtable_init(void)
> @@ -1937,7 +1930,7 @@ static inline bool pgtable_page_ctor(struct page *page)
>  
>  static inline void pgtable_page_dtor(struct page *page)
>  {
> -	pte_lock_deinit(page);
> +	ptlock_free(page);
>  	__ClearPageTable(page);
>  	dec_zone_page_state(page, NR_PAGETABLE);
>  }
> -- 
> 2.20.0.rc1.387.gf8505762e3-goog
> 

-- 
Michal Hocko
SUSE Labs

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-11-29  8:39 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-28 23:55 [PATCH] mm: remove pte_lock_deinit() Yu Zhao
2018-11-29  2:42 ` Matthew Wilcox
2018-11-29  8:39 ` Michal Hocko

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.