From patchwork Fri Jul 12 04:14:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: alexs@kernel.org X-Patchwork-Id: 13731269 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id BB06EC3DA45 for ; Fri, 12 Jul 2024 04:10:00 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 459FC6B00A4; Fri, 12 Jul 2024 00:10:00 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 40ACC6B00A6; Fri, 12 Jul 2024 00:10:00 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2DB106B00A7; Fri, 12 Jul 2024 00:10:00 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 0DBE16B00A4 for ; Fri, 12 Jul 2024 00:10:00 -0400 (EDT) Received: from smtpin20.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 803651A08FD for ; Fri, 12 Jul 2024 04:09:59 +0000 (UTC) X-FDA: 82329772518.20.CB61778 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf13.hostedemail.com (Postfix) with ESMTP id EEF7720011 for ; Fri, 12 Jul 2024 04:09:57 +0000 (UTC) Authentication-Results: imf13.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=RGpKl+mN; spf=pass (imf13.hostedemail.com: domain of alexs@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=alexs@kernel.org; dmarc=pass (policy=none) header.from=kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1720757372; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:references:dkim-signature; bh=Q63KXJTqBWoFnMosbhyTvubKkB3ARktC6kIK3SNkIjg=; b=kjTVdMKfD0qlg8/kLswCsK22JpzhKPpodKqur4H1/pShcBD6UTpq49NWTy8l8Bh19gnBMP 61s57oXYr54YoZLNMd/TolMK2pTnq3SN0pawJqqeoEr1i1cs7UsdooSA+LpXGFTiII1DDX qRh8LIoOnERQzwTjQx8ZDduoC7N0fKI= ARC-Authentication-Results: i=1; imf13.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=RGpKl+mN; spf=pass (imf13.hostedemail.com: domain of alexs@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=alexs@kernel.org; dmarc=pass (policy=none) header.from=kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1720757372; a=rsa-sha256; cv=none; b=X6c71e44V2wQHr5zItQgooF9Zt2BPbPm6lPPdKx2KHsANJxlY0266OhTGkvRzi8Krl/ybt Dg0793EXpqYcenMJ86kHlSkhkYHHbyIvQWJEoQtUFck0K5sPPNtKhRVJ9CTfScnhY6wAIV AaX/G9BGKhaFpHxhWbJ5OxQAMPl7NWw= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id E1CE560B63; Fri, 12 Jul 2024 04:09:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7934EC3277B; Fri, 12 Jul 2024 04:09:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1720757396; bh=ov6vsRh9oCOwll/9cGyKD8KumYOAD2zGCgg8X1M2O9k=; h=From:To:Cc:Subject:Date:From; b=RGpKl+mNRyRNs7qHLHnIBJebTVTWWLWFP0MvfLyFk3ntzIhWbCxHm/5d+psTOPajs /JYdSITaEXSoFznvapGjaXjTr3kgoNrnxRgtIZjhJo3DhRsRmXFKPX7beBtEeMrzvt aCCItTn4A/+065eqCuHfqjrV5k0dg3wcCdynkwm6ICkgr7x9M68EYRrLsyJvXusQ5v vwNxnyZD4nPOVpvS2KXoHE5qQHkTOb5uwGDPZ/NnE8cOwzfc1vI3sdINfK4PEObuEi Q3i1lFIlE32KzrwaFKpFY8j3e7AXq9GNcH4p139w2ZOds9quPLOhDqcT0R5L6NJvXA X1DJaVCSxdikQ== From: alexs@kernel.org To: Andrew Morton , Christoph Lameter , Pekka Enberg , David Rientjes , Joonsoo Kim , Vlastimil Babka , Roman Gushchin , Hyeonggon Yoo <42.hyeyoo@gmail.com>, linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: "Alex Shi (Tencent)" , Randy Dunlap , Yoann Congal , Masahiro Yamada , Petr Mladek , Suren Baghdasaryan Subject: [PATCH v3] mm/memcg: alignment memcg_data define condition Date: Fri, 12 Jul 2024 12:14:35 +0800 Message-ID: <20240712041435.301314-1-alexs@kernel.org> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 X-Stat-Signature: mkfds7ho7ngd6jcrw4wgdqt9mz8373zg X-Rspam-User: X-Rspamd-Queue-Id: EEF7720011 X-Rspamd-Server: rspam02 X-HE-Tag: 1720757397-502460 X-HE-Meta: U2FsdGVkX1/wWsDyTL1hhCRunhd0LdN6oV6tep/0ORLs7Beln9yKJQbTDheWVleYZvldZwbaiklQZuIpBSRim/KSILg9hyIfa8eLRUF3iGacHoDuf+Xlm8U4S/+5hHmgc4rzZc0EkQNxSbP8/8hw9bkDUjYS5KfV9I5X3YX5LmqVbHmlZkEJVg9iUTbuhzge0Xs9s4h/8wziGZObzL0muBlFG+1zX2G5QsyKeuXC2y7sWY0ETAfdokkdek7phklGRHm9+4WOy7pQ5XH8L63iCvf6wSIYxp/fTSHO2uTMhsKQrA78hN9P7V73MSrFaNSfg4erhCc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o/YsLlQDwpPwsxcsjre5ZKXnpgU0qS5meh2vTrk2zPR/Vhh1BKrYcVeXCyub0Lp9Z7U+nBZ7tWmA6vYovHX7g== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: From: "Alex Shi (Tencent)" commit 21c690a349ba ("mm: introduce slabobj_ext to support slab object extensions") changed the folio/page->memcg_data define condition from MEMCG to SLAB_OBJ_EXT. This action make memcg_data exposed while !MEMCG. As Vlastimil Babka suggested, let's add _unused_slab_obj_ext for SLAB_MATCH for slab.obj_exts while !MEMCG. That could resolve the match issue, clean up the feature logical. Signed-off-by: Alex Shi (Tencent) Cc: Randy Dunlap Cc: Yoann Congal Cc: Masahiro Yamada Cc: Petr Mladek Cc: Suren Baghdasaryan Cc: Vlastimil Babka --- include/linux/mm_types.h | 8 ++++++-- mm/slab.h | 4 +++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h index ef09c4eef6d3..4ac3abc673d3 100644 --- a/include/linux/mm_types.h +++ b/include/linux/mm_types.h @@ -180,8 +180,10 @@ struct page { /* Usage count. *DO NOT USE DIRECTLY*. See page_ref.h */ atomic_t _refcount; -#ifdef CONFIG_SLAB_OBJ_EXT +#ifdef CONFIG_MEMCG unsigned long memcg_data; +#elif defined(CONFIG_SLAB_OBJ_EXT) + unsigned long _unused_slab_obj_ext; #endif /* @@ -343,8 +345,10 @@ struct folio { }; atomic_t _mapcount; atomic_t _refcount; -#ifdef CONFIG_SLAB_OBJ_EXT +#ifdef CONFIG_MEMCG unsigned long memcg_data; +#elif defined(CONFIG_SLAB_OBJ_EXT) + unsigned long _unused_slab_obj_ext; #endif #if defined(WANT_PAGE_VIRTUAL) void *virtual; diff --git a/mm/slab.h b/mm/slab.h index 3586e6183224..3aae11dde532 100644 --- a/mm/slab.h +++ b/mm/slab.h @@ -97,8 +97,10 @@ struct slab { SLAB_MATCH(flags, __page_flags); SLAB_MATCH(compound_head, slab_cache); /* Ensure bit 0 is clear */ SLAB_MATCH(_refcount, __page_refcount); -#ifdef CONFIG_SLAB_OBJ_EXT +#ifdef CONFIG_MEMCG SLAB_MATCH(memcg_data, obj_exts); +#elif defined(CONFIG_SLAB_OBJ_EXT) +SLAB_MATCH(_unused_slab_obj_ext, obj_exts); #endif #undef SLAB_MATCH static_assert(sizeof(struct slab) <= sizeof(struct page));