From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-171.mta1.migadu.com (out-171.mta1.migadu.com [95.215.58.171]) (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 E425D2FD1C2 for ; Tue, 30 Jun 2026 01:54:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.171 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782784446; cv=none; b=c7O3WFCk6m3ZNIZs7i5LWr36aI+LSsfp0TN818adUmt9AslLWb3HkHyTqSNUgRVY68/v+dvrfhesW544buEeJrv9QImAhGNyJbI1RLKIwtNxUQOvc2aoE+xkH2+WRhQG+QPWNH1zZg8THYTUWlZe68bVYSNzuH/zaEn1Or4cKBI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782784446; c=relaxed/simple; bh=e0PbK+wK92Zv6TvIhjVBvA2T+MJGCVXfOYBXEKewRWs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=DNcwd27pfxFFdz1cNcLQLVOAFiNz3VDKFYvTY1gVH5FASUTpq5sNjGkVbN5jzZZq0Rr6EdnQiNuqgg2FqU43l685+1AGApckWxD4IQVavQrjaYWQYyRb7/6hxY/PPuW+GMfCrLdh8JYqFNjAE90wAWDVCXBeDdUDVQ9Dij8oPWI= 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=ktiapAz2; arc=none smtp.client-ip=95.215.58.171 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="ktiapAz2" 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=1782784443; 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=ktiapAz2WCe8cDjso3x7dyadbLA14q7rbR36f7qfLbmJ6zudNpK+1HZVjbdS5LtcFSRkns 7DmC8D9tEogyic7rBcJIEqlgDvRkzXBymoKGyHYe0AI9mjM85gIe/7q8I0ZwW5ReldRTaI R7jRfewE5hq7Tza9/hHl/bFsXyy1jIw= 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 v3 4/7] mm/page_owner: hoist CONFIG_MEMCG to function level for print_page_owner_memcg() Date: Tue, 30 Jun 2026 09:53:21 +0800 Message-ID: <20260630015331.147174-5-ye.liu@linux.dev> In-Reply-To: <20260630015331.147174-1-ye.liu@linux.dev> References: <20260630015331.147174-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