From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-184.mta0.migadu.com (out-184.mta0.migadu.com [91.218.175.184]) (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 85DAB243964 for ; Wed, 1 Jul 2026 01:23:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.184 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782869005; cv=none; b=GUetyUIP4jr5V/1OexorBB8g2WD5Dse8UC1boCYNA9J2iVthlOZgLO22RMZYcBAYjU1EX4531tKSAf0n6JkKlJX541DgLpPoPL3M0hHDTjLfyGUS7O9O4DqKF3k7Tg9HabDYrZhKOlyYZ8vkzXraynZkusedSQRBKY0GNFXQ/6c= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782869005; c=relaxed/simple; bh=e0PbK+wK92Zv6TvIhjVBvA2T+MJGCVXfOYBXEKewRWs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=gB7ji1E10QtsdePi8zf+ItYAsRkBx4xma9LbHE8vKkvz5+ge0uHs7wnVaFOwQVjyQugEtWw3aRIWEBCM/fgGUG0IOcd3kHO1jVEE9B9NrO0je/L0Xg93LgJWH5Kl7D8CcSUPG1/9dpYFl8iXtbuQU2H99wyyQgZGFPDZsNeXlzc= 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=pA6m5Vb8; arc=none smtp.client-ip=91.218.175.184 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="pA6m5Vb8" 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=1782869001; 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=pA6m5Vb8KmRiyGsfhZrTgKQYfEpC++IIFH5Ly2vt2JZ6mpCZrbVvVGCO/Nlw14adeoXSc3 tFWLbSEPGGDTRuQ8ctN3wHUfRJevqO/EWiOcW0+rUBajSkN7jsxxx21iPHjjTVGmvi6syg v39BgAuIcEaWMGMCl1oslYt2oU05+GY= 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 v4 4/7] mm/page_owner: hoist CONFIG_MEMCG to function level for print_page_owner_memcg() Date: Wed, 1 Jul 2026 09:22:30 +0800 Message-ID: <20260701012239.315262-5-ye.liu@linux.dev> In-Reply-To: <20260701012239.315262-1-ye.liu@linux.dev> References: <20260701012239.315262-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