From: Kirill A. Shutemov Date: Tue, 7 Apr 2015 23:44:26 +0000 (+1000) Subject: page-flags: define PG_uptodate behavior on compound pages X-Git-Tag: KARO-TXA5-2015-06-26~18^2~317 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=9802775f2a29851ad38bfb1d782f0f6eb30da21b;p=karo-tx-linux.git page-flags: define PG_uptodate behavior on compound pages We use PG_uptodate on head pages on transparent huge page. Let's use NO_TAIL. Signed-off-by: Kirill A. Shutemov Cc: Andrea Arcangeli Cc: Hugh Dickins Cc: Dave Hansen Cc: Mel Gorman Cc: Rik van Riel Cc: Vlastimil Babka Cc: Christoph Lameter Cc: Naoya Horiguchi Cc: Steve Capper Cc: "Aneesh Kumar K.V" Cc: Johannes Weiner Cc: Michal Hocko Cc: Jerome Marchand Signed-off-by: Andrew Morton --- diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h index 0b6921d2f2f3..55a69c40e4ae 100644 --- a/include/linux/page-flags.h +++ b/include/linux/page-flags.h @@ -408,8 +408,9 @@ u64 stable_page_flags(struct page *page); static inline int PageUptodate(struct page *page) { - int ret = test_bit(PG_uptodate, &(page)->flags); - + int ret; + page = compound_head(page); + ret = test_bit(PG_uptodate, &(page)->flags); /* * Must ensure that the data we read out of the page is loaded * _after_ we've loaded page->flags to check for PageUptodate. @@ -426,12 +427,14 @@ static inline int PageUptodate(struct page *page) static inline void __SetPageUptodate(struct page *page) { + VM_BUG_ON_PAGE(PageTail(page), page); smp_wmb(); __set_bit(PG_uptodate, &page->flags); } static inline void SetPageUptodate(struct page *page) { + VM_BUG_ON_PAGE(PageTail(page), page); /* * Memory barrier must be issued before setting the PG_uptodate bit, * so that all previous stores issued in order to bring the page @@ -441,7 +444,7 @@ static inline void SetPageUptodate(struct page *page) set_bit(PG_uptodate, &page->flags); } -CLEARPAGEFLAG(Uptodate, uptodate, ANY) +CLEARPAGEFLAG(Uptodate, uptodate, NO_TAIL) int test_clear_page_writeback(struct page *page); int __test_set_page_writeback(struct page *page, bool keep_write);