Message ID | 20220914221810.95771-6-mike.kravetz@oracle.com (mailing list archive) |
---|---|
State | New |
Headers | show
Return-Path: <owner-linux-mm@kvack.org> 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 EABA3C6FA82 for <linux-mm@archiver.kernel.org>; Wed, 14 Sep 2022 22:18:45 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 12D5F940009; Wed, 14 Sep 2022 18:18:43 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 0B4D9940007; Wed, 14 Sep 2022 18:18:42 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D8550940009; Wed, 14 Sep 2022 18:18:42 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id C99F3940007 for <linux-mm@kvack.org>; Wed, 14 Sep 2022 18:18:42 -0400 (EDT) Received: from smtpin20.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id A60431401EA for <linux-mm@kvack.org>; Wed, 14 Sep 2022 22:18:42 +0000 (UTC) X-FDA: 79912106484.20.D023E55 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by imf19.hostedemail.com (Postfix) with ESMTP id 27BC81A0084 for <linux-mm@kvack.org>; Wed, 14 Sep 2022 22:18:41 +0000 (UTC) Received: from pps.filterd (m0246627.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 28EMAARp026129; Wed, 14 Sep 2022 22:18: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=c5CV29ucnX6P7BSExad26jDY9ce0i4MfDdk5OL0pR+4=; b=y1yf3FkwprIzarb0yhWit8irhp79vPw/iGZt6ErczAtgkGwAgDa1vrqd3XrSEmjEcBW/ 4yIblnZrWg5Lq84vOGDU14STENVGKL9LjIeLF1/WNVPn5/BRaFcxi2NsMwLQpRwsAeGp I8raYYun2NMuCg7FW0NPbh9HjXAAN6MilCM/MVnJNt5N2XM3ZWH2/SOUS36gtBH+0LKu ItjlYD6CGEVLNQu3LKtS22noxXpzThpgnStXCEZbxywqLBDA40BkCQHAAN3drxgtOwCB 6OvRRaYVruovpemTn26o6hQtEn6MhwRJXkO6rYGiUeWQLl/mb4P/UzAtB0bBsivIDbkp KQ== Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3jjxypbqr6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 14 Sep 2022 22:18:33 +0000 Received: from pps.filterd (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 28EM1D1C035494; Wed, 14 Sep 2022 22:18:32 GMT Received: from nam11-bn8-obe.outbound.protection.outlook.com (mail-bn8nam11lp2169.outbound.protection.outlook.com [104.47.58.169]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3jjyehtdu5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 14 Sep 2022 22:18:32 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PWLjzSJ8uiB6pDYXfUXVDz0jnU6pTCV7K1boAA0r3jgVaeI9cyc4mN4HxHDyORQtbVWPWfRr+iJkGBEXfNoHTO87ZVwB864UKYpCLa27HeBqxuih5/Rll2LDnADEiBr52ltl2shceyKAKDFjoSbPitChxq0E5Apbq7AMHW/d4dzN3RortlAWOHvUyRNbEvd+53q+bquxmDnfdORMaO4K2IlJwT1AflczgkFfY+z44j8b2SpNTnNDG8Zgeh+/IZYmJ04QAzok1lyDI4/eqEg97K3g2WshdDgox1af5iK5Q4xPlC/aNSqm4NItJsrurAsvS+dAkcYTZ2SqF+/meAGkqg== 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=c5CV29ucnX6P7BSExad26jDY9ce0i4MfDdk5OL0pR+4=; b=Mbn2pD9dj2yCro6F40fT/OyN/1IRkITaPnhMe+9jkQ9pStxnyeETPSTWlQ/sShTURG3tbP6ep8hPWfHgoW4JWHlBeSpUiNUe3v3+bDfvD2ofmDsjZ85CrFh0qKhkWPSufXS3YdbxLX7zBGyLD6rX/P2aYeiRkE48rPhXVX0kRjuyJtJJCG7Zk5WeXt2mPMZqHmnTOB+oU5rB1QeaAwnKgVKUfH0KVsMDGdMf6bYvEpBVDpJiFhMKiD1Wu81KTotXHwsH1HtAPQK6fSYQgMabadKma6wnauUDAT4aTHGScM69P4/D9mvhlfAHbYURw+UpcQPA91Qu6/KutLo8QZoIkw== 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=c5CV29ucnX6P7BSExad26jDY9ce0i4MfDdk5OL0pR+4=; b=Vv2V0Ecj4I6Qej1KdNudLjrEYJLEzuA668EHVocTAqkErBwIqo2Byp1rTdZ8up0zfIBoSH0/14xBdwMPaK5FVWS9/s+xXr7nj2aQm1txI7x/2GsiAWg+n/SVrJSPN5xPWPj9REMdcY+wrJ4nEm+xs4CqcU1l2Py5Xw4lKvJIlXM= Received: from BY5PR10MB4196.namprd10.prod.outlook.com (2603:10b6:a03:20d::23) by SA2PR10MB4745.namprd10.prod.outlook.com (2603:10b6:806:11b::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5612.23; Wed, 14 Sep 2022 22:18:30 +0000 Received: from BY5PR10MB4196.namprd10.prod.outlook.com ([fe80::e9d2:a804:e53a:779a]) by BY5PR10MB4196.namprd10.prod.outlook.com ([fe80::e9d2:a804:e53a:779a%6]) with mapi id 15.20.5612.022; Wed, 14 Sep 2022 22:18:30 +0000 From: Mike Kravetz <mike.kravetz@oracle.com> To: linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: Muchun Song <songmuchun@bytedance.com>, Miaohe Lin <linmiaohe@huawei.com>, David Hildenbrand <david@redhat.com>, Sven Schnelle <svens@linux.ibm.com>, Michal Hocko <mhocko@suse.com>, Peter Xu <peterx@redhat.com>, Naoya Horiguchi <naoya.horiguchi@linux.dev>, "Aneesh Kumar K . V" <aneesh.kumar@linux.vnet.ibm.com>, Andrea Arcangeli <aarcange@redhat.com>, "Kirill A . Shutemov" <kirill.shutemov@linux.intel.com>, Davidlohr Bueso <dave@stgolabs.net>, Prakash Sangappa <prakash.sangappa@oracle.com>, James Houghton <jthoughton@google.com>, Mina Almasry <almasrymina@google.com>, Pasha Tatashin <pasha.tatashin@soleen.com>, Axel Rasmussen <axelrasmussen@google.com>, Ray Fucillo <Ray.Fucillo@intersystems.com>, Andrew Morton <akpm@linux-foundation.org>, Mike Kravetz <mike.kravetz@oracle.com> Subject: [PATCH v2 5/9] hugetlb: rename vma_shareable() and refactor code Date: Wed, 14 Sep 2022 15:18:06 -0700 Message-Id: <20220914221810.95771-6-mike.kravetz@oracle.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220914221810.95771-1-mike.kravetz@oracle.com> References: <20220914221810.95771-1-mike.kravetz@oracle.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: MW4PR03CA0153.namprd03.prod.outlook.com (2603:10b6:303:8d::8) To BY5PR10MB4196.namprd10.prod.outlook.com (2603:10b6:a03:20d::23) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BY5PR10MB4196:EE_|SA2PR10MB4745:EE_ X-MS-Office365-Filtering-Correlation-Id: 2fa0f240-db29-43b2-05a6-08da969f0de6 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 7AvGPbLdzoFj1uc71qBP6dbl3v7Xm7E/DJ4ArChkH7V0w7TZaTRWX6BAgHsG/d1AT4ynDjw8F+f4oAgfAyUz77XZt//8LolIAyajtwjj6L5D5fO7htRoBQlGF0j9+yxUpbHfnrp8Fl2Sm6gMa951koqPZedKdNRna7+BBl4ui/1mv5ER89P1Ij+y1/LqtAB3b1HT8zPdLHLDgXsRYt9Learp6H7ila3ps6Qkukxi6mT89lj8fb3xAttE8ycX1t/1geNtznXS6C4Sh1UT2v1DfTwj91do3wWGW8qN8/vL37QKa7xWPBksK3DHhMTsLVHgMMpB+1W55XHEeMqo0gZSFXU8uqzCVvraLmAfYgnLY68TBGUcVo+0OP1TVKjuy1WrGeECc7iZ9CedNpgbgtoF78MeFWGaKtZLd1TwJ9otj3pJFtUyjJJqIUBszdIyrcOWyIHLk/ZcjZPiSOTAuIFWDbDAMjhuo6NUp+78yBOT5m7HVB2ksbdk0wHY9OvQk2pI9NQYM5XgwDv5oo03XYs2wRiQ8hMD24mBLZrn/C2IQ1U01KJEOQoWK3a+8p1looTjPXGyht+Dj2ofoDGwt1R2HnwJyImc9lOBr6+DrPvJ+0ODpJqQHRUOUEnFNg5yFXY2t5HsHGBU+4hfnYbdTfi8F87RfvNVh2dsVn2S53yBCbJGnYim1vXVc5jeQg64nxENX3Et1oEVWM5LXJJbtmfCRA== 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:(13230022)(376002)(346002)(39860400002)(136003)(366004)(396003)(451199015)(478600001)(38100700002)(54906003)(316002)(36756003)(6506007)(8676002)(4326008)(66946007)(83380400001)(186003)(2616005)(1076003)(5660300002)(41300700001)(107886003)(66476007)(66556008)(86362001)(8936002)(6666004)(6486002)(7416002)(2906002)(26005)(6512007)(44832011);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: ABmSBjnD+dy0WguvxoTWhK5crCfRpyyyiOVa6aXEU0Oj4AEE3UYBvgBEB0uq6NNXSl71/WHrg62H2CABw5cbw9Kf/cyScFOUy9Q+ym+Qrj3G9Bze/aVj1d7P0gr4AlgbJRRbekjSZUFFUGiOZO8wWZ3BXgb8eP8155kLPF/NmEd0MQaUYOH4Jv1pq07UB0T5dl93ojpIYtc663NaKLyzIsZYL51mNPoLpQNmTo19x1Le6wqmcqxyhtRGeSmdXiM5XGhL0gHbgHOGdxDy31d3Lr7PpT1V4Avf/Pq7S2hGrvPnx3ao39o7QrIpXczlKCkTZ3U6+O+VAvhXTl1DT2qR7PsRwf1IQ0Pi1nMhPC+3cEq0A010uZ6Rtm+ofShsplSn6peLCZvpMLinOPoF16RlVZKtwfYGTR/XlddQ7hGxwlURs37ZuQuVfTL/Zq8kQmfmnXNOSpLsR3QrYxihZQ/vBhnlDuMxBfyHeGscSzXKG9RW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zSjsB78ukB1rdozpNtwBpYxffpuDqkwhGcZeuMym3kGAWV1vA== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2fa0f240-db29-43b2-05a6-08da969f0de6 X-MS-Exchange-CrossTenant-AuthSource: BY5PR10MB4196.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Sep 2022 22:18:30.4272 (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: mPk2CMG5DbWfOS5iILOJobbNQZ/ch/MWrRxmfleo2S6V3PohxLgn4ELZiabsQ5LFwJwGeORbwhyJ04TMCTEa8g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA2PR10MB4745 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.528,FMLib:17.11.122.1 definitions=2022-09-14_09,2022-09-14_04,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 mlxlogscore=999 bulkscore=0 phishscore=0 spamscore=0 suspectscore=0 adultscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2208220000 definitions=main-2209140108 X-Proofpoint-ORIG-GUID: P8wqMPzQxSCpFJXxg0I-dCr1o4h08_Tf X-Proofpoint-GUID: P8wqMPzQxSCpFJXxg0I-dCr1o4h08_Tf ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1663193922; a=rsa-sha256; cv=pass; b=4kZuGqgcClMNcFVnNMzxX9u0jloi6UZWC8i4L4cKhvamsgC8VXjYkNxxo8rMG3Y/fxeu4V AB6JtE+YSznmrUdEj1EWpHYpy+r3l2GFQ4D9wIl6koyX/ZjNZmHK0iJr+Vjet5lkSrwnH0 U1T/u04S126paRvUtaL2xGpZuOtbL/Q= ARC-Authentication-Results: i=2; imf19.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2022-7-12 header.b=y1yf3Fkw; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=Vv2V0Ecj; spf=pass (imf19.hostedemail.com: domain of mike.kravetz@oracle.com designates 205.220.165.32 as permitted sender) smtp.mailfrom=mike.kravetz@oracle.com; dmarc=pass (policy=none) header.from=oracle.com; arc=pass ("microsoft.com:s=arcselector9901:i=1") ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1663193922; 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=c5CV29ucnX6P7BSExad26jDY9ce0i4MfDdk5OL0pR+4=; b=UGCKfJyMKK/jWJPcxg61T5txRhoiIP5fBIXiUiClF4vB/1F6nhVe7HmCq2ISY4G6lp2+dV 7OZ+s2GhrwtK8SQGX8AtbqD0Pan5pYzaan/1SZbjk0L17LfeiGHxZ3s1hws9QTqMGjeF2t DbvzIMShTD1vlFe3RCTu+3WHiqmKwJs= Authentication-Results: imf19.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2022-7-12 header.b=y1yf3Fkw; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=Vv2V0Ecj; spf=pass (imf19.hostedemail.com: domain of mike.kravetz@oracle.com designates 205.220.165.32 as permitted sender) smtp.mailfrom=mike.kravetz@oracle.com; dmarc=pass (policy=none) header.from=oracle.com; arc=pass ("microsoft.com:s=arcselector9901:i=1") X-Rspam-User: X-Rspamd-Server: rspam04 X-Stat-Signature: rs1u6ff7spce46a1gz1uh6kau4hdgpcq X-Rspamd-Queue-Id: 27BC81A0084 X-HE-Tag: 1663193921-747033 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: <linux-mm.kvack.org> |
Series |
hugetlb: Use new vma lock for huge pmd sharing synchronization
|
expand
|
diff --git a/mm/hugetlb.c b/mm/hugetlb.c index eb38ae3e7a83..8117bc299c46 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -6639,26 +6639,33 @@ static unsigned long page_table_shareable(struct vm_area_struct *svma, return saddr; } -static bool vma_shareable(struct vm_area_struct *vma, unsigned long addr) +static bool __vma_aligned_range_pmd_shareable(struct vm_area_struct *vma, + unsigned long start, unsigned long end) { - unsigned long base = addr & PUD_MASK; - unsigned long end = base + PUD_SIZE; - /* * check on proper vm_flags and page table alignment */ - if (vma->vm_flags & VM_MAYSHARE && range_in_vma(vma, base, end)) + if (vma->vm_flags & VM_MAYSHARE && range_in_vma(vma, start, end)) return true; return false; } +static bool vma_addr_pmd_shareable(struct vm_area_struct *vma, + unsigned long addr) +{ + unsigned long start = addr & PUD_MASK; + unsigned long end = start + PUD_SIZE; + + return __vma_aligned_range_pmd_shareable(vma, start, end); +} + bool want_pmd_share(struct vm_area_struct *vma, unsigned long addr) { #ifdef CONFIG_USERFAULTFD if (uffd_disable_huge_pmd_share(vma)) return false; #endif - return vma_shareable(vma, addr); + return vma_addr_pmd_shareable(vma, addr); } /*