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 From patchwork Thu Jan 26 22:27:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Kravetz X-Patchwork-Id: 13117845 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 87628C61DA7 for ; Thu, 26 Jan 2023 22:27:56 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A8CB66B0075; Thu, 26 Jan 2023 17:27:54 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id A3BBD6B0078; 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 840596B007B; Thu, 26 Jan 2023 17:27:54 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 6B1C76B0075 for ; Thu, 26 Jan 2023 17:27:54 -0500 (EST) Received: from smtpin26.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 438961609A5 for ; Thu, 26 Jan 2023 22:27:54 +0000 (UTC) X-FDA: 80398388868.26.6009C74 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by imf04.hostedemail.com (Postfix) with ESMTP id 9487E4001D for ; Thu, 26 Jan 2023 22:27:50 +0000 (UTC) Authentication-Results: imf04.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2022-7-12 header.b=mrha1A0N; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=tZSIY0X9; spf=pass (imf04.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=1674772070; 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=tzIdewK6SfV/Cp2+h/gk4FjPJyI7o56RWPQRWULdKz4=; b=k/9szYBBJkPDpFHO8I9Z+DItZZCjpO9uIITezDa7nTdecu3wRoKVlY7m7/3uLO53HpV2wP Ry7ji9ZUhBKGFu6QkJGwC62zJo+4MBrm25iUQdszEgfTkjQu+a2ogV1/+SZcvBX8OizABq 0ib6GeqVYFuwm32Q2gzl8qGnW2YKQ7c= ARC-Authentication-Results: i=2; imf04.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2022-7-12 header.b=mrha1A0N; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=tZSIY0X9; spf=pass (imf04.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=1674772070; a=rsa-sha256; cv=pass; b=XXh4kAgtSWdA1c6Tiak9hQKmIwTkuldwBWXXuSOefqaobLxmX7ByUNNEp6oLHHnqfBsIJr HozWf1pcBKfxkNRVY5F7OdfstfbDyWYlDCuFuAqnUTIeNmaiJJEVClbmr98t6/vY19xqSB e831F/ZpZvRyasetx5zrB2qiwQlM9fY= Received: from pps.filterd (m0246631.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 30QISwhE019405; Thu, 26 Jan 2023 22:27:34 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=tzIdewK6SfV/Cp2+h/gk4FjPJyI7o56RWPQRWULdKz4=; b=mrha1A0NQHx1UtIuZ/1fZGqmIXqvx2G6hfiDtbK0uitZP0pJFVgeLjczLbzuJK6iupKA ngSXQmZqcSakOT0QtKFkwTBrX7t+j/GzN9mTbFVm8F46bUECS/ya2GAAOzTBvLY9RJg6 LceRxZ9OrdxY6pLctqYddMlnAFFFkybj7+y1ba8soZgvHDXFsM7J8CGXfIMPayQamxP7 Att7Cr/D55Ajk8PDhnDnV/rq1NdhOwwYbhYi59uPDMx6hVB1qvBy4zXrVK4MO49JK4sG uM1gFDnrhNsgrbexQLFV7+y2o1BfeSz3+4ZsuJFe0LP9122vrVMwRhDzBTWVQqwNNRPj WQ== Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta02.appoci.oracle.com [147.154.114.232]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3n86u33mf5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 26 Jan 2023 22:27:34 +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 30QLJJmA010591; Thu, 26 Jan 2023 22:27:33 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-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 26 Jan 2023 22:27:33 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DsO2MptoLJIskMQi+IPHu6vuSt+CXW0EBwKdpVsRrtR1xREutWdsj6eGwwdtvBTmi5onX9G0xTz1wZVI1becFwuFtnYOkrZXgQr1GO/VVZSkJ4GMGBP/d1cl7p82kfww8w6l9fVIls3gMcCaLh+f6xo+JGXj7yUxARGRDtL7s8DFmTk9U3vgSf4jDVfnFV71jdZznEnflz+ZWN43IK7YJb6lTNYm1n8iQRjEPCQnBCJbDnKMgiWLrQPMI8m1ly0dQNqNtVgm5C74EzMiQJ9OhF8yzezo7/JWrAeJ26e8oeSp3DvksOOkZm6Ge/0o4UHZSs9HRzv3cz+rVHJFXDmPpQ== 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=tzIdewK6SfV/Cp2+h/gk4FjPJyI7o56RWPQRWULdKz4=; b=DCWqMoVQjXSBEEF3aGMfdQXPeIaE//LsCSimd2SuD83dzHqQtoyb1xlWzJjdDYuDXubs33w0PvFxOam4ZOJYhzGbudAwnS7klBwuaUwaGHpkmhscJ4qcLjfD+5uwB4EzB2yhU7dk+LIzUBG6mjenMHycjt/y0Ru4UxwPk4J6n+4OVIl6J+xh6EqxOa3KAiRp9WkgfytQ5QzOu3fvzPeIYLCegx04wrxztTx2wHae5bC41oD1I9wupPwHKoRh4xgWVzoyNkiif/yKjsUtWdLSmwvue3h70LSkXgm5Q9GFA/Nj3eIsO12Rf9Qad6qJbnZ25zmcprzsFj3FDqBKdEZBAw== 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=tzIdewK6SfV/Cp2+h/gk4FjPJyI7o56RWPQRWULdKz4=; b=tZSIY0X9j3+AeBQI9MMaA09DszhizOiTuyaCOCIbieK0VzGuQ/3jQwvH4B/Kh1yMsbT82Ilbz+78PvOvLdBC6g5VW+DPpOrNPhyrYylo4P9RjKwVrIY5vtgCfSgO5KXQtx3Kwz44kPpXsZ/g40Q06bnxG/NFB/jsp+FcULc15wY= 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:32 +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:31 +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 2/2] migrate: hugetlb: Check for hugetlb shared PMD in node migration Date: Thu, 26 Jan 2023 14:27:21 -0800 Message-Id: <20230126222721.222195-3-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: MW2PR2101CA0015.namprd21.prod.outlook.com (2603:10b6:302:1::28) 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: de110378-14a0-4aa0-63e3-08daffec83be X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Ss6E4bjf9To2W5p6ZaPFWewi/F1wp/BGgHJ06jB4KCZ9gUkWbtO/QzJI7NxsDTBTS7UbUU3eCkY2UFCxk05L5jkNPlMVZWKBEID3FR58brvyYKxAppiH0D2LfnLkENQZlbnN/P3hA34jUyK+yOxAH0cAahV4AF16VBdzBuS+WyXODbMraKgJS6RqRckZjdq7lGkRd8fAzonB2pZhcQQ+ZhIs5az+T+/YEzx9zK9XrueHAFcDoKVZ5O3UMppqXnSo84tPv7Zz7pJvIklJMRtnr5c1GAmyx0D4jcJg0SilBJQ+j0OdAghVQaNzCzYWzTUhPKUwFkaocTaadKsdUgCLnejBL6tOS7J0kj+ysY9IMfpgOD9J8lSoSwu0wAKhCQDtIb5rWETu0/IgzfyIoBFmR1DY1pYeAwg/bu1pfKAMFypPFQHGEEMgIG1tNDKc0M6oUBt32RX2pIY9QW+LFmASeBGfFii80mKbaDvpqL+BvBHCO9A8mqKqPhItmo/ZJgQ24sfjsVBK8A5Rij9jT+NNKd/9DCHVAxgntFnTU0nvwqxCyelzYLf/28F7IC4ZnuAlMzyvbYZAxHTidIP2rP/UUnMymPCRB1D8lTQACOQF6HWK0IcMyGsrBhiWll2E9+toM5OhGUrDqMC4nIHhElDsGA== 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: x0SjNm/K/jsf3549BIUdyQbZ1/aa5ei2aYpDvwYrMulbryK3D4zg/uSAp08DbArlXs/BE1pZHfrghio0/nL4zgFvU13qgG+XkwljlHYCV0u8SA2pgwH6mL5g3i8aQejMB5mnG7DaOv8raVAb3icfp5jESXaywHmvbJf4uk9dqc66DB9lR9CIX5IQ+wi5TU4V6W1y6+J/BFzkckYmBtK2myYG8/bmkBB/Kt61TO/zFZU+p1xDrRKsvgJnSOvqJzxO8XcrOF4XGkB30fILQk3qbWENAZI3set/6YgwN/52j1Mi1gAl5haE11zVjsqI2IVZTOMcMIhiquS86KK+q1LU35x1D1+H8abaHBwiLFefUrH8K6NHONa/ywPFiM+P4BrG1F6DxxEEEv9uLghwvINEqIW5T71gb9Hw0rhKN4x+tjk3QbL8hD2KR8ruTs7myldLlzgDVb+AWtGu273xKARfUHsjLK7OX4s0hZ27InZwM1VX9Gpp8Ym3laud3QRho4e1w9TLIaYojmgKFsp91mrd0MI+Yg8qZbWbFS+XfnEPIV5PKFG7bmh08vjN41J8RvweD9Uzc1fe8qleefahl+zHcmepv4g42cneXXp/iInzCm6ihUZSGa7LoS9Ik2XZA/D0ifjlkzc8TzbW1BIcwCnQUOv7EYqB09j+/obUDdc3SfZo7TdKAsucr0jc4LisuN3pT6Md51fO49t938HVJwF7kUsHvzjuvkMzPY0pvZandprzR/2B8BU17xPO9NnV8V1IRtUsqyTD6zy0W6zMCXDeVBYkOR0J0w4pxVG3tY0OJ1qA7ttWxfwBTmKyXqqWXEuy/LHS/JQnDPQZJq23iHDI3hUinBQH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USz1aOByHXAaJ+d2oQibqB6ANEqXcPgQsQZepCScn2BrH7CsKYMIwSTknyN9mEbfSzXaBgpPqPfnJiN+YiDdFSI+U8fjVm5AdEbs7WkF+Xum1qKgS3/d+bck72EfiaOKVGyQpQ/KFFLefi+lXNgtE7vkDdOH2BUdmE8LesAT4bcUo4wWSbfoMAi2ChawK/0SI398Ui0KqyQ9iUqqZfjxlJXwbzcJuZXit1STs4daauvjb8PqkdTVG6l1YnquLuJBX0We+JG2FqB4b4lU8BIP6YiOQi3AfCueNFVgD/ZDvu4UGjaOdwTnZHq3vaH4HlcaTGL1eyij56/CK7W4/Zg3WvOjcBPHd+79R5Tz/HKUgiRkwZ0lGAPbHTEGsS+MKinm6lNbIgmEu7DA7oFVwYFl0vA76LPLIwgNw1BUtaInMxzBs9i0J1Rw+kdjyQZJFL/8X8Dj6m6V9R00nQLDnDdbZVXUHHwJ/Z8gihQHnl5+D11IGwlFDyBZGq91gETQNmB2m+DiKXg9qsCQA4CWt70+HA2V6kU3cyYA9vV+4QYapk3mm/UwosVV9d63r3IrwgZtzZgDmLLICSJuJRc9qD9h7pcQB9wFNMnZx9RHFFxRDPmDwzo3QWipIDQUw8aDfF7qcwH1JryqduaOfVrpzEZ2hE+VeUdmrFAGRbncn3THbY761EwnuGXrZzRk98yeQhAP/xGw3OuT9Q+SobXPXdYp+6UGsxDe0ZqsMZg/Oi1jgyfJFhS0IsK+W8oyhOClNEbRKSC2fTIAMtqHrF+idsWyzVhTPsBfXkUjjNTugl5JBbEM8Bcr8wbjPLqP7hdLJ7fkcBjLzmRJ4pXK/WbKes3rnn X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: de110378-14a0-4aa0-63e3-08daffec83be 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:31.5254 (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: wJ52ML4B2pOlIDfrC93SOWaFJLY7DhL2klszMnVBEmIHZu8FZcgVhV1N3cXOBuPLJWGEpfwM+P2nIxsxbw1H4w== 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=811 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: kxo3hd0rXT1RV0eFdQ_ulo4F0MmRqrxN X-Proofpoint-ORIG-GUID: kxo3hd0rXT1RV0eFdQ_ulo4F0MmRqrxN X-Stat-Signature: iy5hr8cw4pa6recw43o5pre6w1kg6tbs X-Rspam-User: X-Rspamd-Queue-Id: 9487E4001D X-Rspamd-Server: rspam06 X-HE-Tag: 1674772070-958238 X-HE-Meta: U2FsdGVkX18Vt1a1WYp/ohgK00nv+hl3kzFVe4K6SRn+RjV09N0TohZQFkVHZ987/H4Zy6XwjzKKzLglC+j+36IqEe0teAwh6ya8SFIrL7DovYe2VSH9R5WN8fupkoxlBP+7uhwjTpwutW+iUhcrEQzfa1n6O1COJQ6ErH5Vou2mp0doH6cwEKXLUYei6ayWq6ViqqqoTUYot+2LomBIsqNksVpqU1eE7mG0qmby//Zz5/SRJ0gV7vaTAGN8OKQY6XMc1M581PcsCQfx2WjA7bxnr6byfo1Wxh7s4Mvw0Bidz3dm/uoIRe2eeUTsIsDIAGskKvpCBiF2XtJD8G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X7SZ0QNpo4QDgucSyB4QHI3XPeaSAYeRIBlIbkJmT3zxgrQiO7pI226mU2Oktj+8pJOeId111vTRbyYgRK41+9cBKMyva7E= 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: migrate_pages/mempolicy semantics state that CAP_SYS_NICE is required to move pages shared with another process to a different node. page_mapcount > 1 is being used to determine if a hugetlb page is shared. However, a hugetlb page will have a mapcount of 1 if mapped by multiple processes via a shared PMD. As a result, hugetlb pages shared by multiple processes and mapped with a shared PMD can be moved by a process without CAP_SYS_NICE. To fix, check for a shared PMD if mapcount is 1. If a shared PMD is found consider the page shared. Fixes: e2d8cf405525 ("migrate: add hugepage migration code to migrate_pages()") Cc: stable@vger.kernel.org Signed-off-by: Mike Kravetz Acked-by: David Hildenbrand --- mm/mempolicy.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mm/mempolicy.c b/mm/mempolicy.c index 85a34f1f3ab8..72142fbe7652 100644 --- a/mm/mempolicy.c +++ b/mm/mempolicy.c @@ -600,7 +600,8 @@ static int queue_pages_hugetlb(pte_t *pte, unsigned long hmask, /* With MPOL_MF_MOVE, we migrate only unshared hugepage. */ if (flags & (MPOL_MF_MOVE_ALL) || - (flags & MPOL_MF_MOVE && page_mapcount(page) == 1)) { + (flags & MPOL_MF_MOVE && page_mapcount(page) == 1 && + !hugetlb_pmd_shared(pte))) { if (isolate_hugetlb(page, qp->pagelist) && (flags & MPOL_MF_STRICT)) /*