From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-179.mta0.migadu.com (out-179.mta0.migadu.com [91.218.175.179]) (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 169C1361662 for ; Fri, 26 Jun 2026 02:46:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.179 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782441977; cv=none; b=fRG76/LH5rctX1I5LQDZOJTDBqghxqn+LVddT4rA/3X1B+P9UjoOR8T/hmM8kZj1rbolBmdLRGjn38k4dEOgiKYnkYa87ec+8SCybUsiCvB0b+umC94wzwvoZwib/XLDdsLfjs8RxBEza/a8ldv+AY2ZuhgtLcKwnnx4lywbQn8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782441977; c=relaxed/simple; bh=ajEVIYb63aNIpiMdJWIGaSPzxMS2QcmS1MtpNu0rrlg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=BS4hspJJSuGYfNuuwFmXxOsuO2o1rODQuvp/fW+jRcX/Sbdyg+/IZBX8jDlD0je5yP0z1NaGy0B/OzZzirfQ/BlxmzCE/ZGjZOTQm7ph5eD1IWUog0iYAW5GGmqcmBLowSsMLbZBTVbOAFVL8Zjy8gLYUC4AEPdziZBHpUYGea8= 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=mK/eiOBf; arc=none smtp.client-ip=91.218.175.179 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="mK/eiOBf" 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=1782441973; 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=jPNS159ESiLc3aJuAx/S9sR8HFRJb+0xK69O7GX3r4I=; b=mK/eiOBfcvi7bWQsA19mCmD1y0oqyzy8hEg/ZmV44uIw/2h4PnzVuobQKVMN6m62Q1bf0q UFDsNRy27Y2vqzzo5UDdjbur6TGypFFcLMXcnPJorj5rk3Uug52zgMi5he8m6zlWN649S7 79Ey+CVKVa8CR+ZMUMfsdIMv5aGjyCQ= From: Ye Liu To: Andrew Morton , Vlastimil Babka Cc: Ye Liu , Suren Baghdasaryan , Michal Hocko , Brendan Jackman , Johannes Weiner , Zi Yan , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 3/6] mm/page_owner: hoist CONFIG_MEMCG to function level for print_page_owner_memcg() Date: Fri, 26 Jun 2026 10:45:42 +0800 Message-ID: <20260626024550.25677-4-ye.liu@linux.dev> In-Reply-To: <20260626024550.25677-1-ye.liu@linux.dev> References: <20260626024550.25677-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 --- 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 ebafa9d7ff07..5d8773c90cd9 100644 --- a/mm/page_owner.c +++ b/mm/page_owner.c @@ -529,13 +529,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; @@ -563,10 +563,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