linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: willy@infradead.org
Cc: linux-mm@kvack.org
Subject: [bug report] mm: Convert collapse_shmem to XArray
Date: Tue, 19 Jun 2018 14:29:44 +0300	[thread overview]
Message-ID: <20180619112944.f2fokthjunzavgcw@kili.mountain> (raw)

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

             reply	other threads:[~2018-06-19 11:30 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-19 11:29 Dan Carpenter [this message]
2018-06-19 14:05 ` Matthew Wilcox

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180619112944.f2fokthjunzavgcw@kili.mountain \
    --to=dan.carpenter@oracle.com \
    --cc=linux-mm@kvack.org \
    --cc=willy@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox