From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-176.mta1.migadu.com (out-176.mta1.migadu.com [95.215.58.176]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7306E39FCD2 for ; Wed, 1 Jul 2026 06:11:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.176 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782886307; cv=none; b=hR7K2A9lBNnAMZx92o9BTZhLfhpt+ySsx+WTg8ZPY00hURNG3AzpfXU13vFwkTiv9fqdz/nK2udTSV5g2iS3xSNMZptA7SYYdqaU8oq+ENgDrp+U4FIFExmQm5H91eK4usGdGSOmUm8cMYBm8HNP5svHv2YKQVrvq3iSNL9xrNQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782886307; c=relaxed/simple; bh=e0PbK+wK92Zv6TvIhjVBvA2T+MJGCVXfOYBXEKewRWs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=qUJqJ/JU2X3/uDlDw+IFpCLMryhCGX4m4iZvuDFiq9Wour+QjLwA5L7YDKXHWuHQGncOIcrrSBaQgKDG6+n14H3xMrGVSLqOznGP2ws0pUDgDDOaMLXy4VQggWCZhbPu+tYH+RqKWHdNccHlO9ucg+BOpDeoB58MB9cuaqfPG5c= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=AoKgCaeT; arc=none smtp.client-ip=95.215.58.176 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="AoKgCaeT" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1782886303; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=x7l7Cu37ztLHTqXl9+24GTeEvM65Yy8Y6kuKnfhmUgo=; b=AoKgCaeTBnkHBefGppDnHIlcV/22osy9mYp7YkGWbWiaNQyS0/lLfLBJVwD6eOx2zVrgAi z0b4n8wAj2MdONXp62SRX6pvMJIbtYsDZeciw9i8u9+56n+dwo5rQm0nyND5j0AqZ6U0AM DmXbAIXLPrvYty5DMI4iJcmJtgN92oo= From: Ye Liu To: Andrew Morton , Vlastimil Babka Cc: Ye Liu , Zi Yan , Suren Baghdasaryan , Michal Hocko , Brendan Jackman , Johannes Weiner , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH v5 4/9] mm/page_owner: hoist CONFIG_MEMCG to function level for print_page_owner_memcg() Date: Wed, 1 Jul 2026 14:10:47 +0800 Message-ID: <20260701061101.344679-5-ye.liu@linux.dev> In-Reply-To: <20260701061101.344679-1-ye.liu@linux.dev> References: <20260701061101.344679-1-ye.liu@linux.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT The print_page_owner_memcg() function has CONFIG_MEMCG guarding its entire body via #ifdef inside the function, which leaves a no-op { return ret; } when the config is disabled. Hoist the #ifdef to the top level so the real implementation and the empty stub are two clearly separated definitions. No functional change. Signed-off-by: Ye Liu Reviewed-by: Zi Yan Reviewed-by: Vlastimil Babka (SUSE) --- mm/page_owner.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/mm/page_owner.c b/mm/page_owner.c index 4e352941a6e2..fe2bf2274d8a 100644 --- a/mm/page_owner.c +++ b/mm/page_owner.c @@ -522,13 +522,13 @@ void pagetypeinfo_showmixedcount_print(struct seq_file *m, seq_putc(m, '\n'); } +#ifdef CONFIG_MEMCG /* * Looking for memcg information and print it out */ static inline int print_page_owner_memcg(char *kbuf, size_t count, int ret, struct page *page) { -#ifdef CONFIG_MEMCG unsigned long memcg_data; struct mem_cgroup *memcg; bool online; @@ -556,10 +556,16 @@ static inline int print_page_owner_memcg(char *kbuf, size_t count, int ret, name); out_unlock: rcu_read_unlock(); -#endif /* CONFIG_MEMCG */ return ret; } +#else +static inline int print_page_owner_memcg(char *kbuf, size_t count, int ret, + struct page *page) +{ + return ret; +} +#endif static ssize_t print_page_owner(char __user *buf, size_t count, unsigned long pfn, -- 2.43.0