[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <007bfe4833c1e47bd313de6a1be65d61aa7e36e2.1447854574.git.geliangtang@163.com>
Date: Wed, 18 Nov 2015 21:52:29 +0800
From: Geliang Tang <geliangtang@....com>
To: Andrew Morton <akpm@...ux-foundation.org>,
"Kirill A. Shutemov" <kirill.shutemov@...ux.intel.com>,
"Aneesh Kumar K.V" <aneesh.kumar@...ux.vnet.ibm.com>,
Vineet Gupta <vgupta@...opsys.com>,
Mel Gorman <mgorman@...e.de>
Cc: Geliang Tang <geliangtang@....com>, linux-mm@...ck.org,
linux-kernel@...r.kernel.org
Subject: [PATCH] mm, thp: use list_first_entry_or_null()
Simplify the code with list_first_entry_or_null().
Signed-off-by: Geliang Tang <geliangtang@....com>
---
mm/pgtable-generic.c | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/mm/pgtable-generic.c b/mm/pgtable-generic.c
index 69261d4..c311a2e 100644
--- a/mm/pgtable-generic.c
+++ b/mm/pgtable-generic.c
@@ -164,13 +164,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
--
2.5.0
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists