From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-19.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DC9EFC43460 for ; Mon, 29 Mar 2021 08:18:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C73E261959 for ; Mon, 29 Mar 2021 08:18:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232136AbhC2ISS (ORCPT ); Mon, 29 Mar 2021 04:18:18 -0400 Received: from mail.kernel.org ([198.145.29.99]:59002 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233193AbhC2IRF (ORCPT ); Mon, 29 Mar 2021 04:17:05 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 18EE961878; Mon, 29 Mar 2021 08:16:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1617005796; bh=+GMuBe7YXhCwuPEwA/qmcdT63q+40w2qaBExFqlb20o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QBFUNXvCaRfNlTDjH0CcrAuv0fOSMgmPJnRq574gVFVCxBpMEASVM0wo7OgWXBHoj vLQ3PrDr4AqwELL4hAx/595y1E99ytdLyc6ZPNIgryrQa9H8g/LzXpvXKIJHZTzYem U+cpiEtcBiaFzT0tpFY23+plmdo3DiV+Dis1m0x0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zhou Guanghui , Johannes Weiner , Zi Yan , Shakeel Butt , Michal Hocko , Hugh Dickins , "Kirill A. Shutemov" , Nicholas Piggin , Kefeng Wang , Hanjun Guo , Tianhong Ding , Weilong Chen , Rui Xiang , Andrew Morton , Linus Torvalds Subject: [PATCH 5.10 001/221] mm/memcg: rename mem_cgroup_split_huge_fixup to split_page_memcg and add nr_pages argument Date: Mon, 29 Mar 2021 09:55:32 +0200 Message-Id: <20210329075629.220507977@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210329075629.172032742@linuxfoundation.org> References: <20210329075629.172032742@linuxfoundation.org> User-Agent: quilt/0.66 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Zhou Guanghui commit be6c8982e4ab9a41907555f601b711a7e2a17d4c upstream. Rename mem_cgroup_split_huge_fixup to split_page_memcg and explicitly pass in page number argument. In this way, the interface name is more common and can be used by potential users. In addition, the complete info(memcg and flag) of the memcg needs to be set to the tail pages. Link: https://lkml.kernel.org/r/20210304074053.65527-2-zhouguanghui1@huawei.com Signed-off-by: Zhou Guanghui Acked-by: Johannes Weiner Reviewed-by: Zi Yan Reviewed-by: Shakeel Butt Acked-by: Michal Hocko Cc: Hugh Dickins Cc: "Kirill A. Shutemov" Cc: Nicholas Piggin Cc: Kefeng Wang Cc: Hanjun Guo Cc: Tianhong Ding Cc: Weilong Chen Cc: Rui Xiang Cc: Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds Signed-off-by: Hugh Dickins Signed-off-by: Greg Kroah-Hartman --- include/linux/memcontrol.h | 6 ++---- mm/huge_memory.c | 2 +- mm/memcontrol.c | 15 +++++---------- 3 files changed, 8 insertions(+), 15 deletions(-) --- a/include/linux/memcontrol.h +++ b/include/linux/memcontrol.h @@ -937,9 +937,7 @@ static inline void memcg_memory_event_mm rcu_read_unlock(); } -#ifdef CONFIG_TRANSPARENT_HUGEPAGE -void mem_cgroup_split_huge_fixup(struct page *head); -#endif +void split_page_memcg(struct page *head, unsigned int nr); #else /* CONFIG_MEMCG */ @@ -1267,7 +1265,7 @@ unsigned long mem_cgroup_soft_limit_recl return 0; } -static inline void mem_cgroup_split_huge_fixup(struct page *head) +static inline void split_page_memcg(struct page *head, unsigned int nr) { } --- a/mm/huge_memory.c +++ b/mm/huge_memory.c @@ -2433,7 +2433,7 @@ static void __split_huge_page(struct pag lruvec = mem_cgroup_page_lruvec(head, pgdat); /* complete memcg works before add pages to LRU */ - mem_cgroup_split_huge_fixup(head); + split_page_memcg(head, nr); if (PageAnon(head) && PageSwapCache(head)) { swp_entry_t entry = { .val = page_private(head) }; --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -3268,26 +3268,21 @@ void obj_cgroup_uncharge(struct obj_cgro #endif /* CONFIG_MEMCG_KMEM */ -#ifdef CONFIG_TRANSPARENT_HUGEPAGE - /* - * Because tail pages are not marked as "used", set it. We're under - * pgdat->lru_lock and migration entries setup in all page mappings. + * Because head->mem_cgroup is not set on tails, set it now. */ -void mem_cgroup_split_huge_fixup(struct page *head) +void split_page_memcg(struct page *head, unsigned int nr) { struct mem_cgroup *memcg = head->mem_cgroup; int i; - if (mem_cgroup_disabled()) + if (mem_cgroup_disabled() || !memcg) return; - for (i = 1; i < HPAGE_PMD_NR; i++) { - css_get(&memcg->css); + for (i = 1; i < nr; i++) head[i].mem_cgroup = memcg; - } + css_get_many(&memcg->css, nr - 1); } -#endif /* CONFIG_TRANSPARENT_HUGEPAGE */ #ifdef CONFIG_MEMCG_SWAP /**