Re: [PATCH] psi: Treat ksm swapping in copy as memstall

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Feb 07, 2022 at 07:22:22PM -0800, Hugh Dickins wrote:
> On Fri, 28 Jan 2022, CGEL wrote:
> > On Thu, Jan 27, 2022 at 08:29:08PM -0500, Johannes Weiner wrote:
> > > 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.
> > I recently found that too. Please CC to me your new patch, thanks!
> > And I will send V2 of this patch "psi: Treat ksm swapping in copy
> > as memstall" with PageWorkingset().
> 
> I'm entirely PSI-ignorant, and reluctant to disagree with Johannes,
> but I don't see how your patch to ksm_might_need_to_copy() could be
> correct - maybe the "swapping" in your subject is confusing.
> 
> There is no PSI enter and exit around the page allocation and copying
> in wp_page_copy(), so why in the analogous ksm_might_need_to_copy()?
>
I think it's two questions, first why PSI didn't treat wp_page_copy() as
memstall, second why should PSI treat ksm_might_need_to_copy() as memstall.

The first question is unrelated with this patch. I think the reason is PSI
focous on memory contending(see Documentation/accounting/psi.rst), and
wp_page_copy() is not caused by memory contending. Actually wp_page_copy()
will still be called if memory is not contending.

For the second question, ksm_might_need_to_copy() is called only becaused
of swapping, and swap is caused by memory contending, so PSI better treat
it as memstall.

Thanks.
> Hugh




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux