@@ -68,10 +68,20 @@ static void check_element(mempool_t *pool, void *element)
6868 } else if (pool -> free == mempool_free_pages ) {
6969 /* Mempools backed by page allocator */
7070 int order = (int )(long )pool -> pool_data ;
71- void * addr = kmap_local_page ((struct page * )element );
7271
73- __check_element (pool , addr , 1UL << (PAGE_SHIFT + order ));
74- kunmap_local (addr );
72+ #ifdef CONFIG_HIGHMEM
73+ for (int i = 0 ; i < (1 << order ); i ++ ) {
74+ struct page * page = (struct page * )element ;
75+ void * addr = kmap_local_page (page + i );
76+
77+ __check_element (pool , addr , PAGE_SIZE );
78+ kunmap_local (addr );
79+ }
80+ #else
81+ void * addr = page_address ((struct page * )element );
82+
83+ __check_element (pool , addr , PAGE_SIZE << order );
84+ #endif
7585 }
7686}
7787
@@ -97,10 +107,20 @@ static void poison_element(mempool_t *pool, void *element)
97107 } else if (pool -> alloc == mempool_alloc_pages ) {
98108 /* Mempools backed by page allocator */
99109 int order = (int )(long )pool -> pool_data ;
100- void * addr = kmap_local_page ((struct page * )element );
101110
102- __poison_element (addr , 1UL << (PAGE_SHIFT + order ));
103- kunmap_local (addr );
111+ #ifdef CONFIG_HIGHMEM
112+ for (int i = 0 ; i < (1 << order ); i ++ ) {
113+ struct page * page = (struct page * )element ;
114+ void * addr = kmap_local_page (page + i );
115+
116+ __poison_element (addr , PAGE_SIZE );
117+ kunmap_local (addr );
118+ }
119+ #else
120+ void * addr = page_address ((struct page * )element );
121+
122+ __poison_element (addr , PAGE_SIZE << order );
123+ #endif
104124 }
105125}
106126#else /* CONFIG_SLUB_DEBUG_ON */
0 commit comments