Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp90779pxb; Mon, 16 Aug 2021 00:15:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJySOwgA9cGt3FvIyZImIluEIwNS1w1tI2wB1/AUPnmGZ81CYUSIz9WkNOKkfAdxJGTtAUZ1 X-Received: by 2002:a92:730d:: with SMTP id o13mr10890597ilc.183.1629098130963; Mon, 16 Aug 2021 00:15:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629098130; cv=none; d=google.com; s=arc-20160816; b=HHXpTa9zu9q8Vt8ZaJZCJiwVc4AY86xcgkvmEQHP5oR0580zYAbmErRD1mVLfLdLEJ wZV0DKC8Vtvq3H/8QzW5a29snw4tJIURIW3FP6OnbvLsLBuSP4szH6eOkg4XrbJecuaP D1Wu7o99pov6Tjns3I7TeyPZiCP1XQY1QT2W+ejgFjOR9qhJo2CBzNLOrki2dzLU/ZJR rSbHmrBfAi3JrC6ZbGURI2FFyG7OS2NyMJt5w7kh9VcUsip4KuzL5YgpEwH8jS9r3fYM Lom1d+dZNYbji48WNCp+JSVRtcrZNpjS6qJDKyqC4HaaxnDGocvmDdmqhsHAjkV3LVqG xEsw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from; bh=Y7Z40Wd+TkaEtgga703gF43ZYQL6GUb+Sq91gUNQwsc=; b=NPXzkHVZ3S+slyahB1gG15iYRKNYtQAU93/zX0g22ScBNkYqmaPuVPJYWDmOen5qjh erFbg9TMEYld96yHHTkbinqthwyLTw0O1utpHYXZA3WYTxcPG+V5SjWbhOeANIfqnrMV bLiPr+e/MTVq9R1H+zG04KK5ykl5O1QX2FgXnFWN4jpPSagiPU++8OA0M8d4FxfU7bVg kLtTt/Ytbzt8OpmlzEM1cSzKDWSI0PC/r6rA2TTVt6G6kcu6hucgX7n/6esNtTNy5pac 3Gvqw58LRmDSsMoGHoH1eCJvS6eMwSffHv52fPw2zhHo64qOmu/OZrE8ek8lfwhAEEBP wzwQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f15si9805767ilu.156.2021.08.16.00.15.20; Mon, 16 Aug 2021 00:15:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234186AbhHPHNp (ORCPT + 99 others); Mon, 16 Aug 2021 03:13:45 -0400 Received: from szxga02-in.huawei.com ([45.249.212.188]:8420 "EHLO szxga02-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234095AbhHPHNY (ORCPT ); Mon, 16 Aug 2021 03:13:24 -0400 Received: from dggemv704-chm.china.huawei.com (unknown [172.30.72.56]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4Gp4yV1LN2z881X; Mon, 16 Aug 2021 15:08:50 +0800 (CST) Received: from dggema756-chm.china.huawei.com (10.1.198.198) by dggemv704-chm.china.huawei.com (10.3.19.47) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.2176.2; Mon, 16 Aug 2021 15:12:51 +0800 Received: from localhost.localdomain (10.175.112.125) by dggema756-chm.china.huawei.com (10.1.198.198) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2176.2; Mon, 16 Aug 2021 15:12:50 +0800 From: Chen Huang To: Roman Gushchin , Muchun Song , "Wang Hai" , Greg Kroah-Hartman CC: , , , Chen Huang , Michal Hocko , Vladimir Davydov , "Xiongchun Duan" , Andrew Morton , Linus Torvalds Subject: [PATCH 5.10.y 10/11] mm: memcontrol: move PageMemcgKmem to the scope of CONFIG_MEMCG_KMEM Date: Mon, 16 Aug 2021 07:21:46 +0000 Message-ID: <20210816072147.3481782-11-chenhuang5@huawei.com> X-Mailer: git-send-email 2.18.0.huawei.25 In-Reply-To: <20210816072147.3481782-1-chenhuang5@huawei.com> References: <20210816072147.3481782-1-chenhuang5@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.175.112.125] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To dggema756-chm.china.huawei.com (10.1.198.198) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Muchun Song The page only can be marked as kmem when CONFIG_MEMCG_KMEM is enabled. So move PageMemcgKmem() to the scope of the CONFIG_MEMCG_KMEM. As a bonus, on !CONFIG_MEMCG_KMEM build some code can be compiled out. Link: https://lkml.kernel.org/r/20210319163821.20704-8-songmuchun@bytedance.com Signed-off-by: Muchun Song Acked-by: Roman Gushchin Reviewed-by: Shakeel Butt Acked-by: Johannes Weiner Cc: Michal Hocko Cc: Vladimir Davydov Cc: Xiongchun Duan Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds Signed-off-by: Chen Huang --- include/linux/memcontrol.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h index b8bb5d37d4ad..f07463cf7dac 100644 --- a/include/linux/memcontrol.h +++ b/include/linux/memcontrol.h @@ -506,6 +506,7 @@ static inline struct mem_cgroup *page_memcg_check(struct page *page) return (struct mem_cgroup *)(memcg_data & ~MEMCG_DATA_FLAGS_MASK); } +#ifdef CONFIG_MEMCG_KMEM /* * PageMemcgKmem - check if the page has MemcgKmem flag set * @page: a pointer to the page struct @@ -520,7 +521,6 @@ static inline bool PageMemcgKmem(struct page *page) return page->memcg_data & MEMCG_DATA_KMEM; } -#ifdef CONFIG_MEMCG_KMEM /* * page_objcgs - get the object cgroups vector associated with a page * @page: a pointer to the page struct @@ -575,6 +575,11 @@ static inline bool set_page_objcgs(struct page *page, MEMCG_DATA_OBJCGS); } #else +static inline bool PageMemcgKmem(struct page *page) +{ + return false; +} + static inline struct obj_cgroup **page_objcgs(struct page *page) { return NULL; -- 2.18.0.huawei.25