Commit e7b72c48 authored by Christophe JAILLET's avatar Christophe JAILLET Committed by Andrew Morton

mm/mremap_pages: save a few cycles in get_dev_pagemap()

Use 'percpu_ref_tryget_live_rcu()' instead of 'percpu_ref_tryget_live()'
to save a few cycles when it is known that the rcu lock is already
taken/released.

Link: https://lkml.kernel.org/r/9ef1562a1975371360f3e263856e9f1c5749b656.1662136782.git.christophe.jaillet@wanadoo.frSigned-off-by: default avatarChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Cc: Matthew Wilcox <willy@infradead.org>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
parent 9a157dd8
...@@ -454,7 +454,7 @@ struct dev_pagemap *get_dev_pagemap(unsigned long pfn, ...@@ -454,7 +454,7 @@ struct dev_pagemap *get_dev_pagemap(unsigned long pfn,
/* fall back to slow path lookup */ /* fall back to slow path lookup */
rcu_read_lock(); rcu_read_lock();
pgmap = xa_load(&pgmap_array, PHYS_PFN(phys)); pgmap = xa_load(&pgmap_array, PHYS_PFN(phys));
if (pgmap && !percpu_ref_tryget_live(&pgmap->ref)) if (pgmap && !percpu_ref_tryget_live_rcu(&pgmap->ref))
pgmap = NULL; pgmap = NULL;
rcu_read_unlock(); rcu_read_unlock();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment