Skip to contentSkip to conversation

mm/zswap: avoid unnecessary page scanning

PATCH Superseded Weijie Yang 4 participants 5 messages Sep 6, 2013 – Sep 23, 2013

Subsystems (2)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 3/4 mm/zswap: avoid unnecessary page scanning

add SetPageReclaim before __swap_writepage so that page can be moved to the tail of the inactive list, which can avoid unnecessary page scanning as this page was reclaimed by swap subsystem before.

---
 mm/zswap.c |    3 +++
 1 file changed, 3 insertions(+)
mm/zswap.c +3 -0
index 1be7b90..cc40e6a 100644
@@ -556,6 +556,9 @@ static int zswap_writeback_entry(struct zbud_pool *pool, unsigned long handle)
 		SetPageUptodate(page);
 	}
 
+	/* move it to the tail of the inactive list after end_writeback */
+	SetPageReclaim(page);
+
 	/* start writeback */
 	__swap_writepage(page, &wbc, end_swap_bio_write);
 	page_cache_release(page);
Signature · 8 lines
1.7.10.4


--
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>
Reviewed-by on v2 3/4
#1 lore raw
Quoted 5 lines · Weijie Yang

add SetPageReclaim before __swap_writepage so that page can be moved to the tail of the inactive list, which can avoid unnecessary page scanning as this page was reclaimed by swap subsystem before.

Quoted 19 lines
---
 mm/zswap.c |    3 +++
 1 file changed, 3 insertions(+)
mm/zswap.c +3 -0
index 1be7b90..cc40e6a 100644
@@ -556,6 +556,9 @@ static int zswap_writeback_entry(struct zbud_pool *pool, unsigned long handle)
 		SetPageUptodate(page);
 	}
 
+	/* move it to the tail of the inactive list after end_writeback */
+	SetPageReclaim(page);
+
 	/* start writeback */
 	__swap_writepage(page, &wbc, end_swap_bio_write);
 	page_cache_release(page);
Signature · 8 lines
Regards,
-Bob

--
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>
Acked-by on v2 3/4
#2 lore raw
In reply to Weijie Yang
Quoted 5 lines · Weijie Yang

add SetPageReclaim before __swap_writepage so that page can be moved to the tail of the inactive list, which can avoid unnecessary page scanning as this page was reclaimed by swap subsystem before.

--
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>

#3 lore raw
Quoted 9 lines · Seth Jennings
Quoted 5 lines · Weijie Yang

add SetPageReclaim before __swap_writepage so that page can be moved to the tail of the inactive list, which can avoid unnecessary page scanning as this page was reclaimed by swap subsystem before.

Below is a reply from Mel in original thread "[PATCHv11 3/4] zswap: add to mm/"
------------------

Review

Quoted 6 lines
(quoted diff) +6 -0
+     /* start writeback */
+     SetPageReclaim(page);
+     __swap_writepage(page, &wbc, end_swap_bio_write);
+     page_cache_release(page);
+     zswap_written_back_pages++;
+

SetPageReclaim? Why?. If the page is under writeback then why do you not mark it as that? Do not free pages that are currently under writeback obviously. It's likely that it was PageWriteback you wanted in zbud.c too.
--------------------

Signature · 8 lines
Regards,
-Bob

--
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>
#4 lore raw
Quoted 22 lines · Bob Liu
Quoted 9 lines · Seth Jennings
Quoted 5 lines · Weijie Yang

add SetPageReclaim before __swap_writepage so that page can be moved to the tail of the inactive list, which can avoid unnecessary page scanning as this page was reclaimed by swap subsystem before.

Below is a reply from Mel in original thread "[PATCHv11 3/4] zswap: add to mm/"
------------------

Review

Quoted 6 lines
(quoted diff) +6 -0
+     /* start writeback */
+     SetPageReclaim(page);
+     __swap_writepage(page, &wbc, end_swap_bio_write);
+     page_cache_release(page);
+     zswap_written_back_pages++;
+
Quoted 4 lines

SetPageReclaim? Why?. If the page is under writeback then why do you not mark it as that? Do not free pages that are currently under writeback obviously. It's likely that it was PageWriteback you wanted in zbud.c too.
--------------------

Thanks for reminding this.

The purpose of using this flag in PATCHv11 and this patch is different.

In PATCHv11, it was repurposed to protect zbud page against free, and now it is replaced with zhdr->under_reclaim.

In this patch, this flag is for its original purpose(to be reclaimed asap)

Quoted 3 lines

--
Regards,
-Bob

--
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>