All of lore.kernel.org
 help / color / mirror / Atom feed
From: Johannes Weiner <hannes@cmpxchg.org>
To: CGEL <cgel.zte@gmail.com>
Cc: akpm@linux-foundation.org, sfr@canb.auug.org.au,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	Yang Yang <yang.yang29@zte.com.cn>
Subject: Re: [PATCH] psi: Treat ksm swapping in copy as memstall
Date: Thu, 27 Jan 2022 20:29:08 -0500	[thread overview]
Message-ID: <YfNG5KAog6fI0kYu@cmpxchg.org> (raw)
In-Reply-To: <61ea820f.1c69fb81.e79d5.09c9@mx.google.com>

On Fri, Jan 21, 2022 at 09:51:08AM +0000, CGEL wrote:
>  Wed, Jan 19, 2022 at 07:58:23AM -0500, Johannes Weiner wrote:
> > On Wed, Jan 19, 2022 at 06:13:54AM +0000, CGEL wrote:
> > > I did a test, when we use zram, it takes longer time for ksm copying than
> > > swap_readpage(). Ksm copying average takes 147263ns, swap_readpage()
> > > average takes 55639ns. So I think this patch is reasonable.
> > 
> > Ok, that sounds reasonable to me as well. Please add the
> > PageWorkingset() check and resubmit the patch. Thanks!
> I am a litte confused about adding PageWorkingset(), since I
> think ksm_might_need_to_copy() memstall is like swap_readpage()
> memstall and swap_readpage() doesn't add PageWorkingset().

That's actually a bug! It should do that.

That psi_memstall_enter() in swap_readpage() was added by commit
937790699be9c8100e5358625e7dfa8b32bd33f2. It's for catching the
scenarios that don't go through submit_bio(). When you look at
submit_bio(), it counts stalls only if we have workingset pages:

	/*
	 * If we're reading data that is part of the userspace workingset, count
	 * submission time as memory stall.  When the device is congested, or
	 * the submitting cgroup IO-throttled, submission can be a significant
	 * part of overall IO time.
	 */
	if (unlikely(bio_op(bio) == REQ_OP_READ &&
	    bio_flagged(bio, BIO_WORKINGSET))) {
		unsigned long pflags;

		psi_memstall_enter(&pflags);
		submit_bio_noacct(bio);
		psi_memstall_leave(&pflags);
		return;
	}

I hope that clarifies it. I'll send a patch to fix up swap_readpage().

Thanks

  reply	other threads:[~2022-01-28  1:29 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-16 15:21 [PATCH] psi: Treat ksm swapping in copy as memstall cgel.zte
2022-01-17 12:14 ` Johannes Weiner
2022-01-19  6:13   ` CGEL
2022-01-19 12:58     ` Johannes Weiner
2022-01-21  9:51       ` CGEL
2022-01-28  1:29         ` Johannes Weiner [this message]
2022-01-28  2:31           ` CGEL
2022-02-08  3:22             ` Hugh Dickins
2022-02-08 13:09               ` CGEL
2022-02-09  5:55                 ` Hugh Dickins
2022-02-10  6:52                   ` CGEL

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=YfNG5KAog6fI0kYu@cmpxchg.org \
    --to=hannes@cmpxchg.org \
    --cc=akpm@linux-foundation.org \
    --cc=cgel.zte@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=sfr@canb.auug.org.au \
    --cc=yang.yang29@zte.com.cn \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.