Skip to contentSkip to conversation

fix __set_page_dirty_no_writeback() return value

PATCH In review Bob Liu 2 participants 3 messages Nov 11, 2010

Subsystems (2)
lore
Share & tools
lore

Bob Liu

author
#0 lore raw

PATCH v3 1/1 fix __set_page_dirty_no_writeback() return value

__set_page_dirty_no_writeback() should return true if it actually transitioned the page from a clean to dirty state although it seems nobody used its return value now.

Change from v2:
* use TestSet to avoid racing

Change from v1:
* preserving cacheline optimisation as Andrew pointed out

---
 mm/page-writeback.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
mm/page-writeback.c +1 -1
index bf85062..1ebfb86 100644
@@ -1158,7 +1158,7 @@ EXPORT_SYMBOL(write_one_page);
 int __set_page_dirty_no_writeback(struct page *page)
 {
 	if (!PageDirty(page))
-		SetPageDirty(page);
+		return !TestSetPageDirty(page);
 	return 0;
 }
 
Signature · 8 lines
1.6.3.3

--
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/ .
Fight unfair telecom policy in Canada: sign http://dissolvethecrtc.ca/
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
#1 lore raw
Quoted 20 lines · Bob Liu

__set_page_dirty_no_writeback() should return true if it actually transitioned the page from a clean to dirty state although it seems nobody used its return value now.

Change from v2:
* use TestSet to avoid racing

Change from v1:
* preserving cacheline optimisation as Andrew pointed out

---
 mm/page-writeback.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
mm/page-writeback.c +0 -0
index bf85062..1ebfb86 100644

mm/page-writeback.c EXPORT_SYMBOL(write_one_page); · line 1163

Quoted 7 lines
mm/page-writeback.c +1 -1
@@ -1158,7 +1158,7 @@ EXPORT_SYMBOL(write_one_page);
 int __set_page_dirty_no_writeback(struct page *page)
 {
 	if (!PageDirty(page))
-		SetPageDirty(page);
+		return !TestSetPageDirty(page);
 	return 0;
 }

No need for a conditional, just return !TestSetPageDirty(page).

--
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/ .
Fight unfair telecom policy in Canada: sign http://dissolvethecrtc.ca/
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#2 lore raw
Quoted 6 lines · David Rientjes
Quoted 6 lines
mm/page-writeback.c +0 -0
index bf85062..1ebfb86 100644
@@ -1158,7 +1158,7 @@ EXPORT_SYMBOL(write_one_page);
 int __set_page_dirty_no_writeback(struct page *page)
Quoted 9 lines

mm/page-writeback.c EXPORT_SYMBOL(write_one_page); · line 1163

Quoted 6 lines
mm/page-writeback.c +1 -1
 {
 	if (!PageDirty(page))
-		SetPageDirty(page);
+		return !TestSetPageDirty(page);
 	return 0;
 }

No need for a conditional, just return !TestSetPageDirty(page).

Oops, just read Andrew's reply to v1 of the patch about the cacheline invalidation of bts, sorry for the noise.

--
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/ .
Fight unfair telecom policy in Canada: sign http://dissolvethecrtc.ca/
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>