From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pf1-f170.google.com (mail-pf1-f170.google.com [209.85.210.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C8B297E for ; Fri, 20 May 2022 23:25:09 +0000 (UTC) Received: by mail-pf1-f170.google.com with SMTP id x143so8898406pfc.11 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=qViEf5nD3+pT9wNECqzoe3hYtGXsO9N0h+UU1c5ZHQptEr0RMZXFrljhJTzZSIlu+1 v+PTvdB7fRZBg2qZvWzFIdU0kIzvtemmc373mWlWnvaPFcOVFa4j/RbBCU9xAqmcvIHx /SQ7faby/HdqHwfpWjFDvXgPRoiJwDmjJqGkH2/sbc/TAwta0ST6tyDH7bqHXkoFiP5Z gX3nrf+9boGBYchyhhb/Ld8ZXPzOYPZKXCJC3i49p+Seqdi+J+4aE9nNfA4KJIBarBdy LNYcfGGMyOROrYBvSF0ErkcYJVp9jG0GWbNJ+fvHFw7x4Z8ypvsAmZ7NfRIvG74oT9+G JEoQ== X-Gm-Message-State: AOAM532x5wP1pp3oIiqF6b5po1xIcjgjClXAguIuuKTIZp5mR/PM4DAY QJ4KpTxCEHLalvDV9OxdDmM= X-Google-Smtp-Source: ABdhPJyE1RaSvSxVHiLM6HeYNaToB3qUV/BKnB2qguGOzUfbtSGaKF1MFfjfYiCgITG+2pP6LZ/i7g== 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> Precedence: bulk X-Mailing-List: llvm@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <0be9132d-a928-9ebe-a9cf-6d140b907d59@nvidia.com> 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.