Skip to contentSkip to conversation

page-flags: define PG_locked behavior on compound pages

PATCH Hillf Danton 2 participants 2 messages Mar 20, 2015 1 message not in the archive Memory management

lore
Share & tools
lore
#1 lore raw
In reply to a message not in the archive
Quoted 11 lines
include/linux/page-flags.h +1 -1
@@ -269,7 +269,7 @@ static inline struct page *compound_head_fast(struct page *page)
 	return page;
 }
 
-TESTPAGEFLAG(Locked, locked, ANY)
+__PAGEFLAG(Locked, locked, NO_TAIL)
 PAGEFLAG(Error, error, ANY) TESTCLEARFLAG(Error, error, ANY)
 PAGEFLAG(Referenced, referenced, ANY) TESTCLEARFLAG(Referenced, referenced, ANY)
 	__SETPAGEFLAG(Referenced, referenced, ANY)

[...]

include/linux/page-flags.h extern int wait_on_page_bit_killable_timeout(struct page *page, · line 485

Quoted 9 lines
include/linux/page-flags.h +2 -3
@@ -490,9 +481,9 @@ extern int wait_on_page_bit_killable_timeout(struct page *page,
 
 static inline int wait_on_page_locked_killable(struct page *page)
 {
-	if (PageLocked(page))
-		return wait_on_page_bit_killable(page, PG_locked);
-	return 0;
+	if (!PageLocked(page))
+		return 0;

I am lost here: can we feed any page to NO_TAIL operation?

Quoted 3 lines
include/linux/page-flags.h +1 -0
+	return wait_on_page_bit_killable(compound_head(page), PG_locked);
 }
 
#2 lore raw
Quoted 14 lines · Hillf Danton
Quoted 11 lines
include/linux/page-flags.h +1 -1
@@ -269,7 +269,7 @@ static inline struct page *compound_head_fast(struct page *page)
 	return page;
 }
 
-TESTPAGEFLAG(Locked, locked, ANY)
+__PAGEFLAG(Locked, locked, NO_TAIL)
 PAGEFLAG(Error, error, ANY) TESTCLEARFLAG(Error, error, ANY)
 PAGEFLAG(Referenced, referenced, ANY) TESTCLEARFLAG(Referenced, referenced, ANY)
 	__SETPAGEFLAG(Referenced, referenced, ANY)

[...]

Quoted 2 lines
include/linux/page-flags.h +0 -0
@@ -490,9 +481,9 @@ extern int wait_on_page_bit_killable_timeout(struct page *page,
 
Quoted 9 lines

include/linux/page-flags.h extern int wait_on_page_bit_killable_timeout(struct page *page, · line 485

Quoted 7 lines
include/linux/page-flags.h +2 -3
 static inline int wait_on_page_locked_killable(struct page *page)
 {
-	if (PageLocked(page))
-		return wait_on_page_bit_killable(page, PG_locked);
-	return 0;
+	if (!PageLocked(page))
+		return 0;

I am lost here: can we feed any page to NO_TAIL operation?

NO_TAIL triggers VM_BUG on set/clear, but not on checks. PageLocked() will look on head page.

I tried to enforce policy for checks too, but it triggers all over the kernel. We tend to check random pages.

We can try apply enforcing for *some* flags, but I didn't evaluate that.

Signature · 7 lines
 Kirill A. Shutemov

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>