@@ -109,6 +109,7 @@ enum pageflags {
#ifdef CONFIG_TRANSPARENT_HUGEPAGE
PG_compound_lock,
#endif
+ PG_stable, /* page is immutable during a writeout */
__NR_PAGEFLAGS,
/* Filesystems */
@@ -208,6 +209,7 @@ PAGEFLAG(Pinned, pinned) TESTSCFLAG(Pinned, pinned) /* Xen */
PAGEFLAG(SavePinned, savepinned); /* Xen */
PAGEFLAG(Reserved, reserved) __CLEARPAGEFLAG(Reserved, reserved)
PAGEFLAG(SwapBacked, swapbacked) __CLEARPAGEFLAG(SwapBacked, swapbacked)
+PAGEFLAG(Stable, stable) TESTSETFLAG(Stable, stable)
__PAGEFLAG(SlobFree, slob_free)
@@ -399,6 +399,7 @@ static inline void wait_on_page_writeback(struct page *page)
extern void end_page_writeback(struct page *page);
void wait_for_stable_page(struct page *page);
+void clear_page_stable(struct page *page);
/*
* Add an arbitrary waiter to a page's wait queue
@@ -534,6 +534,13 @@ static inline void wake_up_page(struct page *page, int bit)
__wake_up_bit(page_waitqueue(page), &page->flags, bit);
}
+void clear_page_stable(struct page *page)
+{
+ ClearPageStable(page);
+ wake_up_page(page, PG_stable);
+}
+EXPORT_SYMBOL_GPL(clear_page_stable);
+
void wait_on_page_bit(struct page *page, int bit_nr)
{
DEFINE_WAIT_BIT(wait, &page->flags, bit_nr);
@@ -608,6 +615,7 @@ void end_page_writeback(struct page *page)
smp_mb__after_clear_bit();
wake_up_page(page, PG_writeback);
+ wake_up_page(page, PG_stable);
}
EXPORT_SYMBOL(end_page_writeback);
@@ -2209,6 +2209,7 @@ int test_clear_page_writeback(struct page *page)
unsigned long flags;
spin_lock_irqsave(&mapping->tree_lock, flags);
+ ClearPageStable(page);
ret = TestClearPageWriteback(page);
if (ret) {
radix_tree_tag_clear(&mapping->page_tree,
@@ -2221,6 +2222,7 @@ int test_clear_page_writeback(struct page *page)
}
spin_unlock_irqrestore(&mapping->tree_lock, flags);
} else {
+ ClearPageStable(page);
ret = TestClearPageWriteback(page);
}
if (ret) {
@@ -2240,6 +2242,7 @@ int test_set_page_writeback(struct page *page)
unsigned long flags;
spin_lock_irqsave(&mapping->tree_lock, flags);
+ SetPageStable(page);
ret = TestSetPageWriteback(page);
if (!ret) {
radix_tree_tag_set(&mapping->page_tree,
@@ -2257,6 +2260,7 @@ int test_set_page_writeback(struct page *page)
PAGECACHE_TAG_TOWRITE);
spin_unlock_irqrestore(&mapping->tree_lock, flags);
} else {
+ SetPageStable(page);
ret = TestSetPageWriteback(page);
}
if (!ret)
@@ -2291,6 +2295,7 @@ void wait_for_stable_page(struct page *page)
if (!bdi_cap_stable_pages_required(bdi))
return;
- wait_on_page_writeback(page);
+ if (PageStable(page))
+ wait_on_page_bit(page, PG_stable);
}
EXPORT_SYMBOL_GPL(wait_for_stable_page);
@@ -6056,6 +6056,9 @@ static const struct trace_print_flags pageflag_names[] = {
#ifdef CONFIG_TRANSPARENT_HUGEPAGE
{1UL << PG_compound_lock, "compound_lock" },
#endif
+#ifdef CONFIG_BLK_DEV_INTEGRITY
+ {1UL << PG_stable, "stable" },
+#endif
};
static void dump_page_flags(unsigned long flags)
This patch adds yet another page flag, PG_stable, to indicate that the page's contents must not be changed because the page is undergoing some sort of integrity operation (checksumming, digest calculation, etc.) This change should enable us to reduce page write latency in userspace apps, particularly for things like networked filesystems where the page contents needn't be held stable after a write request is transmitted, even though PG_writeback is still set. Also, convert wait_for_stable_page to use this new page flag. By default, PG_stable is set for the same duration as PG_writeback. Signed-off-by: Darick J. Wong <darrick.wong@oracle.com> --- include/linux/page-flags.h | 2 ++ include/linux/pagemap.h | 1 + mm/filemap.c | 8 ++++++++ mm/page-writeback.c | 7 ++++++- mm/page_alloc.c | 3 +++ 5 files changed, 20 insertions(+), 1 deletion(-) -- To unsubscribe from this list: send the line "unsubscribe linux-ext4" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html