Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp165168iob; Mon, 2 May 2022 16:04:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyQCJ3ma1wHf157yaPlrtjDXWxZExkCM+3EDzEHB8G3kFO1ql2tjJ0pVJFYF/h22Ghbw9MG X-Received: by 2002:a63:df18:0:b0:3ab:938b:e6c5 with SMTP id u24-20020a63df18000000b003ab938be6c5mr11677433pgg.165.1651532647516; Mon, 02 May 2022 16:04:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651532647; cv=none; d=google.com; s=arc-20160816; b=BVkHQs5WAqUpdywz2KvSiVGrDEXuuqV8Hsd3g70IunF1otDraurfUpSCBmO840VZy2 UeEW1bhriHJZsFIYuGua4fp7pCfI9iICefCdEjR9gRqe0ZhALv+qIjnaFjFYNxiQ2EL/ 6PTqlJxkm4HNye6MjTp2vBeB17Fo3t/vTxkgP1MypgvOvvNEqWgZlKWJUsF25ye7eju1 52QRYRqjZOW5u2qzNbCj6U2G1l2sjjV8p42oWkgxAR4QIUbjzcXEcyvxLRnUmmQ25vMk nZ5yYn1Q0r2+d4ejJQkQ/+ml74LAen3G+DLDyaaHXeFBG1mrVudgD5sBp8NZh3hig9dl Ycqw== 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=VFmAjLHK9Gxhb5GaaE0VGHVYml8nYrwQpBvTkStjGE0=; b=megOTw4B8f2C31a8IDhIE/Lf55b/uLna6cWJhT/RwiXzAdU+xImQcR5FuzvIyHKrWK a7jHLCmlZSi8+JtokF6tuMClT4FzBOzLJm7FJK55UY3stB0R8IhI0jbwui5fV9oVWpdJ tZ3M2+gywjeXFAMabSxGUOEV3J0WBeCItoVLRMfGx2Rrlw65zpuLNbtNSHASfib3uP8K k/FeCu93rPV105fkx/y+KZX5VYNuycc2eMdT0HdZzaJKuTDxRH3AY3aj0dahlv6J4DOt gzp75IbQijla1equ4scHehQCbpDBzntnJFOlJr9cZUeVr/9Ck+9sLqCPQVtGxBweKIzv 1pOA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=korg header.b=xCvsVijl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id s34-20020a632162000000b003ab7a1a2193si15219293pgm.151.2022.05.02.16.04.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 May 2022 16:04:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=korg header.b=xCvsVijl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 9ADDA2DD70; Mon, 2 May 2022 16:04:01 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1380669AbiD2UhI (ORCPT + 99 others); Fri, 29 Apr 2022 16:37:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41840 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348455AbiD2UhG (ORCPT ); Fri, 29 Apr 2022 16:37:06 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A3BADD76EA for ; Fri, 29 Apr 2022 13:33:47 -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 491F361C00 for ; Fri, 29 Apr 2022 20:33:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 673B9C385A4; Fri, 29 Apr 2022 20:33:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1651264426; bh=mJwM9kYiqD3MWh4ufFdQRNVIdYK+ZNJ3as0lI4uuVH4=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=xCvsVijlvrTtk1RzeXAoZaMixC4mvk/zmb8C9kir/tVaBvHCyYBuufanpBQfP22BL EHR91IYXvm7RHt/MWLaZ2WDdJpZXZngwe2r2TTfCodMIWPv0Y23I4IzhsdpbJPE8Z8 ScVJJn08m5xs/617bA3tMnCpsuQkvCDlmvf8FokM= Date: Fri, 29 Apr 2022 13:33:45 -0700 From: Andrew Morton To: Mina Almasry Cc: Mike Kravetz , Oscar Salvador , Muchun Song , Michal Hocko , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v1] hugetlbfs: fix hugetlbfs_statfs() locking Message-Id: <20220429133345.d79af45fb107340c31655c8e@linux-foundation.org> In-Reply-To: <20220429202207.3045-1-almasrymina@google.com> References: <20220429202207.3045-1-almasrymina@google.com> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.33; x86_64-redhat-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-3.6 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,RDNS_NONE,SPF_HELO_NONE, T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 Fri, 29 Apr 2022 13:22:06 -0700 Mina Almasry wrote: > After commit db71ef79b59b ("hugetlb: make free_huge_page irq safe"), > the subpool lock should be locked with spin_lock_irq() and all call > sites was modified as such, except for the ones in hugetlbfs_statfs(). > > ... > > --- a/fs/hugetlbfs/inode.c > +++ b/fs/hugetlbfs/inode.c > @@ -1048,12 +1048,12 @@ static int hugetlbfs_statfs(struct dentry *dentry, struct kstatfs *buf) > if (sbinfo->spool) { > long free_pages; > > - spin_lock(&sbinfo->spool->lock); > + spin_lock_irq(&sbinfo->spool->lock); > buf->f_blocks = sbinfo->spool->max_hpages; > free_pages = sbinfo->spool->max_hpages > - sbinfo->spool->used_hpages; > buf->f_bavail = buf->f_bfree = free_pages; > - spin_unlock(&sbinfo->spool->lock); > + spin_unlock_irq(&sbinfo->spool->lock); > buf->f_files = sbinfo->max_inodes; > buf->f_ffree = sbinfo->free_inodes; > } Looks good. This seems to be theoretically deadlockable and less theoretically lockdep splattable, so I'm inclined to cc:stable on this. I wonder why we didn't do that with db71ef79b59bb2e78dc4.