mem-hwpoison: fix page refcount around isolate_lru_page()
Drop first page reference only after calling isolate_lru_page() to keep page stable reference while isolating. Signed-off-by: Konstantin Khlebnikov <khlebnikov@openvz.org> Cc: Andi Kleen <andi@firstfloor.org> Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com> Cc: Mel Gorman <mel@csn.ul.ie> Cc: Lee Schermerhorn <lee.schermerhorn@hp.com> Cc: Rik van Riel <riel@redhat.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
committed by
Linus Torvalds
parent
700c2a46e8
commit
bd486285f2
@@ -1440,16 +1440,12 @@ int soft_offline_page(struct page *page, int flags)
|
|||||||
*/
|
*/
|
||||||
ret = invalidate_inode_page(page);
|
ret = invalidate_inode_page(page);
|
||||||
unlock_page(page);
|
unlock_page(page);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Drop count because page migration doesn't like raised
|
|
||||||
* counts. The page could get re-allocated, but if it becomes
|
|
||||||
* LRU the isolation will just fail.
|
|
||||||
* RED-PEN would be better to keep it isolated here, but we
|
* RED-PEN would be better to keep it isolated here, but we
|
||||||
* would need to fix isolation locking first.
|
* would need to fix isolation locking first.
|
||||||
*/
|
*/
|
||||||
put_page(page);
|
|
||||||
if (ret == 1) {
|
if (ret == 1) {
|
||||||
|
put_page(page);
|
||||||
ret = 0;
|
ret = 0;
|
||||||
pr_info("soft_offline: %#lx: invalidated\n", pfn);
|
pr_info("soft_offline: %#lx: invalidated\n", pfn);
|
||||||
goto done;
|
goto done;
|
||||||
@@ -1461,6 +1457,11 @@ int soft_offline_page(struct page *page, int flags)
|
|||||||
* handles a large number of cases for us.
|
* handles a large number of cases for us.
|
||||||
*/
|
*/
|
||||||
ret = isolate_lru_page(page);
|
ret = isolate_lru_page(page);
|
||||||
|
/*
|
||||||
|
* Drop page reference which is came from get_any_page()
|
||||||
|
* successful isolate_lru_page() already took another one.
|
||||||
|
*/
|
||||||
|
put_page(page);
|
||||||
if (!ret) {
|
if (!ret) {
|
||||||
LIST_HEAD(pagelist);
|
LIST_HEAD(pagelist);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user