From patchwork Mon Aug 29 23:00:09 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sidhartha Kumar X-Patchwork-Id: 12958522 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 6B13DECAAD4 for ; Mon, 29 Aug 2022 23:01:04 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 99881940009; Mon, 29 Aug 2022 19:01:02 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 945126B0074; Mon, 29 Aug 2022 19:01:02 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 74ADB940009; Mon, 29 Aug 2022 19:01:02 -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 5A05C6B0073 for ; Mon, 29 Aug 2022 19:01:02 -0400 (EDT) Received: from smtpin26.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 3315380AC9 for ; Mon, 29 Aug 2022 23:01:02 +0000 (UTC) X-FDA: 79854152364.26.3A74718 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by imf09.hostedemail.com (Postfix) with ESMTP id AAC42140056 for ; Mon, 29 Aug 2022 23:01:01 +0000 (UTC) Received: from pps.filterd (m0246617.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 27TMDm2w013302; Mon, 29 Aug 2022 23:00:54 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2022-7-12; bh=PcELQcEJ97DLVJYlsp1uCVAxLscIZ7YH5A97B+6O20I=; b=krGhVutIoVlX2hQJxG09NjXRxIVoAiXx/IRolDbrvF0lh1IYHK3knG4mfC1uTzEj1SSy zemlVMAGHuXg6IA7BTKse5bE9zxgCITl/ShlOkaLPZ/bWGsvgriZR5QQ72ngBfCUP3Q1 XouuRIt3Fz5LVye1jzAcv3KRl0SoazqNm485W9wMulssHmmcpEpUwZDh27QQajH2eI81 QixMvJDTMFr5IgtTvYQQ8blbK0LelheiyLkrywxDz+WfPUlqfJZYDtJzZ1/mps6XyOrg f1pjV9+Zs1NKAtNpghJWgOhB42hUt2nTkiuP1EigQ9K3nnt/IYQSnahqT4z189idhr7x wA== Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3j7btt4s32-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 29 Aug 2022 23:00:54 +0000 Received: from pps.filterd (phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 27TKr2hP021257; Mon, 29 Aug 2022 23:00:53 GMT Received: from nam12-dm6-obe.outbound.protection.outlook.com (mail-dm6nam12lp2175.outbound.protection.outlook.com [104.47.59.175]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3j79q33mwp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 29 Aug 2022 23:00:53 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WLoovgi/RglZV7gEGhr5erPMbawyZ4oRqTsIPSsFXFjWVP5RJI9+YmfIu2P0PLAt7DYclNh9UikpMdy2RpUhtzXDPbMCRU4x42DJT6flaJjwHM4Njg47qmosRNOLUBIcmOkD3dm14F3Lwwt6TgYAzrqW66WW1MUUBnevYxxJ63Fg+qZhTf0y+d9Wyv4D72nqmCw8Id2bS7irSNGZJD2ctid7SwFpTHFqtPGdrrJzTmdqoWga/ZFIqorCnwIcJVeLy5Qp9uKFucaoxboiagaI8sy7zmRss4tLL8Px/avQj78E1uZ0rjzq7pgbeW/MD7VbbeP73gErV1SvgDitA/RZBQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=PcELQcEJ97DLVJYlsp1uCVAxLscIZ7YH5A97B+6O20I=; b=MjnV+kfAThN0GWgNslwRVh4UR498f2+fddKA+aihai6cjB3ybgSya5Sz+ap7Q8B0A5Z/Ys7aOW+Tho5TqVrXampWKOrNGHd2CqjtXkrXdR7fnZwoQOtYWUSnzgE3RM1Ft3icx/5JNYSL9QJi1EcuQVnbO0+XS0L8lEEF8VFDAds7qFXpUKbPafT78pZifCxImKLkODFUySNDldwFT+jnpS7+WNiDhdWzTxdcUkCNz56O6qtwL6Nicf9LdFmALq9lRZwhBcgOwo3QAGrduk2AImhHnXWL+ve7XmIBZWNg84hXTxzZi3tE5aEQKAjjFZdMnKP2iBlAs20mzGTQvshY0w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=PcELQcEJ97DLVJYlsp1uCVAxLscIZ7YH5A97B+6O20I=; b=QGEctu17KSoB8t/v43JBMHYc89VG00iPs9WRdmFo3qK/EhhxrSroK9HV3g5GKbS0hRMf3FP4gI3LuRfWwQASxzrUiInyEwfZyzVipGGAls4qhqXKUfwHjoJhjHhE5tNinGwQKftQCTdAdc+p7bs7XbiP056AIjYqdj/KaUupQxU= Received: from CH0PR10MB5113.namprd10.prod.outlook.com (2603:10b6:610:c9::8) by BYAPR10MB3736.namprd10.prod.outlook.com (2603:10b6:a03:121::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5566.21; Mon, 29 Aug 2022 23:00:48 +0000 Received: from CH0PR10MB5113.namprd10.prod.outlook.com ([fe80::e026:dd88:fe66:6ed3]) by CH0PR10MB5113.namprd10.prod.outlook.com ([fe80::e026:dd88:fe66:6ed3%4]) with mapi id 15.20.5566.021; Mon, 29 Aug 2022 23:00:48 +0000 From: Sidhartha Kumar To: linux-kernel@vger.kernel.org, linux-mm@kvack.org Cc: akpm@linux-foundation.org, songmuchun@bytedance.com, mike.kravetz@oracle.com, willy@infradead.org, vbabka@suse.cz, william.kucharski@oracle.com, dhowells@redhat.com, peterx@redhat.com, arnd@arndb.de, ccross@google.com, hughd@google.com, ebiederm@xmission.com, Sidhartha Kumar Subject: [PATCH 2/7] mm: add private field of first tail to struct page and struct folio Date: Mon, 29 Aug 2022 16:00:09 -0700 Message-Id: <20220829230014.384722-3-sidhartha.kumar@oracle.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220829230014.384722-1-sidhartha.kumar@oracle.com> References: <20220829230014.384722-1-sidhartha.kumar@oracle.com> X-ClientProxiedBy: BYAPR01CA0049.prod.exchangelabs.com (2603:10b6:a03:94::26) To CH0PR10MB5113.namprd10.prod.outlook.com (2603:10b6:610:c9::8) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: a154b1e6-e4f0-4604-a2f5-08da8a124fea X-MS-TrafficTypeDiagnostic: BYAPR10MB3736:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 9VRYWp36kdMLurGv78Z1h1fza8LouFfbXxBHklBzKYSLYk73bc8olUFMaLJxkhwOe6Ikqxxt1/GsUeA7pA2/KdnDfpQqgeuGzQuBYkuqf+6ZxDgFAxcHQaBKSlvSSgdGmeSZz4/kMO/JMLiH40WhC9P9Bujd1PDfNmW9NGXrnZ/hbwXscqFvXxKrrbR9PqnAqEYQK/gFXeruOnEZE1CUELMU2lBjcM6dOMpaTO9v+2f1LCYtD2dwSKOKN+h4AYvLQAjpoqBNtsnN1klM6lMp304MeJgdcgTi5mF4fRgwuo3/4Owtik8wl2hCtzEw2/EbwCh4cxXhpu/a5Gp/oA/tzmofhwxPQAslCzDeoXG7ZV4t0uD0yjs2+pOj8PQOl27iX9IkV+yTmrVhyAGZZ7KSc3zeeC6GUeAG0/+ksaWc7DrQSzwQ58EVWZVKaVzMewyg1Ja2llX/6UxrLzzslae1iatlAPCDiXcLTzOKN0ugcNEQKEEyt3b4lQvmkosEQo4qYNAJmzZcIxnopHDPMuK6r7clCwuDafmyMHo6tJqIGiE4FO7gWuFgjyet6X4bAMNrtEGrcvEOcrUzJWou/HpuTNomaFPhHhCFjTAlcoLRoROljfoWXDi7zbasOYn0uXu0iQLBpnjP3CFLYScgtDtZ2h6lmXF46YYtieUp3BZ4OfhpIwvfp/1cxvV72YIIJTGZmrUcHnUP85fQpaRkr4Rq0w== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CH0PR10MB5113.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(396003)(366004)(346002)(136003)(376002)(39860400002)(83380400001)(5660300002)(86362001)(1076003)(2616005)(186003)(38100700002)(44832011)(36756003)(7416002)(66946007)(4326008)(8676002)(66556008)(66476007)(2906002)(6486002)(41300700001)(107886003)(8936002)(478600001)(6512007)(6666004)(6506007)(26005)(316002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 7naYemPqoh8GqbNLMgR9vTFESOQQahzbOtFeP4wA+a9T8HLTeQAfUgqJdij7mumUZld7NQQe5WXD4UThqECdPUtsqYXliCCeTQb43nb+18SzWvh8zlVbceCFzofoVyYQxhAzqiyxQ/FyHv3zkI64eSW1SK/1G5f+FPT09lKXZYT7+rP4j0QfSLdLgzsi5aHfSsg2m6XALeljOY9WNrHQXyx4Zmm6fn372mHVgnh4DD/ZptkC5dgMOjNQLezDFiVL5xecTlHQKtc4DVv9PvT5/oJguXq79FstgOCeXX4dvBlildMT7zo/RgyRvf+CYQRtBC0jeJKAbhsYZBbHidsN6+dJSXsy3bvpi31LLohax0BZK/6t6HKlJ6iuKgfKLum+Sd+LbbYMergUD/dFIWFI3S9DsoLn6Qfr40CSJ1J0EkvBgL1IS4d+0z74uYkHS716sovUg3M9xi1FNDfjNTw/V7JCL1nG+oQnSPnea2o/2bw/Gmg/9yuuSiCJlHx6b0k5WQo6dnEFtoJrMxsNHZ7/DfrLzDPWNUxRTKQNsvKSybDGxIZDDNpsZICDGaBvJyK3gQDHcB+u66raWQYv6JgGLZv0xHXrxb51qpfM8Hkpg/KYlw4MxsHAFPt8jLcsjE5cXdvTZKy1kzXlUmjhMGWeIIgUZdcxYOsudP4pQgpaXIiG/IxGPIYkoKvL5PxuNlo1arWhDOVdHxBWfU87oBfugu+iYDAEvC1fTivwnA+hcxcv0/NkNSJc/3KjgsKpdrxlIjpV8WT+pLwdVWgQOdw0+NkCWcj440VTSyqPsdyq070xOXU2q2JZqgb5VZhdwSY5ALhb087oXVIny7ouVsdcb5sSRcs5aKwXg522ODGndI57PyJPi5YoeX4pybA2R6yQRFL8NFOKdvxPkkp5V4H/mYWk0p0GD+qocBKGa6FDftltrjMeFNHmopJ0iieOUnLdKJbsDklxDx67auPeFwz1F6WIx4d0I6KeKkckkrD4PkfXOkZvDV+Pn+lE7K2Tyj03+40X7OPwkOktF55lipuiwv4s0df0APQCKAoPTHTuzYorkmJT3NeXL49KIliuT7vVmOIxfmCttQMUzrOo3emYInWq8mWIc2Ju3UXloAlFSutl7hhIIH83gg3vk4TCOSFfAaBUaPEDzDJ0lwaOwqxHxshdfOXoo7L7dvO64ohPf8pt8H2o+pKlspx7E11COrfkF8HOL5iSI36pwxakKft+UuaZiBDSsBt8IN6m0KsNnxswI2xFurl8EdbHJUM9WTwJ26TN7KaZsrHJNrhd7r23lNT5ozsTfXIHOIua/jejYjAmnGDEijmH2PO0ILmoDeDx0Jgl3qf12nEXHKsTbxE49Rdz5iAkHLyrl9qRdsF9zK2S3a4jAjmKssIWtAp0X7DPTpYMpfRUJ42eQk+TlTtDbfZsCu1IucVYzdLnSjehTX9ixNT3FUBHFnr3kORsf7FXZuBrV6djz7K0nEZTECCu8eYuEGrNjiD3eclzAR6E/G09CZ7WbB14Rw9T5G0qLRi+QxrlEvqsBxJKuGH+3lfzs9Rruq5SQP3hl/JgE03Y94RuIkCnaH2+0laXqMuALvRQ1CB6qUxOPA+PWMPSAy8yqg== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: a154b1e6-e4f0-4604-a2f5-08da8a124fea X-MS-Exchange-CrossTenant-AuthSource: CH0PR10MB5113.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Aug 2022 23:00:48.2417 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: WWGNNWuJZgxUakLkc6QdS725Y1dAiPbwuZqm0YuPYPsFeQ/knLjVBBsQ/RnU67vPHWnBx5E0fK2JZgubTw9QoYlQpqG/uE0NMvTubqBk9W8= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR10MB3736 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.517,FMLib:17.11.122.1 definitions=2022-08-29_11,2022-08-25_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 mlxscore=0 malwarescore=0 suspectscore=0 spamscore=0 adultscore=0 mlxlogscore=999 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2207270000 definitions=main-2208290101 X-Proofpoint-ORIG-GUID: KQJrvUl2luR0B9OAojGzTamAzui-Qp5w X-Proofpoint-GUID: KQJrvUl2luR0B9OAojGzTamAzui-Qp5w ARC-Authentication-Results: i=2; imf09.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2022-7-12 header.b=krGhVutI; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=QGEctu17; arc=pass ("microsoft.com:s=arcselector9901:i=1"); spf=pass (imf09.hostedemail.com: domain of sidhartha.kumar@oracle.com designates 205.220.165.32 as permitted sender) smtp.mailfrom=sidhartha.kumar@oracle.com; dmarc=pass (policy=none) header.from=oracle.com ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1661814061; 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-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=PcELQcEJ97DLVJYlsp1uCVAxLscIZ7YH5A97B+6O20I=; b=N53HCmbIXd3dIvzaUM9ZVDakNDN+Qxrm+YDtPcvrdxHn5RoiqU4wd4qKyF9hpoRMTwl+2G YL8zwrrWYn26oANHNGh0BvurJkDPxHf2O/dSZlxpDVV+A5tyOueflNnEMHxOfwK3spG+bX yiST2QZKWsrWQFR+ThSwhSHHCToFEZo= ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1661814061; a=rsa-sha256; cv=pass; b=gCjyCryxnsmJEkXswrb/fIx8PiIEJPb09ch1EWfa/Ubz/6ynHD2ChuFuV8dDD9w0NQjPHo j7IwMbouHyDWB6hjuYIwWPePdRkeCGwm8uwwJFfclMjksduVZ0acUTDZv3Nkyl3ebGezd0 9yXuw7oWtJZY0w0HELHNkqWxSEInYxI= X-Stat-Signature: gamrqqmfoxuan69o7mu97ps5cb7yuaau X-Rspamd-Queue-Id: AAC42140056 Authentication-Results: imf09.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2022-7-12 header.b=krGhVutI; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=QGEctu17; arc=pass ("microsoft.com:s=arcselector9901:i=1"); spf=pass (imf09.hostedemail.com: domain of sidhartha.kumar@oracle.com designates 205.220.165.32 as permitted sender) smtp.mailfrom=sidhartha.kumar@oracle.com; dmarc=pass (policy=none) header.from=oracle.com X-Rspam-User: X-Rspamd-Server: rspam01 X-HE-Tag: 1661814061-119085 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: Allows struct folio to store hugetlb metadata that is contained in the private field of the first tail page. Signed-off-by: Sidhartha Kumar --- include/linux/mm_types.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h index 8a9ee9d24973..726c5304172c 100644 --- a/include/linux/mm_types.h +++ b/include/linux/mm_types.h @@ -144,6 +144,7 @@ struct page { #ifdef CONFIG_64BIT unsigned int compound_nr; /* 1 << compound_order */ #endif + unsigned long _private_1; }; struct { /* Second tail page of compound page */ unsigned long _compound_pad_1; /* compound_head */ @@ -251,6 +252,7 @@ struct page { * @_total_mapcount: Do not use directly, call folio_entire_mapcount(). * @_pincount: Do not use directly, call folio_maybe_dma_pinned(). * @_folio_nr_pages: Do not use directly, call folio_nr_pages(). + * @_private_1: Do not use directly, call folio_get_private_1(). * * A folio is a physically, virtually and logically contiguous set * of bytes. It is a power-of-two in size, and it is aligned to that @@ -298,6 +300,8 @@ struct folio { #ifdef CONFIG_64BIT unsigned int _folio_nr_pages; #endif + unsigned long _private_1; + }; #define FOLIO_MATCH(pg, fl) \ @@ -325,6 +329,7 @@ FOLIO_MATCH(compound_mapcount, _total_mapcount); FOLIO_MATCH(compound_pincount, _pincount); #ifdef CONFIG_64BIT FOLIO_MATCH(compound_nr, _folio_nr_pages); +FOLIO_MATCH(_private_1, _private_1); #endif #undef FOLIO_MATCH @@ -370,6 +375,16 @@ static inline void *folio_get_private(struct folio *folio) return folio->private; } +static inline void folio_set_private_1(struct folio *folio, unsigned long private) +{ + folio->_private_1 = private; +} + +static inline unsigned long folio_get_private_1(struct folio *folio) +{ + return folio->_private_1; +} + struct page_frag_cache { void * va; #if (PAGE_SIZE < PAGE_FRAG_CACHE_MAX_SIZE)