Re: [v2 PATCH] mm: thp: handle page cache THP correctly in PageTransCompoundMap

From: Yang Shi
Date: Wed Oct 23 2019 - 13:58:00 EST




On 10/23/19 10:24 AM, Matthew Wilcox wrote:
On Thu, Oct 24, 2019 at 01:05:04AM +0800, Yang Shi wrote:
+ return map_count >= 0 &&
+ map_count == atomic_read(&head[1].compound_mapcount);
}
I didn't like Hugh's duplicate definition either. May I suggest:

Thanks, Willy. It is fine to me. Will take it in v3.


diff --git a/include/linux/mm.h b/include/linux/mm.h
index 2f2199a51941..3d0efd937d2b 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -695,11 +695,6 @@ static inline void *kvcalloc(size_t n, size_t size, gfp_t flags)
extern void kvfree(const void *addr);
-static inline atomic_t *compound_mapcount_ptr(struct page *page)
-{
- return &page[1].compound_mapcount;
-}
-
static inline int compound_mapcount(struct page *page)
{
VM_BUG_ON_PAGE(!PageCompound(page), page);
diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h
index 2222fa795284..270aa8fd2800 100644
--- a/include/linux/mm_types.h
+++ b/include/linux/mm_types.h
@@ -221,6 +221,11 @@ struct page {
#endif
} _struct_page_alignment;
+static inline atomic_t *compound_mapcount_ptr(struct page *page)
+{
+ return &page[1].compound_mapcount;
+}
+
/*
* Used for sizing the vmemmap region on some architectures
*/