Skip to content

Commit

Permalink
mm, thp: use list_first_entry_or_null()
Browse files Browse the repository at this point in the history
Simplify the code with list_first_entry_or_null().

Signed-off-by: Geliang Tang <[email protected]>
Acked-by: Kirill A. Shutemov <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
geliangtang authored and torvalds committed Jan 15, 2016
1 parent 8cee852 commit 1466934
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions mm/pgtable-generic.c
Original file line number Diff line number Diff line change
Expand Up @@ -176,13 +176,10 @@ pgtable_t pgtable_trans_huge_withdraw(struct mm_struct *mm, pmd_t *pmdp)

/* FIFO */
pgtable = pmd_huge_pte(mm, pmdp);
if (list_empty(&pgtable->lru))
pmd_huge_pte(mm, pmdp) = NULL;
else {
pmd_huge_pte(mm, pmdp) = list_entry(pgtable->lru.next,
struct page, lru);
pmd_huge_pte(mm, pmdp) = list_first_entry_or_null(&pgtable->lru,
struct page, lru);
if (pmd_huge_pte(mm, pmdp))
list_del(&pgtable->lru);
}
return pgtable;
}
#endif
Expand Down

0 comments on commit 1466934

Please sign in to comment.