Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp222305iob; Wed, 18 May 2022 00:17:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz5eV+sBeZJpxPQZGxglVkIHUs9/jLslHmHwS4f+hJ6zzrgsvsuAvRYWBIRN1pEYBdPw+J0 X-Received: by 2002:a05:6a00:1808:b0:50e:eee:d78 with SMTP id y8-20020a056a00180800b0050e0eee0d78mr26315450pfa.81.1652858228782; Wed, 18 May 2022 00:17:08 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1652858228; cv=pass; d=google.com; s=arc-20160816; b=rztWb8DFClDDd1OcPPbYd2jPRzdmeDsyqxE7PJQhApRpGI/CItfmOMFhE5ZgxlznIY O0b+yKbJP3zCOtHhsVAAIGD3jOS7BTN7h1IuHPgGo8u2qsAwGYtWmu0I+rzDGwlqj8IO pjxW1VL6v/zSZdW+Z9WGq+cMIjaoOWaG4IJKSO8UqYx64WABuhO1usAMzIUTFqyf0txa f/fFf2kZ3yVU/q5i9wUNgIWbU58ZQ/O6NqYb5tCmCtqevB//c0qQkXK8QWsCTDiN56fc F5B2JFq2zlsj+tC+hqwW1OJxqr1b+D8oZvKi9NZAGZLnVXr75m3JBZMFSuDmNO3bUx02 P4Yg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :in-reply-to:from:references:cc:to:content-language:subject :user-agent:date:message-id:dkim-signature; bh=UH2NUAVPfYlVMtjZc9geO7akhy0eK6oKZFDW6Jh/cpc=; b=WLWUSyu2bkQZuPKx30DxPT2PqikP/YB8nvQYwWZUIQ6FiFS/PBhhln+EDW4h+2LBDx kWN67ly27gQA8dQcBvdGoaVt8dWmdqBOQuRdsgrp8rUMOSlHmRLOstab/INMrWHQte// 4mbNfqotH8pIOwrxHliSAJjOR6CJOfDLYane/tV2zsR+q6tjDAwbHlg4nebbMFFPkFPQ yUielX66agMlxw66RnCQLZMy2mOcFkUqleucsnd49mVIS3y1t2/HeEkVDaVSEbIT/Mfk Bsjn2MBJlUms3/bad3kjds3QgDQ6wBhauvCespOtCgOCw/XO75SvWtjqktKpU3IabeAF O9cw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b=rsZ2ZKmk; arc=pass (i=1 spf=pass spfdomain=nvidia.com dkim=pass dkdomain=nvidia.com dmarc=pass fromdomain=nvidia.com); spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=nvidia.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id s189-20020a635ec6000000b003f24384bf84si1517492pgb.485.2022.05.18.00.17.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 May 2022 00:17:08 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b=rsZ2ZKmk; arc=pass (i=1 spf=pass spfdomain=nvidia.com dkim=pass dkdomain=nvidia.com dmarc=pass fromdomain=nvidia.com); spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=nvidia.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 181332F3B2; Wed, 18 May 2022 00:12:36 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231979AbiERHM1 (ORCPT + 99 others); Wed, 18 May 2022 03:12:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39546 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231898AbiERHMY (ORCPT ); Wed, 18 May 2022 03:12:24 -0400 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2066.outbound.protection.outlook.com [40.107.92.66]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E0E282873A for ; Wed, 18 May 2022 00:12:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kOahddyKa7IWXMv/ZQ+JZK936s8XGnBwDpi2+ZUw2swWUB/buxSh+SAoOpMlD+4mhZH+YxIKW5wJF79unESq3TmX+zVHGkLb9u6Gfkpyz246vOTbz7spxkW3La5zbjgFFYOQ/LnFAekJFmJBIOEBHI06BpFaU+Fz2WGEBjKJJ4icBmFUM6pxEHJ0v807F9JIq1qO4wBmBnkhyTmfnDH80p6uQGELNnB1MpwT+hrekKgjmCQwCqhvx9gG5BwtDBEjGpLigYvlkFbNSAliHZK0QHSVNbwQPvxwfk4DKZEdo8D3YxOcI0CTqvqhVutC3w8LUb6q2ppPWJ3m24AJJKF6mA== 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=UH2NUAVPfYlVMtjZc9geO7akhy0eK6oKZFDW6Jh/cpc=; b=mnLBExiTPSXrSJwhrpmdZ3NhrHfUIN0fDTbGmyMRrqjP9M3g1Kc2wmtXaB1FtvpW31Zvt6ec2HnLDx57rFpn/hwZ9Kt8JxOhLq/IHUkuevGtMxpH1/X9Eb8bveILhtQK+L8k9mGwHGv+3ylW1jR22IRk7DaCc/87jHoXr0PpsmQLb8lXxzUnrP9Xm/xYvFD00AToBMxevfsEynrBi+br7OfmLeqA16CNnixCTtKzV0fJ4aAFKsozKnisiZLAX7AybicA/0MWl33Xr6aKeHuFv18Z3MEPOF0DV55rLoz+J1zV0L6zygoLFUXDShsK8kYicEpwMGsfz/CFFR3tG7VC9A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=UH2NUAVPfYlVMtjZc9geO7akhy0eK6oKZFDW6Jh/cpc=; b=rsZ2ZKmkWX43saBe/pVLXgD7VqeUC8c7MW7/lSOqr77xISxRbt2/o2vUha7bj0KqBdHUWs5oUafQCPbT/vOg8YrPoinSOPB6L4w49Q8dxLGczHDQSc5zWeATCySGwviyk+V5Qqh7Nm1Vv0h3m9hMB189b1LNrDdvBxBT4G2GJ/S9gGJq3Anjtf/4SqOj06M0dkThEMWE44LcdOY/Sm1JtqiIGAoVbidE3tYH6LSOtprPVPeuAbflWUWOwHS//4rX7ewjzlB4RNEqwpmQduBW93p817CqCs6A0+/snl5QFPc5Sn2E/dExbi8uhJkLeHQrT+lECEzobvTfV2wyYfcB6A== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from BY5PR12MB4130.namprd12.prod.outlook.com (2603:10b6:a03:20b::16) by BN6PR12MB1908.namprd12.prod.outlook.com (2603:10b6:404:fa::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5250.15; Wed, 18 May 2022 07:12:20 +0000 Received: from BY5PR12MB4130.namprd12.prod.outlook.com ([fe80::15e3:d746:57e8:4de0]) by BY5PR12MB4130.namprd12.prod.outlook.com ([fe80::15e3:d746:57e8:4de0%7]) with mapi id 15.20.5273.014; Wed, 18 May 2022 07:12:20 +0000 Message-ID: Date: Wed, 18 May 2022 00:12:18 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.0 Subject: Re: [syzbot] WARNING in follow_hugetlb_page Content-Language: en-US To: Mike Kravetz , Minchan Kim Cc: Andrew Morton , syzbot , linux-kernel@vger.kernel.org, linux-mm@kvack.org, llvm@lists.linux.dev, nathan@kernel.org, ndesaulniers@google.com, syzkaller-bugs@googlegroups.com, trix@redhat.com, Matthew Wilcox , Stephen Rothwell , David Hildenbrand References: <000000000000ef451a05dee0f2b1@google.com> <00000000000077377c05dee75f63@google.com> <20220513102617.c464c4f566052838e911a3ec@linux-foundation.org> <75f09063-d184-7d44-17a1-ed04be5eb953@oracle.com> <20220513161910.d1b73583cdb2e33562aa86e5@linux-foundation.org> <4809b134-a37a-50b8-4c25-44548bc1048f@nvidia.com> <6d281052-485c-5e17-4f1c-ef5689831450@oracle.com> From: John Hubbard In-Reply-To: <6d281052-485c-5e17-4f1c-ef5689831450@oracle.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-ClientProxiedBy: SJ0PR03CA0293.namprd03.prod.outlook.com (2603:10b6:a03:39e::28) To BY5PR12MB4130.namprd12.prod.outlook.com (2603:10b6:a03:20b::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 14277034-419c-4f0c-18fe-08da389dbfc4 X-MS-TrafficTypeDiagnostic: BN6PR12MB1908:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: J/wnYI9/AaC6i3yC56UncABb4CZanarBCYD8BklGPZFACDokju5Y2LpDisMipSxONPIVOvpMB1FYF8agDwMuXUsmBWMbrYYyWfIFdOkhdxZBRhuYjsX5hp2GjF0gnCD+xFeJ0IZbxYwfwpQBAixOfXDy0EZ6buMjz46aSaH+bpDXH4OeU4tuyAYygrEnCcRkwoAm5r1/jI/WxhrbSRS6bCJ3TaJuzQGXXHdLp/onuoQQJdBb0rEQqbPclrRNsQLAWOOUM1vz/vtEtyTe+50Er1wdg7qIILajmpp+hlniU7DzK2+vycCQDxI0/6pjXY2w/jeRbc3qfJ2hsx5FcBxF8Iu1LgmMA1og3Ab8hoseHq/hXN4aDxSZW1f6NeYBHnBp+oetuKxmBvHtPuaDUTacnTCWnKieHogvaApk2fg242EW4FPlYeIWomKZtm71x7zFJ9D3t4XWU4M7eKyNj9ckWHzZ8r5PFbO35ZvhGKQtgupw0hzVJ/Dso6NgQLXxQTmtYFsRnHlq/IV+D3RRqMFBPgYCGVh7UdWERMPzA2zQPvGvBByKFsm8dRiOs0lpaCwKHslwNFiMNQ/JqNSMMEooH3yEOhWNt22Bdv5mh5bzB9yc21jdVEp7fRwqUchkn0UxQf1XNWrf1fP1YsVkzlpbjsIkTREIEQYH99HpFsAtzF+J3zTsS903K0vlIE8iDKUMUZxFJkgOeHAlrhIAr48AijqIwJxV1vB+JuNJ07JrDERwItxzRRwyDY+MHtNYfOjKRqMKmuzTpLAdEUkRYXVwI24Q707Up2o2iZxKRESIzig= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BY5PR12MB4130.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230001)(4636009)(366004)(186003)(110136005)(508600001)(36756003)(53546011)(8936002)(38100700002)(2906002)(66476007)(31696002)(5660300002)(6512007)(7416002)(83380400001)(54906003)(86362001)(26005)(66556008)(316002)(2616005)(4326008)(8676002)(31686004)(6506007)(66946007)(6486002)(45980500001)(43740500002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?Q2dTWmttaE9jN1pXMXF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Y0Q2dn?= =?utf-8?B?WXZwVHVPRFNGODRSbTczdjV3dTEvOHN2MXIreDc3MUVSN1pXdEhsalJBOGxv?= =?utf-8?B?cGFickNxVE5kVThwWWo3dGZTRmNLb3pVaktyWUQyVUh4SzFSbVVpaUIyZVZP?= =?utf-8?B?cHY2Umpxdjh5STZ2N1pmbnN6dktnWjNFTkQ0SFoxeGMwYzVheHMvWmU4QXFO?= =?utf-8?B?USt6M25kcXZRRDN5RGtMUXNmUWNUZG91UndFQTh3ZTZsNXp3MDdpN3A3WUgy?= =?utf-8?B?MjRrV1BSUEg4NnM1MDhEZ1FlUXZnZDZmWGlOcmRvei93RVFjYytpUCtCU1pC?= =?utf-8?B?OE5JVFdxUWhQOGtzWUlrVW5KSElmVU1VVEVmd2JjU1hQY1BHQWNrSm9yUkxP?= =?utf-8?B?SGFXRzdPbTNQWUpkajhuS0ExejZaUU5HZm5ncDk5aWcwaGdYbiswaVpsT0Mw?= =?utf-8?B?SWxTNkMrcHA1TTZtRG1pVDhaOXUyNXBUVXErZVlhdHhlcHMyNkdCMVljNTBj?= =?utf-8?B?S1EwR2xnd1ZldVc5Y2ViUFZoUWtWL29ya1AzQytaUHNrTjgxNXJabmdJM0Yx?= =?utf-8?Q?sKzpXrTU6GS0r160=3D?= X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 14277034-419c-4f0c-18fe-08da389dbfc4 X-MS-Exchange-CrossTenant-AuthSource: BY5PR12MB4130.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 May 2022 07:12:20.6073 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: hCNUk5f7udsrIEEWPOEqASj74xf5fIDDLAloW9NkJZpJGmp45m0lwOxn+YyFn8d++BtKsswb+X3IC4ZRoSWKJA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR12MB1908 X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,RDNS_NONE,SPF_HELO_NONE, T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 5/16/22 20:37, Mike Kravetz wrote: > Later, that code was modified (for performance reasons) in commit 0fa5bc4023c18 to do a single try_grab_compound_page() instead of multiple > calls to try_grab_page(). At the time it was not noticed that > try_grab_compound_page had a check for 'pinnable' when try_grab_page did > not. So, I think this commit actually changed the behavior. This makes me unhappy with the try_grab_page() situation: the name doesn't give you any hint that it now has extra policy in there. Furthermore, the policy is unaware of all of the call sites and is already getting it wrong. After looking through the call sites, I'm leaning slightly toward pulling is_pinnable_page() out, and letting the call sites decide if they want or need to apply that policy. Just because try_grab_folio() is a choke point, does not mean that it is the right place for the is_pinnable_page() checks. And while it's nice to avoid scattering is_pinnable_page() all over the place, it's more important to *not* have it when it is not correct. There is a counter-argument, though, which goes something like, "try_grab_folio(FOLL_PIN) is never ever correct if the page is not pinnable". But that's not as clear cut as one might think. See below. > >> >> try_grab_folio() >>     /* >>      * Can't do FOLL_LONGTERM + FOLL_PIN gup fast path if not in a >>      * right zone, so fail and let the caller fall back to the slow >>      * path. >>      */ >>     if (unlikely((flags & FOLL_LONGTERM) && >>              !is_pinnable_page(page))) /* which we just changed */ >>         return NULL; >> >> ...and now I'm starting to think that this warning might fire even with >> the corrected check for MIGRATE_CMA || MIGRATE_ISOLATE. Because >> try_grab_folio() didn't always have this early exit and it is starting >> to look wrong. >> >> Simply attempting to pin a non-pinnable huge page would hit this >> warning. Adding additional reasons that a page is not pinnable (which >> the patch does) could make this more likely to fire. > > Yes, that is correct. One could easily allocate a hugetlb page from > CMA and trigger this warning. > Thanks for confirming that! >> >> I need to look at this a little more closely, it is making me wonder >> whether the is_pinnable_page() check is a problem in this path. The >> comment in try_grab_folio() indicates that the early return is a hack >> (it assumes that the caller is in the gup fast path), and maybe the hack >> is just wrong here--I think we're actually on the slow gup path. Not >> good. >> >> Mike, any thoughts here? >> > > Do you know why try_grab_compound_page(now try_grab_folio) checks for > pinnable when try_grab_page does not? I think it's just an oversight. The CMA and migrate-out logic was sort of retrofitted and I think it's just incomplete, yet. > > Then I guess the next question is 'Should we allow pinning of hugetlb pages > in these areas?'. My first thought would be no. But, recall it was 'allowed' > until that commit which changed try_grab_page to try_grab_compound_page. > In the 'common' case of compaction, we do not attempt to migrate/move hugetlb > pages (last time I looked), so long term pinning should not be an issue. > However, for things like memory offline or alloc_contig_range() we want to > migrate hugetlb pages, so this would be an issue there. > > At a minimum, I think the warning should go. Agreed. That, and either a) bring try_grab_folio() and try_grab_page() into the same behavior with respect to checking for pinnable, or b) lifting is_pinnable_page() out of try_grab_folio() and letting the callers decide, as mentioned above. Your point above makes it seem like the flexibility of (b) might be better... thanks, -- John Hubbard NVIDIA