Message ID | 20220706202347.95150-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 82E4AC433EF for <linux-mm@archiver.kernel.org>; Wed, 6 Jul 2022 20:24:16 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 1A75C8E0005; Wed, 6 Jul 2022 16:24:16 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 12F4C8E0001; Wed, 6 Jul 2022 16:24:16 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E9DCA8E0005; Wed, 6 Jul 2022 16:24:15 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id D80918E0001 for <linux-mm@kvack.org>; Wed, 6 Jul 2022 16:24:15 -0400 (EDT) Received: from smtpin16.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay13.hostedemail.com (Postfix) with ESMTP id B111E60508 for <linux-mm@kvack.org>; Wed, 6 Jul 2022 20:24:15 +0000 (UTC) X-FDA: 79657802070.16.E2250B1 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by imf09.hostedemail.com (Postfix) with ESMTP id 3DD58140039 for <linux-mm@kvack.org>; Wed, 6 Jul 2022 20:24:15 +0000 (UTC) Received: from pps.filterd (m0246631.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 266IXbpn009655; Wed, 6 Jul 2022 20:24:10 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-2021-07-09; bh=XjmblYtiNvjlDsjHALrZ+jjlDpAI9GhABzU9BOLgMpQ=; b=HtHlW7cyfgeCEQfzF1ZPA8KOh9mYKK7zrVsJtCLmzmwYgioLJ0Gq8ZEbulHpcKeI3LGI 5fKUukFHJfDPy1iFnCMfpwvprJoM0YfHV/ZotBhrln0D/bIznrVtdPOQHgYUvnOlzZDH pEHX+4g+kwL+WObvmqbH6jvf7EdfEu4l+RNsDxn4KYg+CzicF/FYF8YlwdPcEB9IBmbP +sj8SLP7/HOGZr81evJIRYlTmp4mhxuWC9H5R+nsXZWiL0vkWzPhUPaIJC1Hkb5YwG1e CZdyzMLHCBR71a0xNEYQr+UpABv0RZhDaKobwEwYpEb6GsUp/08RbqWQJ/SIEc8JQI6m WA== Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta02.appoci.oracle.com [147.154.114.232]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3h4ubyb9x6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 06 Jul 2022 20:24:09 +0000 Received: from pps.filterd (phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (8.16.1.2/8.16.1.2) with SMTP id 266KLKn1035231; Wed, 6 Jul 2022 20:24:08 GMT Received: from nam11-bn8-obe.outbound.protection.outlook.com (mail-bn8nam11lp2169.outbound.protection.outlook.com [104.47.58.169]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com with ESMTP id 3h4ud6cu5w-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 06 Jul 2022 20:24:08 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SwZk/nk9trQj6q/uBTqaSfx31SVuUuxIq6Kd71AQv578+tJtFaiyb9AqpfmYPh00uFaBB0Fvnu8jhB3mtSSGs4S6HUHTgONokjfiH5+ks6jEnaV97G/zV37p1hZwJBslZPghO6pciC/XUvAI8lEJNUAEu3M3gtNjYal2J5aWBJ3dn9FKHilplk4fthSgOnJjhHdNsCxsKwogzOyknTKtNIcWForR/8wf0p4yMzfBz0T0bMtj/gpveWXI39kCQ/3W4JehPzQdkNE6+FahE0u8TRdFRYJjNSj5v0PbzDdCQ+UHI2ktoGG4yPoOkPStC0hOlGeB4DC9qaN2BZJeq+4osA== 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=XjmblYtiNvjlDsjHALrZ+jjlDpAI9GhABzU9BOLgMpQ=; b=MfHMnxSfUfLNdK3927xFeL4qFbwG4qaxOPxyj6c2IQfm9ehsgkayG+4aGW08sfRwJBxUD2K3RSDS3s2rW3XaW9Vx1743f3czq7ELomW+6niLDyFT5UBhNSBmLJzPDvoCpyUzqJMFw/VjrGhWHN6vAl13kfluI19sDFypsiDmv0n+OeYyAYPFJ0A4EOs2AIojDfQ+jN14Ie5W30ohPH7ymoPrlA3wt6CuwFf4CJp984jK7wqihCLWNCi4jZpfXUWOl34vYu59H0g1+p2n1utIz89b8Y51D0j2/18kyc01FoxbKgPiGR5bZs4U9ruy2darsz2quomaBrnEz+GKFBhGfA== 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=XjmblYtiNvjlDsjHALrZ+jjlDpAI9GhABzU9BOLgMpQ=; b=TCTua6lfBECNfZLwAxRpLCbnf7QSoVtKDycEXyFL0RB4EcZcBqdaY4LPTkCP/oOkihad+xJDD0ow2h7OAiwbm5AzJWWa8eFTuZd6Avq35DAzJzfWnciCjhY6koPZAoldwHRPMY7a1dtdUA9fxFqroSPuXlbGLTdyabESvumnxwU= Received: from BY5PR10MB4196.namprd10.prod.outlook.com (2603:10b6:a03:20d::23) by MN2PR10MB4032.namprd10.prod.outlook.com (2603:10b6:208:181::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5417.15; Wed, 6 Jul 2022 20:24:05 +0000 Received: from BY5PR10MB4196.namprd10.prod.outlook.com ([fe80::c1ba:c197:f81f:ec0]) by BY5PR10MB4196.namprd10.prod.outlook.com ([fe80::c1ba:c197:f81f:ec0%6]) with mapi id 15.20.5417.016; Wed, 6 Jul 2022 20:24:05 +0000 From: Mike Kravetz <mike.kravetz@oracle.com> To: linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: Muchun Song <songmuchun@bytedance.com>, Michal Hocko <mhocko@suse.com>, Peter Xu <peterx@redhat.com>, Naoya Horiguchi <naoya.horiguchi@linux.dev>, David Hildenbrand <david@redhat.com>, "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: [RFC PATCH v4 5/8] hugetlb: rename vma_shareable() and refactor code Date: Wed, 6 Jul 2022 13:23:44 -0700 Message-Id: <20220706202347.95150-6-mike.kravetz@oracle.com> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20220706202347.95150-1-mike.kravetz@oracle.com> References: <20220706202347.95150-1-mike.kravetz@oracle.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: MW3PR05CA0006.namprd05.prod.outlook.com (2603:10b6:303:2b::11) To BY5PR10MB4196.namprd10.prod.outlook.com (2603:10b6:a03:20d::23) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: e4515aef-f2fe-42c9-e86a-08da5f8d7911 X-MS-TrafficTypeDiagnostic: MN2PR10MB4032:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: DbOLOSC6OH6Wk+9LGTJVyaCPe+uL2Zgj76/wULF84SGPhRKkse9T/lE8ZN0AohRPaNLvrlo5cED9TBzKzlLKcdgobXdLKl2w4xnQWau5eUgz2QfEptOa/VM+t33QiefTqy7JrXXu3hQA6Wol9GGUyaH5ld1cwK9jkC4DPbbtIVST+HeA2Nbx9EUVAlptlTD0nbPrw9mP+EhnfUvzEF7+vK0UM3SHzl0KdynNSyR9Zi7DGMCz8VLQvAaBVAyosn8wGlgGkDyvt8gcSSqGfSCMJVQ3xZz+EewRy73QZBLjX0UpeffojNJqQpbPW/3HeIDBNkmZFwNyh0lOiwNKzIsAN5aUddPZFV2y8JmkwTgdZ6PUVk6AJpkVF9f7sQQw3vwvr0IXefGU2TLk0vewy+ybst3+ZzAY+aYzQbTZ2R0Y6TUBfHLDL4fP9/YU8NHITHJtCRH25sdKd6PdtBLyzJTy/btrYaQjY/GZjUM9vQrUNrM5VxYyRjow0gsNXXHJppj+PywJQP+FzCkO1sWrUPynSRhqW0bVHu+421eoqsumyYR9kSl4wVDBMnhX9bLNWpniDY2/z2O4VZoMt3nVXJaDj2H14+uXcBRpm1TOdwQkjnOCAlFv1aGUfsOSfsAaeoqKSeXGwMQ/oj/5mAP3tNqSyTKG0F9CNhiyBWPT+SoSLYFYrmoQ0IaamfUhpxlDY6wS5rOZiDZtV6+ybZ6FiG5w6+RdIEKqBBDGhqk3fFmYe2qeBULMy+64645N8R1WVBNI 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:(13230016)(39860400002)(366004)(136003)(396003)(346002)(376002)(44832011)(8936002)(54906003)(5660300002)(7416002)(316002)(478600001)(6486002)(36756003)(66556008)(66476007)(8676002)(6506007)(41300700001)(6512007)(6666004)(4326008)(66946007)(2906002)(26005)(2616005)(107886003)(186003)(1076003)(83380400001)(86362001)(38100700002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: J0hL9i8FM5dw1vm4+38q7B0G7r3WHnSWJIMaE2B9rWXmztBcRcEMn/R3vEOSafQ5EtR9qUPsd+AJ9MQURAiTLAZjsRouiHMB+bHprKVD7DD4D7Te789mPanB16/SyC+cgs8zyYBwn8vyAXp1AaZrvmRxeuZ5evIVZmCL4n0t45Vz26MjR1FGYA/ZxS4SAgi12wUtcp0mgzKR0GTvsqN25+Geyzhep40E3S5MJ2rGlN+/0jrbLHwTtf8fD8VIEnJ95yem9Hhx0p4VZL5QPr15wnrcTRAdlaDokilgLSA+IJkTOwgUOSkyRnaYymNHi3A9k6U6+kvAcEJ+YlcZzHXUcmu+oxfuIvBFP92O6Vmav8KDL2fPKxegk+IJsqZFvBEQfuXnoD1zqgr+VDbe9qLX6qv1mLmmatfrc8X/Hg1Ov3N2pNcg1FUgsJ1t0j2vsUmjBr7R0MXLGb7uou/cazZVz0h+nB3hMAETh+NvNjL/+FanNEkP7+yThQ55hHY2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VXgJLJwTTWKgGxc2HBEzg== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: e4515aef-f2fe-42c9-e86a-08da5f8d7911 X-MS-Exchange-CrossTenant-AuthSource: BY5PR10MB4196.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Jul 2022 20:24:05.4309 (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: Jl/W//LXPsegmOVd0AEewaXrNY8pMPyx04/P7XglEentO0Lb4ucCpef/52vpgKM+mDU4KefHMTKud6zz3QgTrQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR10MB4032 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.517,18.0.883 definitions=2022-07-06_12:2022-06-28,2022-07-06 signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 suspectscore=0 phishscore=0 adultscore=0 malwarescore=0 mlxscore=0 spamscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2206140000 definitions=main-2207060078 X-Proofpoint-ORIG-GUID: SPUdiZNZXjU_T3bplexlJVegEH02KK8H X-Proofpoint-GUID: SPUdiZNZXjU_T3bplexlJVegEH02KK8H ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1657139055; 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=XjmblYtiNvjlDsjHALrZ+jjlDpAI9GhABzU9BOLgMpQ=; b=5IE3jYeZ/Mt9TcBnYb7+U4PFMZ+3t0kd2tBETMM/hOOUC8OVkiIxDpBgmfvlKBnG0S6Je1 FzMTfgobApxdrOT0GuHv7WBI+PjGP4d7iASDg4Xj3M5M16klDsQoSTjOZPh179W6drGSOj gtfzSDll9SEl9NRFcZH2K2tSfww+Bww= ARC-Authentication-Results: i=2; imf09.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2021-07-09 header.b=HtHlW7cy; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=TCTua6lf; dmarc=pass (policy=none) header.from=oracle.com; spf=none (imf09.hostedemail.com: domain of mike.kravetz@oracle.com has no SPF policy when checking 205.220.177.32) smtp.mailfrom=mike.kravetz@oracle.com; arc=pass ("microsoft.com:s=arcselector9901:i=1") ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1657139055; a=rsa-sha256; cv=pass; b=yQElX5NR1xYAhBH3WesddymhcCtW0CuSX4wmg4iBOycadQlnYYYo7LiwLdWpXb6cLMGr1U HFqogU03/tIP+W9zYgAV7Wk4tXBhJaFUgVXjrXOzFq2g11WVD2nFgyDy6nTtdo8mElLuWv CRL3tc38zGuaLgjLNiS1UO+YTL10Zaw= X-Rspam-User: X-Rspamd-Server: rspam07 Authentication-Results: imf09.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2021-07-09 header.b=HtHlW7cy; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=TCTua6lf; dmarc=pass (policy=none) header.from=oracle.com; spf=none (imf09.hostedemail.com: domain of mike.kravetz@oracle.com has no SPF policy when checking 205.220.177.32) smtp.mailfrom=mike.kravetz@oracle.com; arc=pass ("microsoft.com:s=arcselector9901:i=1") X-Stat-Signature: yf14ctmop3fxdb5wq7p8dke5bwbuby44 X-Rspamd-Queue-Id: 3DD58140039 X-HE-Tag: 1657139055-661685 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: Change huge pmd sharing synchronization again
|
expand
|
diff --git a/mm/hugetlb.c b/mm/hugetlb.c index 25f644a3a981..3d5f3c103927 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); } /*
Rename the routine vma_shareable to vma_addr_pmd_shareable as it is checking a specific address within the vma. Refactor code to check if an aligned range is shareable as this will be needed in a subsequent patch. Signed-off-by: Mike Kravetz <mike.kravetz@oracle.com> --- mm/hugetlb.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-)