Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp1178444rwd; Wed, 7 Jun 2023 12:11:49 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6PVWPWkoZ1rxbVB2d4T2i39jQGA0InsKD2pSbELZzwrb6n3C8gfNGB/OClNSdTwy0h2qtb X-Received: by 2002:aca:1a0b:0:b0:39a:bda7:adc1 with SMTP id a11-20020aca1a0b000000b0039abda7adc1mr6317669oia.2.1686165109101; Wed, 07 Jun 2023 12:11:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686165109; cv=none; d=google.com; s=arc-20160816; b=GVh6Gf9ZnZmcyiNwUq8Tl6H6yvCY9V3flD/M120w3pCH04kOkXOrTktl08lJRZ6znz AK04H/dxs1uHCWLfRzXbSvFDBod5H5qb9+pEvgu7lmwGLeGSpTo4y5kaKxKPoCDvz/0w li5wawRql579mtU9r9Ck1jWYtlhfygtcKu4YqtS8DauJ17QQlnw2jsinRtvY5nRGtB7Q r+VKenytlSNospTiDD817uWMAN0TVatnxo3QCJJkWiQ/a37+UY3DMU3KUH4kGns8vol0 trIMUdNHThHkJ13aEuiS7BljWml5NkeY3K1f49nQ5EV4073Dg6zEt4NnyLVIxT+xGO6y w1uA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=yMg9D5d9coBx+p1yklEhjw4lXM468OIRpnbvgYsfWCo=; b=kcAvpYGde4zONeavtuu4gUyhtvSB4LhVJJIfhQ7apERcNzUuVEK5/Aoi+4zmNbx1y4 BOJVwE4OOEEMLgmGu3e/BaTdDNpNiDIq4gkMp7uTSoLTj144Klhq+iL6Feit84UPH3uI O+HMyKBthzNKYHspLsAbyChc0zW0wLxqiQ4uhocmxoo+T3ZJG6bc6WauSrZow30NvySC HdeqvW8gJXrDGB7ihZOhSrWVT9PNYHpI41cvN5PCKmGxOzoTQtWtBUnZhVraqHGd561A 44WmCmma3z5xAvoAb3Dooyll+EbMxOwNOXKp1IxMQ1lhcGO0hxW4TuMt76Vph8QjjN1g 1+ZA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=korg header.b=Ssml13aG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h70-20020a638349000000b0053ef547263csi5753856pge.398.2023.06.07.12.11.36; Wed, 07 Jun 2023 12:11:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=korg header.b=Ssml13aG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231490AbjFGTDQ (ORCPT + 99 others); Wed, 7 Jun 2023 15:03:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36004 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229481AbjFGTDP (ORCPT ); Wed, 7 Jun 2023 15:03:15 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5EA21193 for ; Wed, 7 Jun 2023 12:03:14 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id EEB1061779 for ; Wed, 7 Jun 2023 19:03:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D38B2C433D2; Wed, 7 Jun 2023 19:03:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1686164593; bh=6rM3c0MzWmypFl9SNFBILYmJFrC7/yHDs2cmHU7fDRE=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=Ssml13aGyZyJ3ub78D/30u0UL0IB0MjCmCDTGHBI1B8L+zNeaRQzmtYap1KIiZzbx iwFHzqzJ92fkaq893W+6Uo0nFRdBZC7b8EpitBAsS/01f3s27OicNfWuDXwzFKTj1R gw6wXPo7gPLbJ2AOYwKqRyVsaoO4q6ZVJ3EHYaIc= Date: Wed, 7 Jun 2023 12:03:12 -0700 From: Andrew Morton To: Mike Kravetz Cc: Gerd Hoffmann , Junxiao Chang , kirill.shutemov@linux.intel.com, mhocko@suse.com, jmarchan@redhat.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org, muchun.song@linux.dev, Vivek Kasireddy , Dongwon Kim , James Houghton , dri-devel@lists.freedesktop.org Subject: Re: [PATCH] mm: fix hugetlb page unmap count balance issue Message-Id: <20230607120312.6da5cea7677ec1a3da35b92c@linux-foundation.org> In-Reply-To: <20230516223440.GA30624@monkey> References: <20230512072036.1027784-1-junxiao.chang@intel.com> <20230512232947.GA3927@monkey> <20230515170259.GA3848@monkey> <20230516223440.GA30624@monkey> X-Mailer: Sylpheed 3.8.0beta1 (GTK+ 2.24.33; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.2 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham 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 Tue, 16 May 2023 15:34:40 -0700 Mike Kravetz wrote: > On 05/15/23 10:04, Mike Kravetz wrote: > > On 05/12/23 16:29, Mike Kravetz wrote: > > > On 05/12/23 14:26, James Houghton wrote: > > > > On Fri, May 12, 2023 at 12:20 AM Junxiao Chang wrote: > > > > > > > > This alone doesn't fix mapcounting for PTE-mapped HugeTLB pages. You > > > > need something like [1]. I can resend it if that's what we should be > > > > doing, but this mapcounting scheme doesn't work when the page structs > > > > have been freed. > > > > > > > > It seems like it was a mistake to include support for hugetlb memfds in udmabuf. > > > > > > IIUC, it was added with commit 16c243e99d33 udmabuf: Add support for mapping > > > hugepages (v4). Looks like it was never sent to linux-mm? That is unfortunate > > > as hugetlb vmemmap freeing went in at about the same time. And, as you have > > > noted udmabuf will not work if hugetlb vmemmap freeing is enabled. > > > > > > Sigh! > > > > > > Trying to think of a way forward. > > > -- > > > Mike Kravetz > > > > > > > > > > > [1]: https://lore.kernel.org/linux-mm/20230306230004.1387007-2-jthoughton@google.com/ > > > > > > > > - James > > > > Adding people and list on Cc: involved with commit 16c243e99d33. > > > > There are several issues with trying to map tail pages of hugetllb pages > > not taken into account with udmabuf. James spent quite a bit of time trying > > to understand and address all the issues with the HGM code. While using > > the scheme proposed by James, may be an approach to the mapcount issue there > > are also other issues that need attention. For example, I do not see how > > the fault code checks the state of the hugetlb page (such as poison) as none > > of that state is carried in tail pages. > > > > The more I think about it, the more I think udmabuf should treat hugetlb > > pages as hugetlb pages. They should be mapped at the appropriate level > > in the page table. Of course, this would impose new restrictions on the > > API (mmap and ioctl) that may break existing users. I have no idea how > > extensively udmabuf is being used with hugetlb mappings. > > Verified that using udmabug on a hugetlb mapping with vmemmap optimization will > BUG as: BUGs aren't good. Can we please find a way to push this along? Have we heard anything from any udmabuf people?