* [bug report] mm: Convert collapse_shmem to XArray
@ 2018-06-19 11:29 Dan Carpenter
2018-06-19 14:05 ` Matthew Wilcox
0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2018-06-19 11:29 UTC (permalink / raw)
To: willy; +Cc: linux-mm
Hello Matthew Wilcox,
The patch d31429cb560d: "mm: Convert collapse_shmem to XArray" from
Dec 4, 2017, leads to the following static checker warning:
mm/khugepaged.c:1435 collapse_shmem()
error: double unlock 'irq:'
mm/khugepaged.c
1398 xas_unlock_irq(&xas);
1399
1400 if (isolate_lru_page(page)) {
1401 result = SCAN_DEL_PAGE_LRU;
1402 goto out_isolate_failed;
1403 }
1404
1405 if (page_mapped(page))
1406 unmap_mapping_pages(mapping, index, 1, false);
1407
1408 xas_lock(&xas);
^^^^^^^^^^^^^^
This used to disable IRQs.
1409 xas_set(&xas, index);
1410
1411 VM_BUG_ON_PAGE(page != xas_load(&xas), page);
1412 VM_BUG_ON_PAGE(page_mapped(page), page);
1413
1414 /*
1415 * The page is expected to have page_count() == 3:
1416 * - we hold a pin on it;
1417 * - one reference from page cache;
1418 * - one from isolate_lru_page;
1419 */
1420 if (!page_ref_freeze(page, 3)) {
1421 result = SCAN_PAGE_COUNT;
1422 goto out_lru;
1423 }
1424
1425 /*
1426 * Add the page to the list to be able to undo the collapse if
1427 * something go wrong.
1428 */
1429 list_add_tail(&page->lru, &pagelist);
1430
1431 /* Finally, replace with the new page. */
1432 xas_store(&xas, new_page + (index % HPAGE_PMD_NR));
1433 continue;
1434 out_lru:
1435 xas_unlock_irq(&xas);
^^^^^^^^^^^^^^^^^^^
So I guess we should change this to xas_unlock(&xas);?
1436 putback_lru_page(page);
1437 out_isolate_failed:
1438 unlock_page(page);
1439 put_page(page);
1440 goto xa_unlocked;
1441 out_unlock:
regards,
dan carpenter
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [bug report] mm: Convert collapse_shmem to XArray
2018-06-19 11:29 [bug report] mm: Convert collapse_shmem to XArray Dan Carpenter
@ 2018-06-19 14:05 ` Matthew Wilcox
0 siblings, 0 replies; 2+ messages in thread
From: Matthew Wilcox @ 2018-06-19 14:05 UTC (permalink / raw)
To: Dan Carpenter; +Cc: linux-mm
On Tue, Jun 19, 2018 at 02:29:44PM +0300, Dan Carpenter wrote:
> Hello Matthew Wilcox,
>
> The patch d31429cb560d: "mm: Convert collapse_shmem to XArray" from
> Dec 4, 2017, leads to the following static checker warning:
>
> mm/khugepaged.c:1435 collapse_shmem()
> error: double unlock 'irq:'
>
> mm/khugepaged.c
> 1398 xas_unlock_irq(&xas);
> 1399
> 1400 if (isolate_lru_page(page)) {
> 1401 result = SCAN_DEL_PAGE_LRU;
> 1402 goto out_isolate_failed;
> 1403 }
> 1404
> 1405 if (page_mapped(page))
> 1406 unmap_mapping_pages(mapping, index, 1, false);
> 1407
> 1408 xas_lock(&xas);
> ^^^^^^^^^^^^^^
> This used to disable IRQs.
*headdesk*. Thanks, fix pushed.
> 1434 out_lru:
> 1435 xas_unlock_irq(&xas);
> ^^^^^^^^^^^^^^^^^^^
> So I guess we should change this to xas_unlock(&xas);?
Nah, other way around. No idea why I had xas_lock() there instead of
xas_lock_irq().
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-06-19 14:06 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-19 11:29 [bug report] mm: Convert collapse_shmem to XArray Dan Carpenter
2018-06-19 14:05 ` Matthew Wilcox
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox