From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6685CC433EF for ; Sat, 21 May 2022 18:25:15 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5B6086B0072; Sat, 21 May 2022 14:25:14 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 565846B0073; Sat, 21 May 2022 14:25:14 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 405F36B0074; Sat, 21 May 2022 14:25:14 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 2D8036B0072 for ; Sat, 21 May 2022 14:25:14 -0400 (EDT) Received: from smtpin18.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay12.hostedemail.com (Postfix) with ESMTP id 902A012075E for ; Sat, 21 May 2022 18:25:07 +0000 (UTC) X-FDA: 79490577054.18.BB3C297 Received: from mail-pg1-f179.google.com (mail-pg1-f179.google.com [209.85.215.179]) by imf27.hostedemail.com (Postfix) with ESMTP id 2525440017 for ; Sat, 21 May 2022 18:25:03 +0000 (UTC) Received: by mail-pg1-f179.google.com with SMTP id g184so10340833pgc.1 for ; Sat, 21 May 2022 11:25:06 -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=CjE02QgmqfWM27EHE45r9gnVeMZ4fbWHuKF/6kJ2VZ3FbqZb9oshtK3bIPt6jbqJPS 4pGZvhaNADGAQ/tIuRh1o2ta7g6QT9dOiuuT36KCcJyM1VOR/SssspzwGW9/A98JdbmO ZHLlnj7MeUdH6tIhByshMaVETUMK5kF0kHAzomo4mp0XdZoziTKv6GSfv/1ipr8mU7Ws tmEvJabMoPPskxFzPLhxtUwXvGLgSu8wWKYIUtmJh+Bkuc0hGdJG7Uxd0GiPwHpUlpqy Nz4jOJs5FELkG1I+eNGxERGXHsQrDVOhpEsuHivc+wKtAs8l++I7+zAHN/3XH+PsaNPZ VQAg== X-Gm-Message-State: AOAM5315M7HuRdFPb/3f9AtShLgRPhMOA4avLEatTYTZZLpiOkYtm2ix nESJmFsf+b7JORdjXXurcpY= 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) 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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <000a117a-694d-d3a9-a192-14d08d50c884@redhat.com> X-Rspam-User: X-Rspamd-Queue-Id: 2525440017 X-Stat-Signature: 98qt7fqm86nzrc3kdmitxbzy517xqhj3 Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=EnB2MD2G; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=kernel.org (policy=none); spf=pass (imf27.hostedemail.com: domain of minchan.kim@gmail.com designates 209.85.215.179 as permitted sender) smtp.mailfrom=minchan.kim@gmail.com X-Rspamd-Server: rspam04 X-HE-Tag: 1653157503-640820 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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.