* [PATCH 0/2] Fix PageDoubleMap
@ 2020-06-29 15:19 Matthew Wilcox (Oracle)
2020-06-29 15:19 ` [PATCH 1/2] mm: Move PageDoubleMap bit Matthew Wilcox (Oracle)
2020-06-29 15:19 ` [PATCH 2/2] mm: Simplify PageDoubleMap with PF_SECOND policy Matthew Wilcox (Oracle)
0 siblings, 2 replies; 5+ messages in thread
From: Matthew Wilcox (Oracle) @ 2020-06-29 15:19 UTC (permalink / raw)
To: linux-mm, Andrew Morton; +Cc: Matthew Wilcox (Oracle)
This is a purely theoretical problem for now as none of the filesystems
which use PG_private_2 (ie PG_fscache) are being converted at this time,
but it's confusing to leave it like this.
Matthew Wilcox (Oracle) (2):
mm: Move PageDoubleMap bit
mm: Simplify PageDoubleMap with PF_SECOND policy
include/linux/page-flags.h | 42 ++++++++++----------------------------
1 file changed, 11 insertions(+), 31 deletions(-)
--
2.27.0
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 1/2] mm: Move PageDoubleMap bit
2020-06-29 15:19 [PATCH 0/2] Fix PageDoubleMap Matthew Wilcox (Oracle)
@ 2020-06-29 15:19 ` Matthew Wilcox (Oracle)
2020-06-29 18:34 ` Zi Yan
2020-06-29 15:19 ` [PATCH 2/2] mm: Simplify PageDoubleMap with PF_SECOND policy Matthew Wilcox (Oracle)
1 sibling, 1 reply; 5+ messages in thread
From: Matthew Wilcox (Oracle) @ 2020-06-29 15:19 UTC (permalink / raw)
To: linux-mm, Andrew Morton; +Cc: Matthew Wilcox (Oracle)
PG_private_2 is defined as being PF_ANY (applicable to tail pages
as well as regular & head pages). That means that the first tail
page of a double-map page will appear to have Private2 set. Use the
Workingset bit instead which is defined as PF_HEAD so any attempt to
access the Workingset bit on a tail page will redirect to the head page's
Workingset bit.
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
---
include/linux/page-flags.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h
index 6be1aa559b1e..b4e6051aa311 100644
--- a/include/linux/page-flags.h
+++ b/include/linux/page-flags.h
@@ -164,7 +164,7 @@ enum pageflags {
PG_slob_free = PG_private,
/* Compound pages. Stored in first tail page's flags */
- PG_double_map = PG_private_2,
+ PG_double_map = PG_workingset,
/* non-lru isolated movable page */
PG_isolated = PG_reclaim,
--
2.27.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 2/2] mm: Simplify PageDoubleMap with PF_SECOND policy
2020-06-29 15:19 [PATCH 0/2] Fix PageDoubleMap Matthew Wilcox (Oracle)
2020-06-29 15:19 ` [PATCH 1/2] mm: Move PageDoubleMap bit Matthew Wilcox (Oracle)
@ 2020-06-29 15:19 ` Matthew Wilcox (Oracle)
2020-06-29 18:38 ` Zi Yan
1 sibling, 1 reply; 5+ messages in thread
From: Matthew Wilcox (Oracle) @ 2020-06-29 15:19 UTC (permalink / raw)
To: linux-mm, Andrew Morton; +Cc: Matthew Wilcox (Oracle)
Introduce the new page policy of PF_SECOND which lets us use the
normal pageflags generation machinery to create the various DoubleMap
manipulation functions.
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
---
include/linux/page-flags.h | 40 ++++++++++----------------------------
1 file changed, 10 insertions(+), 30 deletions(-)
diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h
index b4e6051aa311..7182103583d2 100644
--- a/include/linux/page-flags.h
+++ b/include/linux/page-flags.h
@@ -232,6 +232,9 @@ static inline void page_init_poison(struct page *page, size_t size)
*
* PF_NO_COMPOUND:
* the page flag is not relevant for compound pages.
+ *
+ * PF_SECOND:
+ * the page flag is stored in the first tail page.
*/
#define PF_POISONED_CHECK(page) ({ \
VM_BUG_ON_PGFLAGS(PagePoisoned(page), page); \
@@ -247,6 +250,9 @@ static inline void page_init_poison(struct page *page, size_t size)
#define PF_NO_COMPOUND(page, enforce) ({ \
VM_BUG_ON_PGFLAGS(enforce && PageCompound(page), page); \
PF_POISONED_CHECK(page); })
+#define PF_SECOND(page, enforce) ({ \
+ VM_BUG_ON_PGFLAGS(!PageHead(page), page); \
+ PF_POISONED_CHECK(&page[1]); })
/*
* Macros to create function definitions for page flags
@@ -685,42 +691,15 @@ static inline int PageTransTail(struct page *page)
*
* See also __split_huge_pmd_locked() and page_remove_anon_compound_rmap().
*/
-static inline int PageDoubleMap(struct page *page)
-{
- return PageHead(page) && test_bit(PG_double_map, &page[1].flags);
-}
-
-static inline void SetPageDoubleMap(struct page *page)
-{
- VM_BUG_ON_PAGE(!PageHead(page), page);
- set_bit(PG_double_map, &page[1].flags);
-}
-
-static inline void ClearPageDoubleMap(struct page *page)
-{
- VM_BUG_ON_PAGE(!PageHead(page), page);
- clear_bit(PG_double_map, &page[1].flags);
-}
-static inline int TestSetPageDoubleMap(struct page *page)
-{
- VM_BUG_ON_PAGE(!PageHead(page), page);
- return test_and_set_bit(PG_double_map, &page[1].flags);
-}
-
-static inline int TestClearPageDoubleMap(struct page *page)
-{
- VM_BUG_ON_PAGE(!PageHead(page), page);
- return test_and_clear_bit(PG_double_map, &page[1].flags);
-}
-
+PAGEFLAG(DoubleMap, double_map, PF_SECOND)
+ TESTSCFLAG(DoubleMap, double_map, PF_SECOND)
#else
TESTPAGEFLAG_FALSE(TransHuge)
TESTPAGEFLAG_FALSE(TransCompound)
TESTPAGEFLAG_FALSE(TransCompoundMap)
TESTPAGEFLAG_FALSE(TransTail)
PAGEFLAG_FALSE(DoubleMap)
- TESTSETFLAG_FALSE(DoubleMap)
- TESTCLEARFLAG_FALSE(DoubleMap)
+ TESTSCFLAG_FALSE(DoubleMap)
#endif
/*
@@ -885,6 +864,7 @@ static inline int page_has_private(struct page *page)
#undef PF_ONLY_HEAD
#undef PF_NO_TAIL
#undef PF_NO_COMPOUND
+#undef PF_SECOND
#endif /* !__GENERATING_BOUNDS_H */
#endif /* PAGE_FLAGS_H */
--
2.27.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 1/2] mm: Move PageDoubleMap bit
2020-06-29 15:19 ` [PATCH 1/2] mm: Move PageDoubleMap bit Matthew Wilcox (Oracle)
@ 2020-06-29 18:34 ` Zi Yan
0 siblings, 0 replies; 5+ messages in thread
From: Zi Yan @ 2020-06-29 18:34 UTC (permalink / raw)
To: Matthew Wilcox; +Cc: linux-mm, Andrew Morton
[-- Attachment #1: Type: text/plain, Size: 597 bytes --]
On 29 Jun 2020, at 11:19, Matthew Wilcox (Oracle) wrote:
> PG_private_2 is defined as being PF_ANY (applicable to tail pages
> as well as regular & head pages). That means that the first tail
> page of a double-map page will appear to have Private2 set. Use the
> Workingset bit instead which is defined as PF_HEAD so any attempt to
> access the Workingset bit on a tail page will redirect to the head page's
> Workingset bit.
>
> Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Makes sense to me.
Reviewed-by: Zi Yan <ziy@nvidia.com>
—
Best Regards,
Yan Zi
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 854 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 2/2] mm: Simplify PageDoubleMap with PF_SECOND policy
2020-06-29 15:19 ` [PATCH 2/2] mm: Simplify PageDoubleMap with PF_SECOND policy Matthew Wilcox (Oracle)
@ 2020-06-29 18:38 ` Zi Yan
0 siblings, 0 replies; 5+ messages in thread
From: Zi Yan @ 2020-06-29 18:38 UTC (permalink / raw)
To: Matthew Wilcox; +Cc: linux-mm, Andrew Morton
[-- Attachment #1: Type: text/plain, Size: 1021 bytes --]
On 29 Jun 2020, at 11:19, Matthew Wilcox (Oracle) wrote:
> Introduce the new page policy of PF_SECOND which lets us use the
> normal pageflags generation machinery to create the various DoubleMap
> manipulation functions.
>
> Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
> ---
> include/linux/page-flags.h | 40 ++++++++++----------------------------
> 1 file changed, 10 insertions(+), 30 deletions(-)
>
> diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h
> index b4e6051aa311..7182103583d2 100644
> --- a/include/linux/page-flags.h
> +++ b/include/linux/page-flags.h
> @@ -232,6 +232,9 @@ static inline void page_init_poison(struct page *page, size_t size)
> *
> * PF_NO_COMPOUND:
> * the page flag is not relevant for compound pages.
> + *
> + * PF_SECOND:
> + * the page flag is stored in the first tail page.
Just wonder if PF_FIRST_TAIL_PAGE is more informative, although it has more characters to type. :)
—
Best Regards,
Yan Zi
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 854 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2020-06-29 18:38 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-29 15:19 [PATCH 0/2] Fix PageDoubleMap Matthew Wilcox (Oracle)
2020-06-29 15:19 ` [PATCH 1/2] mm: Move PageDoubleMap bit Matthew Wilcox (Oracle)
2020-06-29 18:34 ` Zi Yan
2020-06-29 15:19 ` [PATCH 2/2] mm: Simplify PageDoubleMap with PF_SECOND policy Matthew Wilcox (Oracle)
2020-06-29 18:38 ` Zi Yan
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.