From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pf1-f171.google.com (mail-pf1-f171.google.com [209.85.210.171]) (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 645123218 for ; Sat, 21 May 2022 18:25:03 +0000 (UTC) Received: by mail-pf1-f171.google.com with SMTP id h13so4018371pfq.5 for ; Sat, 21 May 2022 11:25:03 -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=h0wJDcwRs4mXeTep4IuVQMZLPWQneg1C4iNScMcuJoI=; b=EnB2MD2GnrEfsaOFYP68a6RoD2AQxuP3Y0NjVpXsoFaLY9QdgcfhUumcUTJhlrr87c xxTazCcm6eHZnBGfE27GOOICbHpOIX4jt3mNfRPEOmH5eMKADUw1Sv4Q8x1nWoMYoNsY XFNIGAAjHVSCChm0n0wFvaaKt8C+OaFpQ+JuoIyiAbKjYo/pTNX14Jeb8VorxLcZam/G 0E5G5ugzq6smA8Ngddc46NIW+d4sBFEKqUcRY9UBuceiaxJzeVnhs81r8LrqxJgXmdVq VENfBAtEXYYJvkAmKpIJacDOItJE6s20phWBP64SUxBa9dixjaZ3K388Vv3NnLKVRchh 0G5A== 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=h0wJDcwRs4mXeTep4IuVQMZLPWQneg1C4iNScMcuJoI=; b=xTyyLKlItfh+WDBgt/Y7fJseMQls+zJZ1NyV6himVYSqKx8BeaZXDyszZUdalS8hHA KzoFhwFOcL6yJppBe76mbPGdBpSOqNfcfdHoB8hmqLvqX2S3w069IsTamlRcDzink58A In/URsv/EC0fqos7SvK2urpQmfCdI6Sk2KPA4Fmwq9h535t3fogjr2D4a+gN2v8adrkr ivnmH+Z0iuzZY7AbXVfNBpTv8TB2ECx5aVwgVMevWzYd3LQh4c+xbtsKA4ia9GMuN0xn LSCxLfuf/gHR+6UvlhO+c6NEng+YzSI9ibUu4ZYoGnSXenYiawZOUcAMwmpkEFpvui1J a0Tw== X-Gm-Message-State: AOAM533P6TioHV2JwNxsfdTxlkzUPINfNBm1sK8Cj7zPHFbq5JYKQ2fr Ck9LZBZjmE65QCva/qovUUM= X-Google-Smtp-Source: ABdhPJyQrrZ+8SIhwCfj3TGOCDgRzsIamxuL/g0iUUnx1BAIMmFzoOfdMa2PV/xYNywoietvFXjKIQ== X-Received: by 2002:a05:6a00:15c7:b0:510:48c9:f302 with SMTP id o7-20020a056a0015c700b0051048c9f302mr15695799pfu.23.1653157502732; Sat, 21 May 2022 11:25:02 -0700 (PDT) Received: from google.com ([2620:15c:211:201:ef57:ac0e:cc3e:9974]) by smtp.gmail.com with ESMTPSA id r5-20020a655085000000b003f60df4a5d5sm1858737pgp.54.2022.05.21.11.25.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 May 2022 11:25:02 -0700 (PDT) Sender: Minchan Kim Date: Sat, 21 May 2022 11:25:00 -0700 From: Minchan Kim To: David Hildenbrand Cc: Mike Kravetz , John Hubbard , 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 Subject: Re: [syzbot] WARNING in follow_hugetlb_page Message-ID: References: <6d281052-485c-5e17-4f1c-ef5689831450@oracle.com> <0be9132d-a928-9ebe-a9cf-6d140b907d59@nvidia.com> <000a117a-694d-d3a9-a192-14d08d50c884@redhat.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: <000a117a-694d-d3a9-a192-14d08d50c884@redhat.com> On Sat, May 21, 2022 at 06:46:27PM +0200, David Hildenbrand wrote: < snip > > >> The general rules are: > >> > >> ZONE_MOVABLE: nobody is allowed to place unmovable allocations there; it > >> could prevent memory offlining/unplug. > >> > >> CMA: nobody *but the designated owner* is allowed to place unmovable > >> memory there; it could prevent the actual owner to allocate contiguous > >> memory. > > > > I am confused what's the meaning of designated owner and actuall owner > > in your context. > > designated==actual here. I just wanted to distinguish from someone > current temporary owner of the page ("allocated it via a movable > allocation") but the actual designated owner (e.g., hugetlb CMA) > > The page/memory owner terminology is just confusing. Let's rephrase to: > only the CMA area owner is allowed to place unmovable allocations there. Yeah, the CMA area owner is much better. > > > > > What I thought about the issue based on you explanation: > > > > HugeTLB allocates its page by two types of allocation > > > > 1. alloc_pages(GFP_MOVABLE) > > > > It could allocate the hugetlb page from CMA area but longterm pin > > should migrate them out of cma before the pinning so allowing > > the pinning on the page is no problem and current code works like > > that. > > > > check_and_migrate_movable_pages > > > > Yes. > > > 2. cma_alloc > > > > The cma_alloc is used only for *gigantic page* and the hugetlbfs > > is the very owner of the page. IOW, if the hugetlbfs was succeeded > > to allocate the gigantic page by cma_alloc, there is no other > > owner to be able to claim the page any longer so it's fine to > > allow longterm pinning againt the gingantic page but current. > > However, current code doesn't work like that due to > > is_pinnable_page. IOW, hugetlbfs need a way to distinguish > > whether the page owner is hugetlbfs or not. > > > > Are we on same page? > > Yes, exactly. What I wanted to express is: for huge pages we have to > make a smarter decision because there are cases where we want to > migrate, and cases where we don't want to migrate. Sure, maybe hugetlbfs could squeeze a bit in one of subpage of the CMA compound page. "I am CMA allocated but allow to pinned for longterm" Thanks.