From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-186.mta1.migadu.com (out-186.mta1.migadu.com [95.215.58.186]) (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 742E53A1A27 for ; Tue, 23 Jun 2026 06:52:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.186 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782197578; cv=none; b=atZpgggW38z2oigEwRc1GQvp/aT5j5QoWxLKMo28SWPlCXJui5yJiG1Gfz6rhsxF46JA0dXE3IKwfxTfhv+boaaoTVp6Bzfzp/Qz45zPP/knzY9r1uNeUxJM1ucF0OEG4/r4/mXylvnFEHcN2MZfPw5X2HLoP5H2bQCj9NayrnA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782197578; c=relaxed/simple; bh=ajEVIYb63aNIpiMdJWIGaSPzxMS2QcmS1MtpNu0rrlg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=PDWTHEsUzUXPXKIsMj1SVTwy8FV+TpjXg1DU4Mja92zH9Ttb7k3PLnO1+NTPjCOvxRci66jBftkaIHVA5P2WNye5/4+t0gl9k+33T3Y2e84iNexezpu7UiC4qSNCzCHCZAFgmMy+1fmSytkFm4b1am1UUlShvN0a2vF+ROqS51k= 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=sp1zu8td; arc=none smtp.client-ip=95.215.58.186 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="sp1zu8td" 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=1782197575; 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=sp1zu8tdq9oO+WZwW6SuI2/1y47k5CnnpYNdbwbYtFQMEMzDcngpiHEcnauaeoEHNPceBs hiAM4ITGZNmGx9ql8hoTeL5Lq/MNNlmEl2okJSB2NaPsKf1BA3NzkFmG38SKV+r7zzxkpk G+zwhY+jh3C9hg4TP5kXxlQbH9xMPzU= 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 3/6] mm/page_owner: hoist CONFIG_MEMCG to function level for print_page_owner_memcg() Date: Tue, 23 Jun 2026 14:52:28 +0800 Message-ID: <20260623065234.31866-4-ye.liu@linux.dev> In-Reply-To: <20260623065234.31866-1-ye.liu@linux.dev> References: <20260623065234.31866-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