Message ID | 20240826065814.1336616-3-wangkefeng.wang@huawei.com (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | mm: finish isolate/putback_lru_page() | expand |
On 26.08.24 08:58, Kefeng Wang wrote: > Save two calls to compound_head() and use folio throughout. > > Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com> > --- Acked-by: David Hildenbrand <david@redhat.com>
On Mon, Aug 26, 2024 at 02:58:10PM +0800, Kefeng Wang wrote: > Save two calls to compound_head() and use folio throughout. > > Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com> Reviewed-by: Vishal Moola (Oracle) <vishal.moola@gmail.com>
Kefeng Wang <wangkefeng.wang@huawei.com> writes: > Save two calls to compound_head() and use folio throughout. > > Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com> Reviewed-by: Alistair Popple <apopple@nvidia.com> > --- > mm/migrate_device.c | 9 +++++---- > 1 file changed, 5 insertions(+), 4 deletions(-) > > diff --git a/mm/migrate_device.c b/mm/migrate_device.c > index 82d75205dda8..66db28b89f9b 100644 > --- a/mm/migrate_device.c > +++ b/mm/migrate_device.c > @@ -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; > }
diff --git a/mm/migrate_device.c b/mm/migrate_device.c index 82d75205dda8..66db28b89f9b 100644 --- a/mm/migrate_device.c +++ b/mm/migrate_device.c @@ -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; }
Save two calls to compound_head() and use folio throughout. Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com> --- mm/migrate_device.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)