linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: "Huang, Ying" <ying.huang@intel.com>
To: Barry Song <21cnbao@gmail.com>
Cc: akpm@linux-foundation.org,  linux-mm@kvack.org,
	linux-kernel@vger.kernel.org,  Barry Song <v-songbaohua@oppo.com>,
	Kairui Song <kasong@tencent.com>,  Yu Zhao <yuzhao@google.com>,
	 David Hildenbrand <david@redhat.com>,
	 Chris Li <chrisl@kernel.org>,  Hugh Dickins <hughd@google.com>,
	 Johannes Weiner <hannes@cmpxchg.org>,
	Matthew Wilcox <willy@infradead.org>,
	 Michal Hocko <mhocko@suse.com>, Minchan Kim <minchan@kernel.org>,
	 Yosry Ahmed <yosryahmed@google.com>,
	SeongJae Park <sj@kernel.org>,
	 Kalesh Singh <kaleshsingh@google.com>,
	Suren Baghdasaryan <surenb@google.com>,
	 stable@vger.kernel.org,  Oven Liyang <liyangouwen1@oppo.com>
Subject: Re: [PATCH] mm: avoid unconditional one-tick sleep when swapcache_prepare fails
Date: Sun, 29 Sep 2024 10:39:38 +0800	[thread overview]
Message-ID: <871q13qj2t.fsf@yhuang6-desk2.ccr.corp.intel.com> (raw)
In-Reply-To: <20240926211936.75373-1-21cnbao@gmail.com> (Barry Song's message of "Fri, 27 Sep 2024 09:19:36 +1200")

Hi, Barry,

Barry Song <21cnbao@gmail.com> writes:

> From: Barry Song <v-songbaohua@oppo.com>
>
> Commit 13ddaf26be32 ("mm/swap: fix race when skipping swapcache")
> introduced an unconditional one-tick sleep when `swapcache_prepare()`
> fails, which has led to reports of UI stuttering on latency-sensitive
> Android devices. To address this, we can use a waitqueue to wake up
> tasks that fail `swapcache_prepare()` sooner, instead of always
> sleeping for a full tick. While tasks may occasionally be woken by an
> unrelated `do_swap_page()`, this method is preferable to two scenarios:
> rapid re-entry into page faults, which can cause livelocks, and
> multiple millisecond sleeps, which visibly degrade user experience.

In general, I think that this works.  Why not extend the solution to
cover schedule_timeout_uninterruptible() in __read_swap_cache_async()
too?  We can call wake_up() when we clear SWAP_HAS_CACHE.  To avoid
overhead to call wake_up() when there's no task waiting, we can use an
atomic to count waiting tasks.

[snip]

--
Best Regards,
Huang, Ying


  reply	other threads:[~2024-09-29  2:43 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-26 21:19 Barry Song
2024-09-29  2:39 ` Huang, Ying [this message]
2024-09-30 13:18   ` Barry Song
2024-09-30 23:40     ` Huang, Ying
2024-10-01 14:16       ` Barry Song
2024-10-02  0:40         ` Huang, Ying
2024-10-02  1:57           ` Barry Song
2024-10-02 18:30             ` Kairui Song
2024-10-03  0:38               ` Huang, Ying
2024-10-03  0:31             ` Huang, Ying
2024-10-03 23:03               ` Chris Li
2024-10-04 16:03                 ` Barry Song
2024-10-08 13:08               ` Barry Song
2024-10-09  0:51                 ` Huang, Ying
2024-10-22  9:21                   ` Kairui Song
2024-10-23  1:57                     ` Huang, Ying
2024-10-23  2:32                       ` Barry Song
2024-10-03 22:53             ` Chris Li
2024-10-04 15:35               ` Barry Song
2024-10-03 22:22 ` Chris Li
2024-10-04 15:55   ` Barry Song

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=871q13qj2t.fsf@yhuang6-desk2.ccr.corp.intel.com \
    --to=ying.huang@intel.com \
    --cc=21cnbao@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=chrisl@kernel.org \
    --cc=david@redhat.com \
    --cc=hannes@cmpxchg.org \
    --cc=hughd@google.com \
    --cc=kaleshsingh@google.com \
    --cc=kasong@tencent.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=liyangouwen1@oppo.com \
    --cc=mhocko@suse.com \
    --cc=minchan@kernel.org \
    --cc=sj@kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=surenb@google.com \
    --cc=v-songbaohua@oppo.com \
    --cc=willy@infradead.org \
    --cc=yosryahmed@google.com \
    --cc=yuzhao@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox