Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commite6e8871

Browse files
Matthew Wilcox (Oracle)torvalds
Matthew Wilcox (Oracle)
authored andcommitted
mm: optimise madvise WILLNEED
Instead of calling find_get_entry() for every page index, use an XArrayiterator to skip over NULL entries, and avoid calling get_page(),because we only want the swap entries.[willy@infradead.org: fix LTP soft lockups] Link:https://lkml.kernel.org/r/20200914165032.GS6583@casper.infradead.orgSigned-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>Signed-off-by: Andrew Morton <akpm@linux-foundation.org>Acked-by: Johannes Weiner <hannes@cmpxchg.org>Cc: Alexey Dobriyan <adobriyan@gmail.com>Cc: Chris Wilson <chris@chris-wilson.co.uk>Cc: Huang Ying <ying.huang@intel.com>Cc: Hugh Dickins <hughd@google.com>Cc: Jani Nikula <jani.nikula@linux.intel.com>Cc: Matthew Auld <matthew.auld@intel.com>Cc: William Kucharski <william.kucharski@oracle.com>Cc: Qian Cai <cai@redhat.com>Link:https://lkml.kernel.org/r/20200910183318.20139-4-willy@infradead.orgSigned-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parentf5df863 commite6e8871

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

‎mm/madvise.c‎

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -224,25 +224,28 @@ static void force_shm_swapin_readahead(struct vm_area_struct *vma,
224224
unsigned longstart,unsigned longend,
225225
structaddress_space*mapping)
226226
{
227-
pgoff_tindex;
227+
XA_STATE(xas,&mapping->i_pages,linear_page_index(vma,start));
228+
pgoff_tend_index=end /PAGE_SIZE;
228229
structpage*page;
229-
swp_entry_tswap;
230230

231-
for (;start<end;start+=PAGE_SIZE) {
232-
index= ((start-vma->vm_start) >>PAGE_SHIFT)+vma->vm_pgoff;
231+
rcu_read_lock();
232+
xas_for_each(&xas,page,end_index) {
233+
swp_entry_tswap;
233234

234-
page=find_get_entry(mapping,index);
235-
if (!xa_is_value(page)) {
236-
if (page)
237-
put_page(page);
235+
if (!xa_is_value(page))
238236
continue;
239-
}
237+
xas_pause(&xas);
238+
rcu_read_unlock();
239+
240240
swap=radix_to_swp_entry(page);
241241
page=read_swap_cache_async(swap,GFP_HIGHUSER_MOVABLE,
242242
NULL,0, false);
243243
if (page)
244244
put_page(page);
245+
246+
rcu_read_lock();
245247
}
248+
rcu_read_unlock();
246249

247250
lru_add_drain();/* Push any new pages onto the LRU now */
248251
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp