mirror of
https://github.com/torvalds/linux.git
synced 2024-11-22 12:11:40 +00:00
mm, thp: use list_first_entry_or_null()
Simplify the code with list_first_entry_or_null(). Signed-off-by: Geliang Tang <geliangtang@163.com> Acked-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
8cee852ec5
commit
146693471f
@ -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,
|
||||
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
|
||||
|
Loading…
Reference in New Issue
Block a user