mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Kirill Tkhai <ktkhai@virtuozzo.com>
To: Yang Shi <yang.shi@linux.alibaba.com>,
	kirill.shutemov@linux.intel.com, hannes@cmpxchg.org,
	mhocko@suse.com, hughd@google.com, shakeelb@google.com,
	rientjes@google.com, cai@lca.pw, akpm@linux-foundation.org
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [v5 PATCH 2/4] mm: move mem_cgroup_uncharge out of __page_cache_release()
Date: Tue, 20 Aug 2019 13:53:44 +0300	[thread overview]
Message-ID: <8444f6e3-e628-3d64-fd20-4ae26f1c761b@virtuozzo.com> (raw)
In-Reply-To: <1565144277-36240-3-git-send-email-yang.shi@linux.alibaba.com>

On 07.08.2019 05:17, Yang Shi wrote:
> The later patch would make THP deferred split shrinker memcg aware, but
> it needs page->mem_cgroup information in THP destructor, which is called
> after mem_cgroup_uncharge() now.
> 
> So, move mem_cgroup_uncharge() from __page_cache_release() to compound
> page destructor, which is called by both THP and other compound pages
> except HugeTLB.  And call it in __put_single_page() for single order
> page.
> 
> Suggested-by: "Kirill A . Shutemov" <kirill.shutemov@linux.intel.com>
> Cc: Kirill Tkhai <ktkhai@virtuozzo.com>
> Cc: Johannes Weiner <hannes@cmpxchg.org>
> Cc: Michal Hocko <mhocko@suse.com>
> Cc: Hugh Dickins <hughd@google.com>
> Cc: Shakeel Butt <shakeelb@google.com>
> Cc: David Rientjes <rientjes@google.com>
> Cc: Qian Cai <cai@lca.pw>
> Acked-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
> Signed-off-by: Yang Shi <yang.shi@linux.alibaba.com>

Reviewed-by: Kirill Tkhai <ktkhai@virtuozzo.com>

> ---
>  mm/page_alloc.c | 1 +
>  mm/swap.c       | 2 +-
>  mm/vmscan.c     | 6 ++----
>  3 files changed, 4 insertions(+), 5 deletions(-)
> 
> diff --git a/mm/page_alloc.c b/mm/page_alloc.c
> index df02a88..1d1c5d3 100644
> --- a/mm/page_alloc.c
> +++ b/mm/page_alloc.c
> @@ -670,6 +670,7 @@ static void bad_page(struct page *page, const char *reason,
>  
>  void free_compound_page(struct page *page)
>  {
> +	mem_cgroup_uncharge(page);
>  	__free_pages_ok(page, compound_order(page));
>  }
>  
> diff --git a/mm/swap.c b/mm/swap.c
> index ae30039..d4242c8 100644
> --- a/mm/swap.c
> +++ b/mm/swap.c
> @@ -71,12 +71,12 @@ static void __page_cache_release(struct page *page)
>  		spin_unlock_irqrestore(&pgdat->lru_lock, flags);
>  	}
>  	__ClearPageWaiters(page);
> -	mem_cgroup_uncharge(page);
>  }
>  
>  static void __put_single_page(struct page *page)
>  {
>  	__page_cache_release(page);
> +	mem_cgroup_uncharge(page);
>  	free_unref_page(page);
>  }
>  
> diff --git a/mm/vmscan.c b/mm/vmscan.c
> index dbdc46a..b1b5e5f 100644
> --- a/mm/vmscan.c
> +++ b/mm/vmscan.c
> @@ -1490,10 +1490,9 @@ static unsigned long shrink_page_list(struct list_head *page_list,
>  		 * Is there need to periodically free_page_list? It would
>  		 * appear not as the counts should be low
>  		 */
> -		if (unlikely(PageTransHuge(page))) {
> -			mem_cgroup_uncharge(page);
> +		if (unlikely(PageTransHuge(page)))
>  			(*get_compound_page_dtor(page))(page);
> -		} else
> +		else
>  			list_add(&page->lru, &free_pages);
>  		continue;
>  
> @@ -1914,7 +1913,6 @@ static unsigned noinline_for_stack move_pages_to_lru(struct lruvec *lruvec,
>  
>  			if (unlikely(PageCompound(page))) {
>  				spin_unlock_irq(&pgdat->lru_lock);
> -				mem_cgroup_uncharge(page);
>  				(*get_compound_page_dtor(page))(page);
>  				spin_lock_irq(&pgdat->lru_lock);
>  			} else
> 


  reply	other threads:[~2019-08-20 10:53 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-07  2:17 [v5 PATCH 0/4] Make deferred split shrinker memcg aware Yang Shi
2019-08-07  2:17 ` [v5 PATCH 1/4] mm: thp: extract split_queue_* into a struct Yang Shi
2019-08-20 10:53   ` Kirill Tkhai
2019-08-07  2:17 ` [v5 PATCH 2/4] mm: move mem_cgroup_uncharge out of __page_cache_release() Yang Shi
2019-08-20 10:53   ` Kirill Tkhai [this message]
2019-08-07  2:17 ` [v5 PATCH 3/4] mm: shrinker: make shrinker not depend on memcg kmem Yang Shi
2019-08-20 11:01   ` Kirill Tkhai
2019-08-20 16:07     ` Yang Shi
2019-08-07  2:17 ` [v5 PATCH 4/4] mm: thp: make deferred split shrinker memcg aware Yang Shi
2019-08-20 11:06   ` Kirill Tkhai
2019-08-20 16:10     ` Yang Shi

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=8444f6e3-e628-3d64-fd20-4ae26f1c761b@virtuozzo.com \
    --to=ktkhai@virtuozzo.com \
    --cc=akpm@linux-foundation.org \
    --cc=cai@lca.pw \
    --cc=hannes@cmpxchg.org \
    --cc=hughd@google.com \
    --cc=kirill.shutemov@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@suse.com \
    --cc=rientjes@google.com \
    --cc=shakeelb@google.com \
    --cc=yang.shi@linux.alibaba.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

all inboxes | Powered by JetHome®