Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp1325454rwd; Tue, 16 May 2023 15:40:10 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6vCykhHyG7TEUnNZmJ/ZK5NugLENGigBNJz77aJelmEumY6YsLxzQTiuOOkaF/BqxAimAl X-Received: by 2002:a05:6a20:8f15:b0:103:b073:7a57 with SMTP id b21-20020a056a208f1500b00103b0737a57mr27610751pzk.23.1684276810495; Tue, 16 May 2023 15:40:10 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1684276810; cv=pass; d=google.com; s=arc-20160816; b=KKmAjoLI3PE7ohH+gLwa1HFT3CJY/f+B/GcpiSBVZIqFYOFopf3TlkljRtCXagckPa xDwn2ppe4FdMH57VUyeieoKky9cCFl5U9OnDL2wyLNofML3y9jQ8LHAV7qeA5IgGdxW7 Tqjb31GExKiQfFvQ59bes1wnYBqIVp7TwBN0a6P/ZKxSE7nG5pZSNltoa3UROz2TR6M6 f4JFICdeHppWe0MGPxtp6KgO2bxUcBoj4X7w/3ean47H66WU6pSj7QjOTXuoZJgYGdrL 8pehyVnAV8ADf7bfR5376ECo+7NpbkoHGq+oJ++JFrFJBBoBb+SP9oBdI/SSG15yfo6G v04w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:in-reply-to :content-transfer-encoding:content-disposition:references:message-id :subject:cc:to:from:date:dkim-signature:dkim-signature; bh=KszNgigIyXr6IGurj1a87gf10mjUh1WoLnmfpL53SCc=; b=nsa92NmChZPZndogkpMt7igfgPIWbUBKG7NYj/obHct7wHEHE0YY3WNitxMINWucrU KcrduofE+WXBeL9psR68eSKLUh3QsnKfkaumToF2oMZX/uefa/w+loVlhd87vBvSTDrL PfALj/so9jBkAHs6BFIGjSbJ0xCougEoYwMifO5vf0IoOQhIlmH0iTW/5Q2s/R9M71E6 pXf2G9pk+LHRVcP8lXb+lpOZxphPPDlhegJUTWkAk8ByVmo3PDUXCf/X2EYe6aaUSjWx +t0BR0h5+A7R4HNtPi5jaV29RZ1e8mV5D7+SlEhlKnSsVEBp4WSeOg4eXvrsq0eSkOmf g7Gw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2023-03-30 header.b=ju8QUo5C; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b="e/sPXCfc"; arc=pass (i=1 spf=pass spfdomain=oracle.com dkim=pass dkdomain=oracle.com dmarc=pass fromdomain=oracle.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b197-20020a6334ce000000b0052ca3209fc0si20921986pga.651.2023.05.16.15.39.57; Tue, 16 May 2023 15:40:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2023-03-30 header.b=ju8QUo5C; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b="e/sPXCfc"; arc=pass (i=1 spf=pass spfdomain=oracle.com dkim=pass dkdomain=oracle.com dmarc=pass fromdomain=oracle.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229506AbjEPWfR (ORCPT + 99 others); Tue, 16 May 2023 18:35:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56696 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229521AbjEPWfJ (ORCPT ); Tue, 16 May 2023 18:35:09 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BFF9C5FD3 for ; Tue, 16 May 2023 15:35:02 -0700 (PDT) Received: from pps.filterd (m0246632.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 34GJwv5c009521; Tue, 16 May 2023 22:34:48 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=date : from : to : cc : subject : message-id : references : content-type : content-transfer-encoding : in-reply-to : mime-version; s=corp-2023-03-30; bh=KszNgigIyXr6IGurj1a87gf10mjUh1WoLnmfpL53SCc=; b=ju8QUo5CZyPDSD9Pp5ycShUyKTR2uU7AzvJDLUMssEmRMq48m6K0GpWhhqx+6NgRo+21 kO9Jhd4MhcEbwDpaT51VD4PFSlMO2gk+Tg1W2KmDVIdxdD2V9+W5kfpQ0KHcwu2B61mJ 58+pXIjPeNiW1FeiGnCyLoCEyUYxmEEV2DODWUDgJvV0EtAN1/7wJKNSkAyXYpxvG1eX IdJxvTru71atviyuYkwqvGyttXZl18Q3Mvh4OociDx/3wmRmxcAp4MWM5QBPQ5J7bczZ TTSbk/3xn7uf8xjX+GratirKRwRT/Tzyu1yl7MLZhSgEKfuSCaSiXdu/c17xFicWa552 aQ== Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3qj25u49ah-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 16 May 2023 22:34:48 +0000 Received: from pps.filterd (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 34GKe76B032195; Tue, 16 May 2023 22:34:47 GMT Received: from nam11-dm6-obe.outbound.protection.outlook.com (mail-dm6nam11lp2168.outbound.protection.outlook.com [104.47.57.168]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3qj10appkq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 16 May 2023 22:34:47 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XLtcOnio7IQ7hxrySSRxAi6ci20V8UoIsXR7It5oX5Leo6aUH1WVtnDQRwLJe1fJCiuG/j9tQcY1Bi5+KdN4ydQGBoNfQXwcuF4amoXTXFoRV+3fK5ljnMBDw1Q/5YSKIwWMATwZjZ+/EtbPBaSq9H4kTeQGU9BdIqK/TrXNJUab63vOTWFdSLT+8oYR2ZQkYMqqE67948k5airJ67pOCRn3rhfZN8GfpYhRqOYvlYid9xZXfcCwqRMK6wI5RyqEs6yoW8p/dLNvI5j55byswziN8LnEqmZnckjRcwOZwfwy89ImPVbye7A0rMNY7HF3Hj7DL2nGQmVWkYZ0J6Vv7g== 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=KszNgigIyXr6IGurj1a87gf10mjUh1WoLnmfpL53SCc=; b=Bbw9F0Tz23LpkK8ibelj1RA7YLy/8XINXhLBbeyWOBrnHQFl4iOiuWTE4z6A+SRRc7iiT3vbSf/R3dk9l7VeIGyqTdCOdoydUrgVa7+WDkOwjO4bbFKjwwWztzBOqMdhcC6dE0Pvs3Hq+dNH2VQrncvv+2L35bYvIFbo/yPvQ7q77umERQ8PHpgtxCokPg9MbLtAcGbPBywvfSadMhTpfvoKBuhw/8YqSlNql08Z0fyaSLIhmTW3SgJbwx/VuglJ6wrm+YyNeqOgzttYMY5q2iL202Mj/zqX3QkM2qlD/dE7VPF8NcztHmhD7IQwadLyGPSDPpfEB2u8ADKQooF7xA== 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=KszNgigIyXr6IGurj1a87gf10mjUh1WoLnmfpL53SCc=; b=e/sPXCfc4kQwwTs7U3oZOeWTZJEydA9fmMEya6iFeYmPt19ChM54iZITQZew+RRoBD/lJ4lVnS9UIWiPTcayOg5npFQGi7C7kvQMmky6Du54+lcqNF2Cqf++OWTUlMJWojNChVSqzu1z5ZwCHXRIGmP3bmckvrqd43YEegI88eI= Received: from BY5PR10MB4196.namprd10.prod.outlook.com (2603:10b6:a03:20d::23) by BLAPR10MB5347.namprd10.prod.outlook.com (2603:10b6:208:328::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6387.30; Tue, 16 May 2023 22:34:43 +0000 Received: from BY5PR10MB4196.namprd10.prod.outlook.com ([fe80::ffb:de39:b76b:52eb]) by BY5PR10MB4196.namprd10.prod.outlook.com ([fe80::ffb:de39:b76b:52eb%3]) with mapi id 15.20.6387.032; Tue, 16 May 2023 22:34:43 +0000 Date: Tue, 16 May 2023 15:34:40 -0700 From: Mike Kravetz To: Gerd Hoffmann Cc: Junxiao Chang , akpm@linux-foundation.org, kirill.shutemov@linux.intel.com, mhocko@suse.com, jmarchan@redhat.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org, muchun.song@linux.dev, Vivek Kasireddy , Dongwon Kim , James Houghton , dri-devel@lists.freedesktop.org Subject: Re: [PATCH] mm: fix hugetlb page unmap count balance issue Message-ID: <20230516223440.GA30624@monkey> References: <20230512072036.1027784-1-junxiao.chang@intel.com> <20230512232947.GA3927@monkey> <20230515170259.GA3848@monkey> Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20230515170259.GA3848@monkey> X-ClientProxiedBy: MW4PR04CA0170.namprd04.prod.outlook.com (2603:10b6:303:85::25) To BY5PR10MB4196.namprd10.prod.outlook.com (2603:10b6:a03:20d::23) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BY5PR10MB4196:EE_|BLAPR10MB5347:EE_ X-MS-Office365-Filtering-Correlation-Id: 45da6c16-e717-47e0-0726-08db565dbe6b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: HBmH2FmRiIrHbpajHP05fRrC0yZvpqHIR8Y8iil6rnfKAjz5EVY6HmnTXFLlNTXEqrgt+jXYUDODNGPnHTb/ZMeWIKOc8dPIdpEMy8fsYoqErVzzr7lu5SbyxwAAvA+MJrQ1coYPDVrPcXpWGjrFliBhna+2M1SReahqu6H6Y4RtLFINhVmNCVm15HlS2k+rSz31ZwcWqcPJ4C6UTubSCuP5ODfSIF9MiGWl8M5QxdsYD/4DO0KX1fw0BR+fxyLCanXlRSg1WWOAoIUNOwS9L/E75FmZwwtgSR4yHFy6yj6UVRwSAU1NmcIPX3kmivzOQHNLJJq+w3nfOaQ7Wt8uDZEvX5G/v07ZkpH8hCl/QjcjGHnb5S/hAtCwtwTajc9kuWoDceAtZFlL84NDRjUkfn49nSH72hHvgRl3//yd3DtcCvy9FLpdt8pNP7G2fgCPMUn0N3OfJ3FqCa7KlzBetFLR/OP0mhg+HMPIm6jIF81eQ8G6tKwRqo60zcn10GdKi6wMctdCJ5pKNDBHDj5GqVpx8xUeFMXmdNgjJ1ZZRlw= 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:(13230028)(7916004)(366004)(136003)(346002)(39860400002)(396003)(376002)(451199021)(186003)(5660300002)(66556008)(4326008)(66946007)(478600001)(66476007)(6916009)(54906003)(9686003)(53546011)(6506007)(6512007)(83380400001)(38100700002)(8936002)(8676002)(2906002)(6486002)(966005)(33656002)(316002)(33716001)(86362001)(7416002)(41300700001)(44832011)(1076003)(26005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?Rk5ZMk8zbjNvcjBmb0xlZ2d3UnpkSmhFd25CTm5zUEFaZzh0VEhTTzUwOFF2?= =?utf-8?B?cSs2N2FxOTE3OUJhcHVQUWtEYjlHWWxXT245V3pKMEdUMWZyRWliRVY4UTJv?= =?utf-8?B?MFBsbkpSK0VKYjVRTlFDWVA1Ty8xLytlMWgxTk9mWERiMG5aeDVqZStlejB4?= =?utf-8?B?dmYrM2xFSjkzRDJTYnBwWWF0aEJpWXVDUUNZSGJnQ2NYTTcvODFaSzhYZGNa?= =?utf-8?B?MmZaR1FJRjN1Yy9rNFVoOUY0eEszVGZEeXdWZmVRMmhNa1l0TDhkOTA1aDZt?= =?utf-8?B?eGNxa290RHdDOGJNcUZGVTcrVWhRbFc2SGxwZ1hEYUVaYlo3YjF5bGl5ZUk3?= =?utf-8?B?NjE0eXFiRVZ1RVVuME8xMkluZkFWRTRNTFNtUHBRc3lIenVUN2pXWXlTRGVR?= =?utf-8?B?c3F0MmppNzJHS0FCY0tmYnpUTWpaWUlONHRJVTAxN0lhVzRtWSt0c1VESWZS?= =?utf-8?B?Zi9WMHZBamFKMkxBMlBHU09FbDNMeWl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d1l2bkhvanRoRTBETUlHREtQRTFlVjJNK0dvVnF1?= =?utf-8?B?YmNzV0lBUnpGNnJPNnFTYVpoMnIxbUw2ek1LMnI5MVpGaUtzbU52bk12cU5s?= =?utf-8?B?K0xLZ2x5UlhuQkhYemxSWlQrdHBZOHdpRDhjVVVsSFhhSXlhSHM3elRuUjk4?= =?utf-8?B?TkVBcXQrZFlwMUF4ZjR2SGFhVi9keldnWTB6MFBid293cXBSdEh3Nmt0ZTJn?= =?utf-8?B?WVV1ZlBnb2xPY0QzSW9wTWNXYkhxR2Jmbjc5S1MrVTBRVWUrTFV2R1BpVGw5?= =?utf-8?B?RG5pQ3lwQUJxS09WWmU5cm9kZ210S3VaTjN1a3dMbE8yUS9vQUhtSlhMWm5k?= =?utf-8?B?T3BqeDQrWUxhRUlIMEdIRXNqK3R5TFduT3ppbHBGMGpiTXI5UjRoMmxNaGdo?= =?utf-8?B?Q0JxdVhCTUE2NnVxdTFXeUMzV0Jnc0pEanJaU1hwZUxjRmZVazd3OFljOXFh?= =?utf-8?B?L1hhWUpVZWZQZHpjRWE2dXhSTEpRNE5NbExVR2pBPT0=?= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 45da6c16-e717-47e0-0726-08db565dbe6b X-MS-Exchange-CrossTenant-AuthSource: BY5PR10MB4196.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 May 2023 22:34:43.3589 (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: LFXvYl9TtwWQGP0pLfRpvQliTekTAiwIuXtHw/DcbZMGaZg0yO6MuZSUcjypzierpTwtVhIQ9J7KX8raO7fJoQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLAPR10MB5347 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-05-16_12,2023-05-16_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 adultscore=0 malwarescore=0 mlxscore=0 spamscore=0 bulkscore=0 phishscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2304280000 definitions=main-2305160191 X-Proofpoint-ORIG-GUID: 8MxbqlCkclpuAuFZIZLhg-Recc0T8AJ7 X-Proofpoint-GUID: 8MxbqlCkclpuAuFZIZLhg-Recc0T8AJ7 X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 05/15/23 10:04, Mike Kravetz wrote: > On 05/12/23 16:29, Mike Kravetz wrote: > > On 05/12/23 14:26, James Houghton wrote: > > > On Fri, May 12, 2023 at 12:20 AM Junxiao Chang wrote: > > > > > > This alone doesn't fix mapcounting for PTE-mapped HugeTLB pages. You > > > need something like [1]. I can resend it if that's what we should be > > > doing, but this mapcounting scheme doesn't work when the page structs > > > have been freed. > > > > > > It seems like it was a mistake to include support for hugetlb memfds in udmabuf. > > > > IIUC, it was added with commit 16c243e99d33 udmabuf: Add support for mapping > > hugepages (v4). Looks like it was never sent to linux-mm? That is unfortunate > > as hugetlb vmemmap freeing went in at about the same time. And, as you have > > noted udmabuf will not work if hugetlb vmemmap freeing is enabled. > > > > Sigh! > > > > Trying to think of a way forward. > > -- > > Mike Kravetz > > > > > > > > [1]: https://lore.kernel.org/linux-mm/20230306230004.1387007-2-jthoughton@google.com/ > > > > > > - James > > Adding people and list on Cc: involved with commit 16c243e99d33. > > There are several issues with trying to map tail pages of hugetllb pages > not taken into account with udmabuf. James spent quite a bit of time trying > to understand and address all the issues with the HGM code. While using > the scheme proposed by James, may be an approach to the mapcount issue there > are also other issues that need attention. For example, I do not see how > the fault code checks the state of the hugetlb page (such as poison) as none > of that state is carried in tail pages. > > The more I think about it, the more I think udmabuf should treat hugetlb > pages as hugetlb pages. They should be mapped at the appropriate level > in the page table. Of course, this would impose new restrictions on the > API (mmap and ioctl) that may break existing users. I have no idea how > extensively udmabuf is being used with hugetlb mappings. Verified that using udmabug on a hugetlb mapping with vmemmap optimization will BUG as: [14106.812312] BUG: unable to handle page fault for address: ffffea000a7c4030 [14106.813704] #PF: supervisor write access in kernel mode [14106.814791] #PF: error_code(0x0003) - permissions violation [14106.815921] PGD 27fff9067 P4D 27fff9067 PUD 27fff8067 PMD 17ec34067 PTE 8000000285dab021 [14106.818489] Oops: 0003 [#1] PREEMPT SMP PTI [14106.819345] CPU: 2 PID: 2313 Comm: udmabuf Not tainted 6.4.0-rc1-next-20230508+ #44 [14106.820906] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.2-1.fc37 04/01/2014 [14106.822679] RIP: 0010:page_add_file_rmap+0x2e/0x270 I started looking more closely at the driver and I do not fully understand the usage model. I took clues from the selftest and driver. It seems the first step is to create a buffer via the UDMABUF_CREATE ioctl. This will copy 4K pages from the page cache to an array associated with a file. I did note that hugetlb and shm behavior is different here as the driver can not add missing hugetlb pages to the cache as it does with shm. However, what seems more concerning is that there is nothing to prevent the pages from being replaced in the cache before being added to a udmabuf mapping. This means udmabuf mapping and original memfd could be operating on a different set of pages. Is this acceptable, or somehow prevented? In my role, I am more interested in udmabuf handling of hugetlb pages. Trying to use individual 4K pages of hugetlb pages is something that should be avoided here. Would it be acceptable to change code so that only whole hugetlb pages are used by udmabuf? If not, then perhaps the existing hugetlb support can be removed? -- Mike Kravetz