From patchwork Thu Jan 26 22:27:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Kravetz X-Patchwork-Id: 13117843 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 B36F6C61D97 for ; Thu, 26 Jan 2023 22:27:54 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 389AA6B0074; Thu, 26 Jan 2023 17:27:54 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 337D88E0001; Thu, 26 Jan 2023 17:27:54 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1630B6B0078; Thu, 26 Jan 2023 17:27:54 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 0635E6B0074 for ; Thu, 26 Jan 2023 17:27:54 -0500 (EST) Received: from smtpin29.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id C611180EF2 for ; Thu, 26 Jan 2023 22:27:53 +0000 (UTC) X-FDA: 80398388826.29.808E70D Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by imf05.hostedemail.com (Postfix) with ESMTP id 7314810000A for ; Thu, 26 Jan 2023 22:27:49 +0000 (UTC) Authentication-Results: imf05.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2022-7-12 header.b=DNPjVDQs; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b="SGJ/vmYj"; spf=pass (imf05.hostedemail.com: domain of mike.kravetz@oracle.com designates 205.220.177.32 as permitted sender) smtp.mailfrom=mike.kravetz@oracle.com; arc=pass ("microsoft.com:s=arcselector9901:i=1"); 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=1674772069; 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=yPwKqF+Ah00TGNaDmImLe7JY1l+qKcF5K5+8fxU99KM=; b=rCUWpZCA50z0x/ElZSF2321OUsNnvfJ8rWvZayW8mkepy6/vsZPDuR1rdEawtmdOrlY3/D yZrBzIaGY9x4JMY5ehOSEszn0AfMbpIPq+HWvxT6rX4K1xafXNFdKd9zjbxsVjrJ42SPf7 fyoc0A/pNkjW1q/cszMdsK6PduMNn10= ARC-Authentication-Results: i=2; imf05.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2022-7-12 header.b=DNPjVDQs; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b="SGJ/vmYj"; spf=pass (imf05.hostedemail.com: domain of mike.kravetz@oracle.com designates 205.220.177.32 as permitted sender) smtp.mailfrom=mike.kravetz@oracle.com; arc=pass ("microsoft.com:s=arcselector9901:i=1"); dmarc=pass (policy=none) header.from=oracle.com ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1674772069; a=rsa-sha256; cv=pass; b=086+9SqaM0O0DKYfAPEIohc895B0NpKaD5AB/vBBTGOPJ39UDi+jeEtFPQKsHp4bLKGftf IDcg3/3rb+4wb22RRIEoEl4vSqp+eHhLP5LKk2FxDVNi6zeS76WexwJOQ/X68Nt5rWQ6zM VD7xQhyrHzWNoLgDoNo1kXxBltagkNw= Received: from pps.filterd (m0246630.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 30QIStRv019276; Thu, 26 Jan 2023 22:27:33 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=yPwKqF+Ah00TGNaDmImLe7JY1l+qKcF5K5+8fxU99KM=; b=DNPjVDQsY4POz15sGkrp7DulyhMRF0WuHKGNev9zDfcwWTbaEpkytS+lVSaQKzvZ+qz8 sfEzpG45bpGB34Urusczl9UvO2PqrahuNDDJEBg+8AQy44Kvz9bBDv06eEQJ3cbYQLX7 D/7c5D3rzCxA9XldLxHg+d033AS3u9XbzKvdcKs8hY/oESuWp6A4lfhldcEbmKMlciwn NuHaBpeTj9XiQ5LV9bf1Wholck7kka1LWffdG/DwhLl4FGEMoyI0byclGaneWoHAHj1x W1loEwyVtCD2riyasMx2N6kOsX65Dhce0UEP+rOTd5anLpERAGlhGeQXjkLN20fBn98l 3g== Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta02.appoci.oracle.com [147.154.114.232]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3n86fcknse-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 26 Jan 2023 22:27:33 +0000 Received: from pps.filterd (phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 30QLJJm9010591; Thu, 26 Jan 2023 22:27:32 GMT Received: from nam11-bn8-obe.outbound.protection.outlook.com (mail-bn8nam11lp2168.outbound.protection.outlook.com [104.47.58.168]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3n86g8fm39-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 26 Jan 2023 22:27:32 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DtuezZIQzBMmz6OkmyKBv6lyoefpuEqGBBSHx8gBYNThUFAvDxmP4uzW/naMZS/Im874ihZeodxUo4OxPqEQH8sM3G3IpoTK2gmossf4DcoGjeh8xvNO3CMjRyfo0MBTfrbsNyp7m1hhS/iQCsxeMBSmwQTarFkKBtETvP1WBb0RxcNkvHk+HW/OMcoy7ThAikjftfHR3aw+M89MHj/cd+zbvK6/VVUoledSiN8DfTkfXqdEuutdqlaMxSbINxSukCyR71N4JKsZXXqnR841i8SnQrGHTlC5+qa9kHd8amWrgwTbz//2RC6U4qXFEJqHUvtfFuhUuAqLk3THDCw6RA== 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=yPwKqF+Ah00TGNaDmImLe7JY1l+qKcF5K5+8fxU99KM=; b=mKA4KehHaJTtln3jtZvKBJFH6xORw40ZAbP6X2QGjDi9zKvHLd9jrPcofKkmRLCMLEjcNiB9vjFWJLcm69y0N1p66HLzpppHYLdldC8mMP29V5cg0vgOvmAtpWVtCicC/SLa/KAYU2YPgFi7lqBFyUZMN0oMtKbT69lHxyH4OITHszT+lpO2M3alMdLA/WkYCZsL/esCWAuOVqygT6foJoEWrO/KDiom6V4j8r0tVhUdzK+xUeq5SfYg+SFCMtGbFLPpFaWDnFbnuidMNGT+Aj5INrWBbJbldYlEg1Temutty4IzpIROuhBpEc3UwBOo+Ok1hCFpWDDWwYztlDyr4g== 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=yPwKqF+Ah00TGNaDmImLe7JY1l+qKcF5K5+8fxU99KM=; b=SGJ/vmYjkCcxa/DRiJ0MfcTWoJG67V7WfgEbS9q+qxBxbuvoeqExZoW6vBerPbVsEXQb7vXszGHYjcfWvBJTwfo62FX1el258fo5xMOaFa3n15Oxnpaksf8OJSITjCyfFTuxsYqp9VdeOSzV3q15Kur2XfIpv9rvlu5Wn/gF4d0= Received: from BY5PR10MB4196.namprd10.prod.outlook.com (2603:10b6:a03:20d::23) by PH0PR10MB4616.namprd10.prod.outlook.com (2603:10b6:510:34::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6043.22; Thu, 26 Jan 2023 22:27:29 +0000 Received: from BY5PR10MB4196.namprd10.prod.outlook.com ([fe80::3a1:b634:7903:9d14]) by BY5PR10MB4196.namprd10.prod.outlook.com ([fe80::3a1:b634:7903:9d14%9]) with mapi id 15.20.6043.022; Thu, 26 Jan 2023 22:27:29 +0000 From: Mike Kravetz To: linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: Naoya Horiguchi , James Houghton , Peter Xu , David Hildenbrand , Michal Hocko , Yang Shi , Vishal Moola , Matthew Wilcox , Muchun Song , Andrew Morton , Mike Kravetz , stable@vger.kernel.org Subject: [PATCH 1/2] mm: hugetlb: proc: check for hugetlb shared PMD in /proc/PID/smaps Date: Thu, 26 Jan 2023 14:27:20 -0800 Message-Id: <20230126222721.222195-2-mike.kravetz@oracle.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230126222721.222195-1-mike.kravetz@oracle.com> References: <20230126222721.222195-1-mike.kravetz@oracle.com> X-ClientProxiedBy: MW4PR03CA0298.namprd03.prod.outlook.com (2603:10b6:303:b5::33) To BY5PR10MB4196.namprd10.prod.outlook.com (2603:10b6:a03:20d::23) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BY5PR10MB4196:EE_|PH0PR10MB4616:EE_ X-MS-Office365-Filtering-Correlation-Id: d92fb469-94c3-452b-fce9-08daffec823d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: rXrocklrZ3+ymGnJOGsIvGo5DyRNyUajKdnY3164u/1TAdRW8lblKsJrhar7Pcj3ENOavSc2JXYg0wcF1B0V4VA0gJcVBkhC2NaYjHrbLiFu296RukPOwSgxYT8f4YjmccOQFnEQlfHbPflPIt8I8Zi+iRgLhiHe1GaV73YzlvpgyFzX6KzU6AmHgFNlmEZ4gLDsFJIUgzbMurTgWpMotyD8PpSIJkHnKFLDHF5lX+eJkB3TfaaxxvOlJewzdoWrKyHYiXpzLXtLpOCg4v+EZ/ib0x5ThvtpzF0BFCYnk+c+qcMSBGo+fY6ebdTil/2hW5BmkCA45LpzaGGl0ftsgQIMsk6INS3bQJ1YTOkL5JvSY6gVrUNoKjHRzAC4P2q70/dK1MCw2wc4b1kgwFtD1NY2+m3z76BnAFCjOs02iBaZsmvrcISQU5QiwvS/lk1wgDw5tr7KrLDngd04Do/JQXiSGZ31X37SUCgBpSTDDdg9MpS4ulKqD4c4OMIIpwqhN+2GZnKcJkNsQv9HrPvSakS6XcdDOggPdaiXHGSBJ8iKQCXtR3EN8X7awIc62kbRiFrK2WA6uQnVidZO2Ni6d+K5DKBdSs1EpEYzu8Wq2cuYRxIs9ea2RPymUMX27LUM0SFDnjycKoJFWRN5J8fyWw== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BY5PR10MB4196.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230025)(136003)(39860400002)(376002)(366004)(346002)(396003)(451199018)(186003)(54906003)(6512007)(26005)(6506007)(6666004)(478600001)(1076003)(36756003)(2616005)(83380400001)(86362001)(8676002)(66556008)(4326008)(66476007)(66946007)(7416002)(38100700002)(5660300002)(316002)(6486002)(2906002)(44832011)(8936002)(41300700001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 6uB10rY9eChJktZtdNV6z0bMrifVaC3ZHAzkv3HS9B7tGWrFVDW+2+QPZiD487RtMMrIeuVZloYKjjjsl1qULz2zBBnJVq3+/zJkkqDK+pfIq+xBgaHhfq5Fqub/SpS5O98K+VxglCX1Iv6xJXCEQL7krdgqNsDLDEIryEj5bx5KQILQcLOQgEK41PbDKRour+xg8AIpJ4jgvqwUZj/j5zLYKoJWZpeBox9pWX2g17Rc1LvKHf4TiFKtGZw1bu5k0FC0Bs12yK45hrD9QsWCns6Um0YIhIPtIVqKgD1qqePN8QUASesH3FoR3xfzB4F1Fo+h9hAE5ePLyxUeNwzpH/RHPxUfNoM6RgkO2iR2Gw3NHo3olco1EXvW1sk2iqhPGq5FK4zCTM7KVMCsDKUwnqOWbbH8GEkyUE8xGyjGIab1LwApPzHYq5TRGusLaJxyjtS0fBcp1EATTnwg4G3ekmgGjunldis/Dz+Hx5s43Dh4Z1s4GiZiVdaR4Rb3AarHs1tvK86pDCSa/e6DAKRaqiBXAZ7DmEs7kKaZPbls6RrGdQMMRU4pVh5F7CJjxpJqC/LpLX1y5Sf6sKBfBdhjk88JQIrGEYkOy6Uwo6TYTue0jbph0O8tUtXvvwOP5vp6ylNSvDQvrncUXGO3Y3Mt3MC+/+NLSzD7l/SaQLuu2xOVC+9mXaPD8Hx7weq/iITAJ8yxRkgX1Wxt9quqV5IEu4SU51gtRV8BhYQZO6ePsA13WpXjt9Ej1zPcZrzjvaR4gR03FBIV439k+pHFIQz3HFjpFxzMzZE2IDa9sb5gCfG4vUcP69z325YA8QGSaalM48853HhguloVPBF81J1GxvlzORd7r7TcvdHTV1vKkK3RjyGGFXF9UqC46GlvaDd1XGZI6XSmWqUw1WIfWOZtj1VbJQ8K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gQ+Q0dcGUFezlvPKPeKEgVSZn2+OdVForhvktz7XhAeVV7gULrKE43TQ7OoigEftXLUOWWrV8wJYnxSoYt2CVI/CcAPf3rZfnAbewetCf4Zcx8qMMpuYAMpsRgdCiIsiaojabj/RqquL66w2vWVjwF3P9DvB7FrN/JqBpo1slt+8eN9xNdNn9BC0ocuHaGK0WmeRaTl8TNnr/oJrv5/yDqnJVVh6Y8AhtXaxMMdGIPBhVSCDQU+iiUjolRKk+q6cM0JOGHLE9jTr6mkRYnykCoygo91/CVibZa0Y71vTTYNk4ZRxm+SIihK7qz3OrdE/Jrkj/e0LqOQE7ZTBmOha4Dkp4ZLtgdWI+rgvzEnVEMViCpptHNjJwEx06b5pUgJII+3DEMybasBErE7MH6cWEHkhG/fNUUxtiAextYg3tnXpZpFYR5CAkCj7Xd7qy9ri6wCSFgBT88Ti61xqee7c7vu82/MWIBGn12GRyymENlupS76fFOVKBTzV6+3ioG6tc/FJMtQZMQtPPo8uiE9VSfG83gejZ+cn8HED9XtR14YwFsLE6Xw5XsS72OxKrpnYgb6KUtE8dJrRxPFSzuMiXs38xHT5ReMf+4cIXKXRrV+d1W+rnniMbpdl0pD0F1JUtiJimjLAwY3Rp+FZp+gN7cQDW2O1S/8kccUY1JckOo/XZWbaua/1C76YXH4LyPTxJxGLLkJ7vvHK0nwUuuEy+8K/LCVIsbYvFmpfyFMcLdznftl+sY8xdP+qQhg/EgyJyapRnWDeksua X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: d92fb469-94c3-452b-fce9-08daffec823d X-MS-Exchange-CrossTenant-AuthSource: BY5PR10MB4196.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Jan 2023 22:27:28.9906 (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: XIv6WiloDy5VMKzN2FTv1fgAmUtpjsr6/uEvgtwozGzWY2o6Znw6BXkcTODzNaOZKilho/osK1Jl45QivAEunA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR10MB4616 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.930,Hydra:6.0.562,FMLib:17.11.122.1 definitions=2023-01-26_09,2023-01-26_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 suspectscore=0 malwarescore=0 phishscore=0 mlxlogscore=943 adultscore=0 mlxscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2301260209 X-Proofpoint-GUID: 9eHBX4WEkN-u7zP8NfcfjeZFpyBxCzHy X-Proofpoint-ORIG-GUID: 9eHBX4WEkN-u7zP8NfcfjeZFpyBxCzHy X-Rspam-User: X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 7314810000A X-Stat-Signature: 14rujsn8pz4oop6r16tn37zdqjbq1w9x X-HE-Tag: 1674772069-281026 X-HE-Meta: U2FsdGVkX1/oVJhNfIAeh8ScsZiLqmobIPecfG0h37EVVLWIfZmwoXwuE2A9zfRvaUzTCS5xTcSJnvx0Fxlon0SDANwJa9trzFHppyJJvWN96dTmq0uUi4pTiafElOm7NHIw6S8g3XBw6IFZiA8XjmomsgaKUBsuQLSXx1FY4Dail641ro2XMclV+OKvvCff6EHKW96Xe6NQfbrnZuWELNGGSB609M/UNPYFBhPWVnu3l5OQVTyWf6LSPB4MmvaC/0SwlIxHimtsWeNlcDu04FnNWU1wqUpnUSQQmqlLzzDrwmBsOC2GeDmXgogKTb/Rw0YON1a5es/wB9Y6OBemmbifg2jrC96xMo1ou02vaq1ytcswyjFNj++TGmiUpLI2h31Gx/hv0XbKzYfLt+wxtpL2tQj3Bj2oHBfF60l9cb3oqPucM22oksqYlDe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aOg== 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: A hugetlb page will have a mapcount of 1 if mapped by multiple processes via a shared PMD. This is because only the first process increases the map count, and subsequent processes just add the shared PMD page to their page table. page_mapcount is being used to decide if a hugetlb page is shared or private in /proc/PID/smaps. Pages referenced via a shared PMD were incorrectly being counted as private. To fix, check for a shared PMD if mapcount is 1. If a shared PMD is found count the hugetlb page as shared. A new helper to check for a shared PMD is added. Fixes: 25ee01a2fca0 ("mm: hugetlb: proc: add hugetlb-related fields to /proc/PID/smaps") Cc: stable@vger.kernel.org Signed-off-by: Mike Kravetz Signed-off-by: Mike Kravetz --- fs/proc/task_mmu.c | 10 ++++++++-- include/linux/hugetlb.h | 12 ++++++++++++ 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c index e35a0398db63..cb9539879402 100644 --- a/fs/proc/task_mmu.c +++ b/fs/proc/task_mmu.c @@ -749,8 +749,14 @@ static int smaps_hugetlb_range(pte_t *pte, unsigned long hmask, if (mapcount >= 2) mss->shared_hugetlb += huge_page_size(hstate_vma(vma)); - else - mss->private_hugetlb += huge_page_size(hstate_vma(vma)); + else { + if (hugetlb_pmd_shared(pte)) + mss->shared_hugetlb += + huge_page_size(hstate_vma(vma)); + else + mss->private_hugetlb += + huge_page_size(hstate_vma(vma)); + } } return 0; } diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h index e3aa336df900..8e65920e4363 100644 --- a/include/linux/hugetlb.h +++ b/include/linux/hugetlb.h @@ -1225,6 +1225,18 @@ static inline __init void hugetlb_cma_reserve(int order) } #endif +#ifdef CONFIG_ARCH_WANT_HUGE_PMD_SHARE +static inline bool hugetlb_pmd_shared(pte_t *pte) +{ + return page_count(virt_to_page(pte)) > 1; +} +#else +static inline bool hugetlb_pmd_shared(pte_t *pte) +{ + return false; +} +#endif + bool want_pmd_share(struct vm_area_struct *vma, unsigned long addr); #ifndef __HAVE_ARCH_FLUSH_HUGETLB_TLB_RANGE