From: Michal Hocko <mhocko-AlSwsSmVLrQ@public.gmane.org>
To: Johannes Weiner <hannes-druUgvl0LCNAfugRpC6u6w@public.gmane.org>
Cc: Andrew Morton
<akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org>,
Hugh Dickins <hughd-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>,
Vladimir Davydov
<vdavydov-bzQdu9zFT3WakBO8gow8eQ@public.gmane.org>,
linux-mm-Bw31MaZKKs3YtjvyW6yDsg@public.gmane.org,
cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [patch 1/4] mm: memcontrol: uncharge pages on swapout
Date: Wed, 22 Oct 2014 17:34:55 +0200 [thread overview]
Message-ID: <20141022153455.GD30802@dhcp22.suse.cz> (raw)
In-Reply-To: <1413818532-11042-2-git-send-email-hannes-druUgvl0LCNAfugRpC6u6w@public.gmane.org>
On Mon 20-10-14 11:22:09, Johannes Weiner wrote:
> mem_cgroup_swapout() is called with exclusive access to the page at
> the end of the page's lifetime. Instead of clearing the PCG_MEMSW
> flag and deferring the uncharge, just do it right away. This allows
> follow-up patches to simplify the uncharge code.
>
> Signed-off-by: Johannes Weiner <hannes-druUgvl0LCNAfugRpC6u6w@public.gmane.org>
OK, it makes sense. With the irq fixup
Acked-by: Michal Hocko <mhocko-AlSwsSmVLrQ@public.gmane.org>
> ---
> mm/memcontrol.c | 17 +++++++++++++----
> 1 file changed, 13 insertions(+), 4 deletions(-)
>
> diff --git a/mm/memcontrol.c b/mm/memcontrol.c
> index bea3fddb3372..7709f17347f3 100644
> --- a/mm/memcontrol.c
> +++ b/mm/memcontrol.c
> @@ -5799,6 +5799,7 @@ static void __init enable_swap_cgroup(void)
> */
> void mem_cgroup_swapout(struct page *page, swp_entry_t entry)
> {
> + struct mem_cgroup *memcg;
> struct page_cgroup *pc;
> unsigned short oldid;
>
> @@ -5815,13 +5816,21 @@ void mem_cgroup_swapout(struct page *page, swp_entry_t entry)
> return;
>
> VM_BUG_ON_PAGE(!(pc->flags & PCG_MEMSW), page);
> + memcg = pc->mem_cgroup;
>
> - oldid = swap_cgroup_record(entry, mem_cgroup_id(pc->mem_cgroup));
> + oldid = swap_cgroup_record(entry, mem_cgroup_id(memcg));
> VM_BUG_ON_PAGE(oldid, page);
> + mem_cgroup_swap_statistics(memcg, true);
>
> - pc->flags &= ~PCG_MEMSW;
> - css_get(&pc->mem_cgroup->css);
> - mem_cgroup_swap_statistics(pc->mem_cgroup, true);
> + pc->flags = 0;
> +
> + if (!mem_cgroup_is_root(memcg))
> + page_counter_uncharge(&memcg->memory, 1);
> +
> + local_irq_disable();
> + mem_cgroup_charge_statistics(memcg, page, -1);
> + memcg_check_events(memcg, page);
> + local_irq_enable();
> }
>
> /**
> --
> 2.1.2
>
--
Michal Hocko
SUSE Labs
WARNING: multiple messages have this Message-ID (diff)
From: Michal Hocko <mhocko@suse.cz>
To: Johannes Weiner <hannes@cmpxchg.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Hugh Dickins <hughd@google.com>,
Vladimir Davydov <vdavydov@parallels.com>,
linux-mm@kvack.org, cgroups@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [patch 1/4] mm: memcontrol: uncharge pages on swapout
Date: Wed, 22 Oct 2014 17:34:55 +0200 [thread overview]
Message-ID: <20141022153455.GD30802@dhcp22.suse.cz> (raw)
In-Reply-To: <1413818532-11042-2-git-send-email-hannes@cmpxchg.org>
On Mon 20-10-14 11:22:09, Johannes Weiner wrote:
> mem_cgroup_swapout() is called with exclusive access to the page at
> the end of the page's lifetime. Instead of clearing the PCG_MEMSW
> flag and deferring the uncharge, just do it right away. This allows
> follow-up patches to simplify the uncharge code.
>
> Signed-off-by: Johannes Weiner <hannes@cmpxchg.org>
OK, it makes sense. With the irq fixup
Acked-by: Michal Hocko <mhocko@suse.cz>
> ---
> mm/memcontrol.c | 17 +++++++++++++----
> 1 file changed, 13 insertions(+), 4 deletions(-)
>
> diff --git a/mm/memcontrol.c b/mm/memcontrol.c
> index bea3fddb3372..7709f17347f3 100644
> --- a/mm/memcontrol.c
> +++ b/mm/memcontrol.c
> @@ -5799,6 +5799,7 @@ static void __init enable_swap_cgroup(void)
> */
> void mem_cgroup_swapout(struct page *page, swp_entry_t entry)
> {
> + struct mem_cgroup *memcg;
> struct page_cgroup *pc;
> unsigned short oldid;
>
> @@ -5815,13 +5816,21 @@ void mem_cgroup_swapout(struct page *page, swp_entry_t entry)
> return;
>
> VM_BUG_ON_PAGE(!(pc->flags & PCG_MEMSW), page);
> + memcg = pc->mem_cgroup;
>
> - oldid = swap_cgroup_record(entry, mem_cgroup_id(pc->mem_cgroup));
> + oldid = swap_cgroup_record(entry, mem_cgroup_id(memcg));
> VM_BUG_ON_PAGE(oldid, page);
> + mem_cgroup_swap_statistics(memcg, true);
>
> - pc->flags &= ~PCG_MEMSW;
> - css_get(&pc->mem_cgroup->css);
> - mem_cgroup_swap_statistics(pc->mem_cgroup, true);
> + pc->flags = 0;
> +
> + if (!mem_cgroup_is_root(memcg))
> + page_counter_uncharge(&memcg->memory, 1);
> +
> + local_irq_disable();
> + mem_cgroup_charge_statistics(memcg, page, -1);
> + memcg_check_events(memcg, page);
> + local_irq_enable();
> }
>
> /**
> --
> 2.1.2
>
--
Michal Hocko
SUSE Labs
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
WARNING: multiple messages have this Message-ID (diff)
From: Michal Hocko <mhocko@suse.cz>
To: Johannes Weiner <hannes@cmpxchg.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Hugh Dickins <hughd@google.com>,
Vladimir Davydov <vdavydov@parallels.com>,
linux-mm@kvack.org, cgroups@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [patch 1/4] mm: memcontrol: uncharge pages on swapout
Date: Wed, 22 Oct 2014 17:34:55 +0200 [thread overview]
Message-ID: <20141022153455.GD30802@dhcp22.suse.cz> (raw)
In-Reply-To: <1413818532-11042-2-git-send-email-hannes@cmpxchg.org>
On Mon 20-10-14 11:22:09, Johannes Weiner wrote:
> mem_cgroup_swapout() is called with exclusive access to the page at
> the end of the page's lifetime. Instead of clearing the PCG_MEMSW
> flag and deferring the uncharge, just do it right away. This allows
> follow-up patches to simplify the uncharge code.
>
> Signed-off-by: Johannes Weiner <hannes@cmpxchg.org>
OK, it makes sense. With the irq fixup
Acked-by: Michal Hocko <mhocko@suse.cz>
> ---
> mm/memcontrol.c | 17 +++++++++++++----
> 1 file changed, 13 insertions(+), 4 deletions(-)
>
> diff --git a/mm/memcontrol.c b/mm/memcontrol.c
> index bea3fddb3372..7709f17347f3 100644
> --- a/mm/memcontrol.c
> +++ b/mm/memcontrol.c
> @@ -5799,6 +5799,7 @@ static void __init enable_swap_cgroup(void)
> */
> void mem_cgroup_swapout(struct page *page, swp_entry_t entry)
> {
> + struct mem_cgroup *memcg;
> struct page_cgroup *pc;
> unsigned short oldid;
>
> @@ -5815,13 +5816,21 @@ void mem_cgroup_swapout(struct page *page, swp_entry_t entry)
> return;
>
> VM_BUG_ON_PAGE(!(pc->flags & PCG_MEMSW), page);
> + memcg = pc->mem_cgroup;
>
> - oldid = swap_cgroup_record(entry, mem_cgroup_id(pc->mem_cgroup));
> + oldid = swap_cgroup_record(entry, mem_cgroup_id(memcg));
> VM_BUG_ON_PAGE(oldid, page);
> + mem_cgroup_swap_statistics(memcg, true);
>
> - pc->flags &= ~PCG_MEMSW;
> - css_get(&pc->mem_cgroup->css);
> - mem_cgroup_swap_statistics(pc->mem_cgroup, true);
> + pc->flags = 0;
> +
> + if (!mem_cgroup_is_root(memcg))
> + page_counter_uncharge(&memcg->memory, 1);
> +
> + local_irq_disable();
> + mem_cgroup_charge_statistics(memcg, page, -1);
> + memcg_check_events(memcg, page);
> + local_irq_enable();
> }
>
> /**
> --
> 2.1.2
>
--
Michal Hocko
SUSE Labs
next prev parent reply other threads:[~2014-10-22 15:34 UTC|newest]
Thread overview: 49+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-20 15:22 [patch 0/4] mm: memcontrol: remove the page_cgroup->flags field Johannes Weiner
2014-10-20 15:22 ` Johannes Weiner
2014-10-20 15:22 ` [patch 1/4] mm: memcontrol: uncharge pages on swapout Johannes Weiner
2014-10-20 15:22 ` Johannes Weiner
2014-10-21 1:07 ` Kamezawa Hiroyuki
2014-10-21 1:07 ` Kamezawa Hiroyuki
2014-10-21 20:39 ` Johannes Weiner
2014-10-21 20:39 ` Johannes Weiner
2014-10-21 12:52 ` Vladimir Davydov
2014-10-21 12:52 ` Vladimir Davydov
2014-10-21 21:03 ` Johannes Weiner
2014-10-21 21:03 ` Johannes Weiner
2014-10-21 21:03 ` Johannes Weiner
2014-10-22 8:33 ` Vladimir Davydov
2014-10-22 8:33 ` Vladimir Davydov
2014-10-22 8:33 ` Vladimir Davydov
2014-10-22 13:20 ` Johannes Weiner
2014-10-22 13:20 ` Johannes Weiner
2014-10-22 15:37 ` Vladimir Davydov
2014-10-22 15:37 ` Vladimir Davydov
[not found] ` <1413818532-11042-2-git-send-email-hannes-druUgvl0LCNAfugRpC6u6w@public.gmane.org>
2014-10-22 15:34 ` Michal Hocko [this message]
2014-10-22 15:34 ` Michal Hocko
2014-10-22 15:34 ` Michal Hocko
2014-10-20 15:22 ` [patch 2/4] mm: memcontrol: remove unnecessary PCG_MEMSW memory+swap charge flag Johannes Weiner
2014-10-20 15:22 ` Johannes Weiner
2014-10-22 1:50 ` Kamezawa Hiroyuki
2014-10-22 1:50 ` Kamezawa Hiroyuki
2014-10-22 1:50 ` Kamezawa Hiroyuki
2014-10-22 15:43 ` Vladimir Davydov
2014-10-22 15:43 ` Vladimir Davydov
2014-10-22 15:46 ` Michal Hocko
2014-10-22 15:46 ` Michal Hocko
2014-10-20 15:22 ` [patch 3/4] mm: memcontrol: remove unnecessary PCG_MEM memory " Johannes Weiner
2014-10-20 15:22 ` Johannes Weiner
2014-10-22 1:52 ` Kamezawa Hiroyuki
2014-10-22 1:52 ` Kamezawa Hiroyuki
2014-10-22 15:44 ` Vladimir Davydov
2014-10-22 15:44 ` Vladimir Davydov
2014-10-22 15:49 ` Michal Hocko
2014-10-22 15:49 ` Michal Hocko
2014-10-20 15:22 ` [patch 4/4] mm: memcontrol: remove unnecessary PCG_USED pc->mem_cgroup valid flag Johannes Weiner
2014-10-20 15:22 ` Johannes Weiner
[not found] ` <1413818532-11042-5-git-send-email-hannes-druUgvl0LCNAfugRpC6u6w@public.gmane.org>
2014-10-22 1:54 ` Kamezawa Hiroyuki
2014-10-22 1:54 ` Kamezawa Hiroyuki
2014-10-22 1:54 ` Kamezawa Hiroyuki
2014-10-22 16:05 ` Vladimir Davydov
2014-10-22 16:05 ` Vladimir Davydov
2014-10-22 16:11 ` Michal Hocko
2014-10-22 16:11 ` Michal Hocko
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=20141022153455.GD30802@dhcp22.suse.cz \
--to=mhocko-alswssmvlrq@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=hughd-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-mm-Bw31MaZKKs3YtjvyW6yDsg@public.gmane.org \
--cc=vdavydov-bzQdu9zFT3WakBO8gow8eQ@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 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.