CC: [email protected] TO: Andrea Arcangeli <[email protected]>
tree: https://git.kernel.org/pub/scm/linux/kernel/git/andrea/aa.git master head: 2367bdec639e23db43643411bbf401a1663ae490 commit: ae59cacff9fd0c5b2de60a74e3bf35197c48d976 [8/31] mm: thp: make the THP total_mapcount atomic against rmap add/remove :::::: branch date: 7 hours ago :::::: commit date: 7 hours ago config: i386-randconfig-s002-20210122 (attached as .config) compiler: gcc-9 (Debian 9.3.0-20) 9.3.0 reproduce: # apt-get install sparse # sparse version: v0.6.3-208-g46a52ca4-dirty # https://git.kernel.org/pub/scm/linux/kernel/git/andrea/aa.git/commit/?id=ae59cacff9fd0c5b2de60a74e3bf35197c48d976 git remote add aa https://git.kernel.org/pub/scm/linux/kernel/git/andrea/aa.git git fetch --no-tags aa master git checkout ae59cacff9fd0c5b2de60a74e3bf35197c48d976 # save the attached .config to linux build tree make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=i386 If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot <[email protected]> "sparse warnings: (new ones prefixed by >>)" mm/rmap.c: note: in included file (through include/linux/ksm.h): include/linux/rmap.h:219:28: sparse: sparse: context imbalance in 'page_referenced_one' - unexpected unlock >> mm/rmap.c:1248:26: sparse: sparse: context imbalance in 'page_add_file_rmap' >> - different lock contexts for basic block include/linux/rmap.h:219:28: sparse: sparse: context imbalance in 'try_to_unmap_one' - unexpected unlock vim +/page_add_file_rmap +1248 mm/rmap.c 9617d95e6e9ffd88 Nick Piggin 2006-01-06 1199 ^1da177e4c3f4152 Linus Torvalds 2005-04-16 1200 /** ^1da177e4c3f4152 Linus Torvalds 2005-04-16 1201 * page_add_file_rmap - add pte mapping to a file page ^1da177e4c3f4152 Linus Torvalds 2005-04-16 1202 * @page: the page to add the mapping to e8b098fc5747a7c8 Mike Rapoport 2018-04-05 1203 * @compound: charge the page as compound or small page ^1da177e4c3f4152 Linus Torvalds 2005-04-16 1204 * b8072f099b7829a6 Hugh Dickins 2005-10-29 1205 * The caller needs to hold the pte lock. ^1da177e4c3f4152 Linus Torvalds 2005-04-16 1206 */ dd78fedde4b99b32 Kirill A. Shutemov 2016-07-26 1207 void page_add_file_rmap(struct page *page, bool compound) ^1da177e4c3f4152 Linus Torvalds 2005-04-16 1208 { dd78fedde4b99b32 Kirill A. Shutemov 2016-07-26 1209 int i, nr = 1; dd78fedde4b99b32 Kirill A. Shutemov 2016-07-26 1210 dd78fedde4b99b32 Kirill A. Shutemov 2016-07-26 1211 VM_BUG_ON_PAGE(compound && !PageTransHuge(page), page); 62cccb8c8e7a3ca2 Johannes Weiner 2016-03-15 1212 lock_page_memcg(page); dd78fedde4b99b32 Kirill A. Shutemov 2016-07-26 1213 if (compound && PageTransHuge(page)) { ae59cacff9fd0c5b Andrea Arcangeli 2021-01-13 1214 bool last; ae59cacff9fd0c5b Andrea Arcangeli 2021-01-13 1215 page_mapcount_lock(page); 5eaf35ab1275c404 Matthew Wilcox (Oracle 2020-10-15 1216) for (i = 0, nr = 0; i < thp_nr_pages(page); i++) { dd78fedde4b99b32 Kirill A. Shutemov 2016-07-26 1217 if (atomic_inc_and_test(&page[i]._mapcount)) dd78fedde4b99b32 Kirill A. Shutemov 2016-07-26 1218 nr++; d69b042f3d7406dd Balbir Singh 2009-06-17 1219 } ae59cacff9fd0c5b Andrea Arcangeli 2021-01-13 1220 last = atomic_inc_and_test(compound_mapcount_ptr(page)); ae59cacff9fd0c5b Andrea Arcangeli 2021-01-13 1221 page_mapcount_unlock(page); ae59cacff9fd0c5b Andrea Arcangeli 2021-01-13 1222 if (!last) dd78fedde4b99b32 Kirill A. Shutemov 2016-07-26 1223 goto out; 99cb0dbd47a15d39 Song Liu 2019-09-23 1224 if (PageSwapBacked(page)) 11fb998986a72aa7 Mel Gorman 2016-07-28 1225 __inc_node_page_state(page, NR_SHMEM_PMDMAPPED); 99cb0dbd47a15d39 Song Liu 2019-09-23 1226 else 99cb0dbd47a15d39 Song Liu 2019-09-23 1227 __inc_node_page_state(page, NR_FILE_PMDMAPPED); dd78fedde4b99b32 Kirill A. Shutemov 2016-07-26 1228 } else { ae59cacff9fd0c5b Andrea Arcangeli 2021-01-13 1229 struct page *head = NULL; ae59cacff9fd0c5b Andrea Arcangeli 2021-01-13 1230 bool last; c8efc390c1e0eca1 Kirill A. Shutemov 2016-08-10 1231 if (PageTransCompound(page) && page_mapping(page)) { c8efc390c1e0eca1 Kirill A. Shutemov 2016-08-10 1232 VM_WARN_ON_ONCE(!PageLocked(page)); c8efc390c1e0eca1 Kirill A. Shutemov 2016-08-10 1233 ae59cacff9fd0c5b Andrea Arcangeli 2021-01-13 1234 head = compound_head(page); ae59cacff9fd0c5b Andrea Arcangeli 2021-01-13 1235 page_mapcount_lock(head); 9a73f61bdb8acdc0 Kirill A. Shutemov 2016-07-26 1236 SetPageDoubleMap(compound_head(page)); 9a73f61bdb8acdc0 Kirill A. Shutemov 2016-07-26 1237 if (PageMlocked(page)) 9a73f61bdb8acdc0 Kirill A. Shutemov 2016-07-26 1238 clear_page_mlock(compound_head(page)); 9a73f61bdb8acdc0 Kirill A. Shutemov 2016-07-26 1239 } ae59cacff9fd0c5b Andrea Arcangeli 2021-01-13 1240 last = atomic_inc_and_test(&page->_mapcount); ae59cacff9fd0c5b Andrea Arcangeli 2021-01-13 1241 if (head) ae59cacff9fd0c5b Andrea Arcangeli 2021-01-13 1242 page_mapcount_unlock(head); ae59cacff9fd0c5b Andrea Arcangeli 2021-01-13 1243 if (!last) dd78fedde4b99b32 Kirill A. Shutemov 2016-07-26 1244 goto out; dd78fedde4b99b32 Kirill A. Shutemov 2016-07-26 1245 } 00f3ca2c2d6635d8 Johannes Weiner 2017-07-06 1246 __mod_lruvec_page_state(page, NR_FILE_MAPPED, nr); dd78fedde4b99b32 Kirill A. Shutemov 2016-07-26 1247 out: 62cccb8c8e7a3ca2 Johannes Weiner 2016-03-15 @1248 unlock_page_memcg(page); ^1da177e4c3f4152 Linus Torvalds 2005-04-16 1249 } ^1da177e4c3f4152 Linus Torvalds 2005-04-16 1250 :::::: The code at line 1248 was first introduced by commit :::::: 62cccb8c8e7a3ca233f49d5e7dcb1557d25465cd mm: simplify lock_page_memcg() :::::: TO: Johannes Weiner <[email protected]> :::::: CC: Linus Torvalds <[email protected]> --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/[email protected]
.config.gz
Description: application/gzip
_______________________________________________ kbuild mailing list -- [email protected] To unsubscribe send an email to [email protected]
