Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp1657293ioo; Sun, 22 May 2022 23:17:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyCvK9fm+NRDsV4cAukbnJbEcTczhLRTwyKkrW5V0B5cnfPRKJurSIIAFr+11BueNz0bcnf X-Received: by 2002:a63:2b0b:0:b0:39d:890a:ab68 with SMTP id r11-20020a632b0b000000b0039d890aab68mr18764243pgr.247.1653286636377; Sun, 22 May 2022 23:17:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653286636; cv=none; d=google.com; s=arc-20160816; b=mk5krPyo2/H6r/yRBi5v6X5Tj2V2cOL9cISKdy30apvT7p4Ki1UdyFmixmEU+z8gC7 OJnwX86WE3G0wLi9MFRrjdzz7V8khNuW0bzU6MVa/+OEp4HnqOoNE75/Xxk8BFgscNmT 48JoR2DUibtQ7NNU2PH7IzDAo9zVJZobE8Gk1pi/JXMDothAVzlz3PoPlWUvxke+Tvca ApGZbEDomU2k3GxKvc/H9ubIIRIRK2+VNxPv4r7SCwivVEVzTjc4jnpiokjpOcyN3Leg 2k7nOds0+Kk0Y1r7pD0rgmW9s3Hwk4pHg6+FAdVjR5qUWgBOB1E0H0O9V6nEXFVhrZhR 4InA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:sender:dkim-signature; bh=dK6aWQ96HxSVfQTqNhYzR/lve/VK/MSeycmkC1UctXs=; b=OMVqqFPmh0cbQhz8QUeyjOP9r6Ycj1hAQ+u+exOHFTwbtzpS7LOGqcGhP9XsgCE1DX +gkhBQL8+xa9WCNk9TfAoNI42H/lLZ+VWkCgggMItJfI82GGuUVMWJkckeE0EyEMPBum /5r6NeY/ODzngBnx+sSh/cEIV9AEDSjENZq6Fkwj9Qxyd6U86Ukg7wskeuCrJVAhUNAJ +v2+mAdByT8pf2FIH67jOBSm5mRZ8XUXsL7xwDxiBj3UeHaV0LQdGIC/zXml8cs4AYPI dbgfikplzH/gJtwGfu1Y8wdYvMvH8DiktknX4BCBExiErHeGYONl7fL0XrISF7VNvKRl MtoQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=U3DqD7sq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id s12-20020a63e80c000000b003aa8b6e4691si9608384pgh.761.2022.05.22.23.16.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 22 May 2022 23:17:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=U3DqD7sq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 21D093D4B5; Sun, 22 May 2022 23:02:27 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354061AbiETXZL (ORCPT + 99 others); Fri, 20 May 2022 19:25:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35218 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345833AbiETXZK (ORCPT ); Fri, 20 May 2022 19:25:10 -0400 Received: from mail-pf1-x433.google.com (mail-pf1-x433.google.com [IPv6:2607:f8b0:4864:20::433]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B607A19C387 for ; Fri, 20 May 2022 16:25:09 -0700 (PDT) Received: by mail-pf1-x433.google.com with SMTP id bo5so8919026pfb.4 for ; Fri, 20 May 2022 16:25:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=dK6aWQ96HxSVfQTqNhYzR/lve/VK/MSeycmkC1UctXs=; b=U3DqD7sq1I+MlHxQVk+/siCazWQEsvCDziTc8ngEBK+TX4C3iVEuZFs5Evl1Zng/IA 2Ep7pVIPdIzkYBEd/GvLbnpHVfHQ2lh2+WPuSVzmz5eyeRH5Z4s1iB0LGmKrYwXB+eSJ f0BHeft5hzxYwCUw9hRxOhBFNcaH7lviYHFhpqe0a7JhIsEu9fZI55WkGwWrx4cxs5/P h2Ue2pjZGaX8sq+WGcLFIH4OIJapiIOtmYsFHPYDKnwX3PMyO1vLeGyZv9M6BDyGiVFu HVXN+C4rrp1L6FUqlyX4/IvQELKdFzZLEPUsT8uKtCG/aGVS7caClbzi3UO5E5DJiIzw zKcA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to; bh=dK6aWQ96HxSVfQTqNhYzR/lve/VK/MSeycmkC1UctXs=; b=iJcNWv3P43UjXiUzsNU5Ki7o9bTqBEgYLtEzDePqihNRKMdpyHiF5n/v2pPchuTk+b T+mKn3BQWXe8GQJqXeTWd0Lplp0BjSLsx8th5sS2SqzUXTRowGYxB1C1cVG9Osbt7hLz gEMT008bE9ibzB4xb8064IwD8MwMIdZT+kJNH9+VtKNGkYR/Ax5+kYvuOE5n/WGtIEuP 4cL54SAo6Bql8Z1bKhqCHIWExrBwHhl4uhXuZ7auj0UwlnIo/xp+IvXikd1TSonVXTii Nk5wMIOJoYB6pkpUJ9b9DxZf+W8l3Vg9bZ/91KcwIaV/fpcOC4lqs7JOzfUNTD0P0zLV aTBQ== X-Gm-Message-State: AOAM532qxniWDrhZlqbPUryL/LB9wDD6sK76Ioo2fGKCr6x+Ezm35IRm DdhcyuQl69qUsFr13otaDv4= X-Received: by 2002:a65:6284:0:b0:3f6:298d:dd81 with SMTP id f4-20020a656284000000b003f6298ddd81mr10585451pgv.319.1653089109113; Fri, 20 May 2022 16:25:09 -0700 (PDT) Received: from google.com ([2620:15c:211:201:828d:ad52:eebc:6659]) by smtp.gmail.com with ESMTPSA id e20-20020a170902ed9400b0015e8d4eb1f5sm280302plj.63.2022.05.20.16.25.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 May 2022 16:25:08 -0700 (PDT) Sender: Minchan Kim Date: Fri, 20 May 2022 16:25:06 -0700 From: Minchan Kim To: John Hubbard Cc: Mike Kravetz , 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 Subject: Re: [syzbot] WARNING in follow_hugetlb_page Message-ID: References: <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> <0be9132d-a928-9ebe-a9cf-6d140b907d59@nvidia.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <0be9132d-a928-9ebe-a9cf-6d140b907d59@nvidia.com> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE, T_SCC_BODY_TEXT_LINE autolearn=no 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 Fri, May 20, 2022 at 03:56:31PM -0700, John Hubbard wrote: > On 5/20/22 15:19, Minchan Kim wrote: > > The memory offline would be an issue so we shouldn't allow pinning of any > > pages in *movable zone*. > > > > Isn't alloc_contig_range just best effort? Then, it wouldn't be a big > > problem to allow pinning on those area. The matter is what target range > > on alloc_contig_range is backed by CMA or movable zone and usecases. > > > > IOW, movable zone should be never allowed. But CMA case, if pages > > are used by normal process memory instead of hugeTLB, we shouldn't > > allow longterm pinning since someone can claim those memory suddenly. > > However, we are fine to allow longterm pinning if the CMA memory > > already claimed and mapped at userspace(hugeTLB case IIUC). > > > > From Mike's comments and yours, plus a rather quick reading of some > CMA-related code in mm/hugetlb.c (free_gigantic_page(), > alloc_gigantic_pages()), the following seems true: > > a) hugetlbfs can allocate pages *from* CMA, via cma_alloc() > > b) while hugetlbfs is using those CMA-allocated pages, it is debatable > whether those pages should be allowed to be long term pinned. That's > because there are two cases: > > Case 1: pages are longterm pinned, then released, all while > owned by hugetlbfs. No problem. > > Case 2: pages are longterm pinned, but then hugetlbfs releases the Longterm pinned means the hugetlbfs page were mapped at userspace and someone called FOLL_LONGTERM against on the page? > pages entirely (via unmounting hugetlbfs, I presume). In Then, how can FS unmount successfully while something is accessing on the page of the file in FS? (I expected FS should return -EBUSY). Does hugetlbfs have something special? > this case, we now have CMA page that are long-term pinned, > and that's the state we want to avoid.