mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-30 15:44:13 +08:00
mm: migrate_device: use a folio in migrate_device_range()
Save two calls to compound_head() and use folio throughout. Link: https://lkml.kernel.org/r/20240826065814.1336616-3-wangkefeng.wang@huawei.com Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com> Acked-by: David Hildenbrand <david@redhat.com> Reviewed-by: Vishal Moola (Oracle) <vishal.moola@gmail.com> Reviewed-by: Alistair Popple <apopple@nvidia.com> Cc: Baolin Wang <baolin.wang@linux.alibaba.com> Cc: Jonathan Corbet <corbet@lwn.net> Cc: Matthew Wilcox (Oracle) <willy@infradead.org> Cc: Zi Yan <ziy@nvidia.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
This commit is contained in:
parent
5c8525a37b
commit
53456b7b3f
@ -898,16 +898,17 @@ int migrate_device_range(unsigned long *src_pfns, unsigned long start,
|
||||
unsigned long i, pfn;
|
||||
|
||||
for (pfn = start, i = 0; i < npages; pfn++, i++) {
|
||||
struct page *page = pfn_to_page(pfn);
|
||||
struct folio *folio;
|
||||
|
||||
if (!get_page_unless_zero(page)) {
|
||||
folio = folio_get_nontail_page(pfn_to_page(pfn));
|
||||
if (!folio) {
|
||||
src_pfns[i] = 0;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!trylock_page(page)) {
|
||||
if (!folio_trylock(folio)) {
|
||||
src_pfns[i] = 0;
|
||||
put_page(page);
|
||||
folio_put(folio);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user