cgroups.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Huang\, Ying" <ying.huang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
To: Johannes Weiner <hannes-druUgvl0LCNAfugRpC6u6w@public.gmane.org>
Cc: "Huang,
	Ying" <ying.huang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>,
	Andrew Morton
	<akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org>,
	linux-mm-Bw31MaZKKs3YtjvyW6yDsg@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Andrea Arcangeli
	<aarcange-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>,
	"Kirill A . Shutemov"
	<kirill.shutemov-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>,
	Vladimir Davydov
	<vdavydov-5HdwGun5lf+gSpxsJD1C4w@public.gmane.org>,
	Michal Hocko <mhocko-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
	Tejun Heo <tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
	cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH -mm -v7 2/9] mm, memcg: Support to charge/uncharge multiple swap entries
Date: Thu, 30 Mar 2017 08:53:50 +0800	[thread overview]
Message-ID: <87k277twip.fsf@yhuang-dev.intel.com> (raw)
In-Reply-To: <20170329165722.GB31821-druUgvl0LCNAfugRpC6u6w@public.gmane.org> (Johannes Weiner's message of "Wed, 29 Mar 2017 12:57:22 -0400")

Johannes Weiner <hannes-druUgvl0LCNAfugRpC6u6w@public.gmane.org> writes:

> On Tue, Mar 28, 2017 at 01:32:02PM +0800, Huang, Ying wrote:
>> @@ -5908,16 +5907,19 @@ void mem_cgroup_swapout(struct page *page, swp_entry_t entry)
>>  		css_put(&memcg->css);
>>  }
>>  
>> -/*
>> - * mem_cgroup_try_charge_swap - try charging a swap entry
>> +/**
>> + * mem_cgroup_try_charge_swap - try charging a set of swap entries
>>   * @page: page being added to swap
>> - * @entry: swap entry to charge
>> + * @entry: the first swap entry to charge
>> + * @nr_entries: the number of swap entries to charge
>>   *
>> - * Try to charge @entry to the memcg that @page belongs to.
>> + * Try to charge @nr_entries swap entries starting from @entry to the
>> + * memcg that @page belongs to.
>>   *
>>   * Returns 0 on success, -ENOMEM on failure.
>>   */
>> -int mem_cgroup_try_charge_swap(struct page *page, swp_entry_t entry)
>> +int mem_cgroup_try_charge_swap(struct page *page, swp_entry_t entry,
>> +			       unsigned int nr_entries)
>
> I've pointed this out before,

Yes.  And I have replied to your original comments too :-)

> but there doesn't seem to be a reason to
> pass @nr_entries when we have the struct page. Why can't this function
> just check PageTransHuge() by itself?

Because sometimes we need to charge one swap entry for a THP.  Please
take a look at the original add_to_swap() implementation.  For a THP,
one swap entry will be allocated and charged to the mem cgroup before
the THP is split.  And I think it is not easy to change this, because we
don't want to split THP if the mem cgroup for swap exceeds its limit.

Best Regards,
Huang, Ying

  parent reply	other threads:[~2017-03-30  0:53 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20170328053209.25876-1-ying.huang@intel.com>
2017-03-28  5:32 ` [PATCH -mm -v7 2/9] mm, memcg: Support to charge/uncharge multiple swap entries Huang, Ying
     [not found]   ` <20170328053209.25876-3-ying.huang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2017-03-29 16:57     ` Johannes Weiner
     [not found]       ` <20170329165722.GB31821-druUgvl0LCNAfugRpC6u6w@public.gmane.org>
2017-03-30  0:53         ` Huang, Ying [this message]
     [not found]           ` <87k277twip.fsf-5/hDr2MS57EDqwDYnZuMFFaTQe2KTcn/@public.gmane.org>
2017-03-31 14:59             ` Johannes Weiner

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=87k277twip.fsf@yhuang-dev.intel.com \
    --to=ying.huang-ral2jqcrhueavxtiumwx3w@public.gmane.org \
    --cc=aarcange-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
    --cc=akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org \
    --cc=cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=hannes-druUgvl0LCNAfugRpC6u6w@public.gmane.org \
    --cc=kirill.shutemov-VuQAYsv1563Yd54FQh9/CA@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-mm-Bw31MaZKKs3YtjvyW6yDsg@public.gmane.org \
    --cc=mhocko-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    --cc=tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    --cc=vdavydov-5HdwGun5lf+gSpxsJD1C4w@public.gmane.org \
    /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;
as well as URLs for NNTP newsgroup(s).