static inline void flush_dcache_page(struct page *page)
 {
+       /*
+        * HugeTLB pages are always fully mapped and only head page will be
+        * set PG_dcache_clean (see comments in flush_icache_pte()).
+        */
+       if (PageHuge(page))
+               page = compound_head(page);
+
        if (test_bit(PG_dcache_clean, &page->flags))
                clear_bit(PG_dcache_clean, &page->flags);
 }
 
 {
        struct page *page = pte_page(pte);
 
+       /*
+        * HugeTLB pages are always fully mapped, so only setting head page's
+        * PG_dcache_clean flag is enough.
+        */
+       if (PageHuge(page))
+               page = compound_head(page);
+
        if (!test_and_set_bit(PG_dcache_clean, &page->flags))
                flush_icache_all();
 }