lkml.org 
[lkml]   [2021]   [Nov]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [PATCH] mm: reduce spinlock contention in release_pages()
On Wed, Nov 24, 2021 at 03:19:15PM +0000, Hao Lee wrote:
> When several tasks are terminated simultaneously, lots of pages will be
> released, which can cause severe spinlock contention. Other tasks which
> are running on the same core will be seriously affected. We can yield
> cpu to fix this problem.

The realtime people will eat you alive for this suggestion.

> +++ b/mm/swap.c
> @@ -960,8 +960,14 @@ void release_pages(struct page **pages, int nr)
> if (PageLRU(page)) {
> struct lruvec *prev_lruvec = lruvec;
>
> - lruvec = folio_lruvec_relock_irqsave(folio, lruvec,
> +retry:
> + lruvec = folio_lruvec_tryrelock_irqsave(folio, lruvec,
> &flags);
> + if (!lruvec) {
> + cond_resched();
> + goto retry;
> + }
> +
> if (prev_lruvec != lruvec)

\
 
 \ /
  Last update: 2021-11-24 16:58    [W:0.075 / U:0.080 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site