Skip to content

Commit f709239

Browse files
Matthew Wilcox (Oracle)akpm00
authored andcommitted
memory-failure: convert delete_from_lru_cache() to take a folio
All three callers now have a folio; pass it in instead of the page. Saves five calls to compound_head(). Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Matthew Wilcox (Oracle) <[email protected]> Cc: Naoya Horiguchi <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
1 parent 6304b53 commit f709239

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

mm/memory-failure.c

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -902,26 +902,26 @@ static const char * const action_page_types[] = {
902902
* The page count will stop it from being freed by unpoison.
903903
* Stress tests should be aware of this memory leak problem.
904904
*/
905-
static int delete_from_lru_cache(struct page *p)
905+
static int delete_from_lru_cache(struct folio *folio)
906906
{
907-
if (isolate_lru_page(p)) {
907+
if (folio_isolate_lru(folio)) {
908908
/*
909909
* Clear sensible page flags, so that the buddy system won't
910-
* complain when the page is unpoison-and-freed.
910+
* complain when the folio is unpoison-and-freed.
911911
*/
912-
ClearPageActive(p);
913-
ClearPageUnevictable(p);
912+
folio_clear_active(folio);
913+
folio_clear_unevictable(folio);
914914

915915
/*
916916
* Poisoned page might never drop its ref count to 0 so we have
917917
* to uncharge it manually from its memcg.
918918
*/
919-
mem_cgroup_uncharge(page_folio(p));
919+
mem_cgroup_uncharge(folio);
920920

921921
/*
922-
* drop the page count elevated by isolate_lru_page()
922+
* drop the refcount elevated by folio_isolate_lru()
923923
*/
924-
put_page(p);
924+
folio_put(folio);
925925
return 0;
926926
}
927927
return -EIO;
@@ -1019,7 +1019,7 @@ static int me_pagecache_clean(struct page_state *ps, struct page *p)
10191019
struct address_space *mapping;
10201020
bool extra_pins;
10211021

1022-
delete_from_lru_cache(p);
1022+
delete_from_lru_cache(folio);
10231023

10241024
/*
10251025
* For anonymous folios the only reference left
@@ -1146,7 +1146,7 @@ static int me_swapcache_dirty(struct page_state *ps, struct page *p)
11461146
/* Trigger EIO in shmem: */
11471147
folio_clear_uptodate(folio);
11481148

1149-
ret = delete_from_lru_cache(p) ? MF_FAILED : MF_DELAYED;
1149+
ret = delete_from_lru_cache(folio) ? MF_FAILED : MF_DELAYED;
11501150
folio_unlock(folio);
11511151

11521152
if (ret == MF_DELAYED)
@@ -1165,7 +1165,7 @@ static int me_swapcache_clean(struct page_state *ps, struct page *p)
11651165

11661166
delete_from_swap_cache(folio);
11671167

1168-
ret = delete_from_lru_cache(p) ? MF_FAILED : MF_RECOVERED;
1168+
ret = delete_from_lru_cache(folio) ? MF_FAILED : MF_RECOVERED;
11691169
folio_unlock(folio);
11701170

11711171
if (has_extra_refcount(ps, p, false))

0 commit comments

Comments
 (0)