Received: by 2002:a05:7412:da14:b0:e2:908c:2ebd with SMTP id fe20csp132557rdb; Thu, 5 Oct 2023 20:39:42 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEEfBdfxNa8OYSZieYUgsYzFgl2AHliMe4A7p4uclo/xfVN9oQmC/KfYA6E7z8FSk2r21NE X-Received: by 2002:a05:6a00:3026:b0:693:3629:2939 with SMTP id ay38-20020a056a00302600b0069336292939mr4058927pfb.9.1696563581917; Thu, 05 Oct 2023 20:39:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696563581; cv=none; d=google.com; s=arc-20160816; b=Ynl7QgJdvwx69gw2LDs0o/N75k5Ef3RSLOpz1Fi1UrWth+C+D6r1sMxdasJY1wMJ3W QMdWlBUd6y+0VKDEwb07/MXrkhKzjciMpAnwxiBLl1xsNgp9OSOI51lFnHXNJgmjQ94w WFyiXHYC1HXkoIsmZz5HBZGTYEUdyeO4NPi61072sO4PLcd8CMzbcb/1Z3ipAECPz7iM EZNCaYf/Rs0g/5DkCWZNnIB58YkgMcXoBOg1Iyosr23877gDPG5YfVCB5RbxzOnY7WUK kOBpgieAEGzBUlsd9gFwSJkF+eTbbx+bD8pLshsZWSVmYzH9MPZmgPUGsFdfQL5yvJa0 31Ww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent :content-transfer-encoding:references:in-reply-to:date:cc:to:from :subject:message-id; bh=CcEkYb6SvG/FQZ1xL6V4jWH9I7Yo75Bxa2nitZvw3f0=; fh=hOaN1/HlXWrx/vHluPQdqKKg6VbIVLaMJV2uvguRs3c=; b=u06L4cF6I+9QjJsLRq5CEbah7PBJvLoT44Hhau8FjK9dswAXKywFYabl1O823feZj/ lzDA8A9UISSxJr9Pper8/2MzY05iRX0M4oD6ZWtEMwsu4xOPkRPUlZsvla6ygPYhm5Pf D12R30hPp3cjZLagD7HWKsRzUQNuUMIr1meMab+gqam4W9fKZDiMI0j568cr4LtsFWW7 AWRDDwDxFd2NA4ObScsJY2e2u3HU3TFtuO9u6fA0xsiY3KR1WDbMBx135QiPiBczAu2o 1CwaP1gVxf6yPrHOEY+IlLpu3rCeJgo20ThB7NC8E+mJ5j0ukvkML4leb6OptCosy7rL tn4A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id h70-20020a638349000000b0056af922fdc9si2594334pge.852.2023.10.05.20.39.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Oct 2023 20:39:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id F3FBA838B3D2; Thu, 5 Oct 2023 20:39:17 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229850AbjJFD3c convert rfc822-to-8bit (ORCPT + 99 others); Thu, 5 Oct 2023 23:29:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57830 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229815AbjJFD3b (ORCPT ); Thu, 5 Oct 2023 23:29:31 -0400 Received: from shelob.surriel.com (shelob.surriel.com [96.67.55.147]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 21873E4 for ; Thu, 5 Oct 2023 20:29:29 -0700 (PDT) Received: from imladris.home.surriel.com ([10.0.13.28] helo=imladris.surriel.com) by shelob.surriel.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1qobWM-0001qH-1a; Thu, 05 Oct 2023 23:28:58 -0400 Message-ID: Subject: Re: [PATCH 3/3] hugetlbfs: replace hugetlb_vma_lock with invalidate_lock From: Rik van Riel To: Mike Kravetz Cc: linux-kernel@vger.kernel.org, kernel-team@meta.com, linux-mm@kvack.org, akpm@linux-foundation.org, muchun.song@linux.dev, leit@meta.com, willy@infradead.org Date: Thu, 05 Oct 2023 23:28:58 -0400 In-Reply-To: <20231006001912.GB86415@monkey> References: <20231004032814.3108383-1-riel@surriel.com> <20231004032814.3108383-4-riel@surriel.com> <20231006001912.GB86415@monkey> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8BIT User-Agent: Evolution 3.46.4 (3.46.4-1.fc37) MIME-Version: 1.0 Sender: riel@surriel.com X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_NONE 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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Thu, 05 Oct 2023 20:39:18 -0700 (PDT) On Thu, 2023-10-05 at 17:19 -0700, Mike Kravetz wrote: > > I have not gone through the patch, but it does produce the following: > > [   49.783584] ===================================== > [   49.784570] WARNING: bad unlock balance detected! > [   49.785589] 6.6.0-rc3-next-20230925+ #35 Not tainted > [   49.786644] ------------------------------------- > [   49.787768] hfill2/938 is trying to release lock > (mapping.invalidate_lock) at: > [   49.789387] [] > remove_inode_hugepages+0x405/0x4b0 > [   49.790723] but there are no more locks to release! > [   49.791808] > [   49.791808] other info that might help us debug this: > [   49.793274] 4 locks held by hfill2/938: > [   49.794190]  #0: ffff8881ff3213e8 (sb_writers#11){.+.+}-{0:0}, at: > do_syscall_64+0x37/0x90 > [   49.796165]  #1: ffff888181c99640 (&sb->s_type- > >i_mutex_key#16){+.+.}-{3:3}, at: do_truncate+0x6f/0xd0 > [   49.798188]  #2: ffff888301592f98 > (&hugetlb_fault_mutex_table[i]){+.+.}-{3:3}, at: > remove_inode_hugepages+0x144/0x4b0 > [   49.800494]  #3: ffff888181c998b0 > (&hugetlbfs_i_mmap_rwsem_key){++++}-{3:3}, at: > remove_inode_hugepages+0x239/0x4b0 Well that's a fun one. The remove_inode_hugepages function does not take the mapping.invalidate_lock, but it calls hugetlb_unmap_file_folio which does. The vma_interval_tree_foreach loop has a stray hugetlb_vma_unlock_write() left, which I should have removed when lifting the lock outside of the loop. Nice catch! -- All Rights Reversed.