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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A3F6DC4332F for ; Wed, 30 Nov 2022 05:18:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233425AbiK3FSU (ORCPT ); Wed, 30 Nov 2022 00:18:20 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34024 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232806AbiK3FSQ (ORCPT ); Wed, 30 Nov 2022 00:18:16 -0500 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CD36E69ABE for ; Tue, 29 Nov 2022 21:18:14 -0800 (PST) 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 sin.source.kernel.org (Postfix) with ESMTPS id D6B52CE17EC for ; Wed, 30 Nov 2022 05:18:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B2B40C433D6; Wed, 30 Nov 2022 05:18:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1669785491; bh=LthRoD/zLPG9U+Zco97eCEddMkCmFyhLksJ09r5LxBA=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=qf+88bujVlsGtbJhGEKuyTN8cI+YiRVYOwBRf5XX7L4QvEQfQk5nzyrlNxn93NpaM DMmkNdtS8RU5BeWhKxovjrCPXAO7uUU+RO/1qQwxohR63Bah0gB4RJ9cWIrjwcc+mZ +HCX7PR0eyAeOPE5IbSoGDgoy2rDOWFtoWJ7PePTgJpzGK8tfELHAMKkX1ktQrZr4z zIIF74BGt0CE49UGDWwAEJUXotUuw53TTmuM6nyZxyZuuhkyJBhEQNFHhB3sTeBNKW 1teCDxRTdLRj61Z6GTWKPDSj5C5FeS/K/A71B2Mibc29dCg66RjBN4t23WbbqqvZym 7+27oIX/FjJdg== Date: Tue, 29 Nov 2022 21:18:08 -0800 From: Eric Biggers To: Peter Xu Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, James Houghton , Jann Horn , Andrew Morton , Andrea Arcangeli , Rik van Riel , Nadav Amit , Miaohe Lin , Muchun Song , Mike Kravetz , David Hildenbrand Subject: Re: [PATCH 10/10] mm/hugetlb: Introduce hugetlb_walk() Message-ID: References: <20221129193526.3588187-1-peterx@redhat.com> <20221129193526.3588187-11-peterx@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20221129193526.3588187-11-peterx@redhat.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Nov 29, 2022 at 02:35:26PM -0500, Peter Xu wrote: > +static inline pte_t * > +hugetlb_walk(struct vm_area_struct *vma, unsigned long addr, unsigned long sz) > +{ > +#if defined(CONFIG_ARCH_WANT_HUGE_PMD_SHARE) && defined(CONFIG_LOCKDEP) > + struct hugetlb_vma_lock *vma_lock = vma->vm_private_data; > + > + /* > + * If pmd sharing possible, locking needed to safely walk the > + * hugetlb pgtables. More information can be found at the comment > + * above huge_pte_offset() in the same file. > + * > + * NOTE: lockdep_is_held() is only defined with CONFIG_LOCKDEP. > + */ > + if (__vma_shareable_flags_pmd(vma)) > + WARN_ON_ONCE(!lockdep_is_held(&vma_lock->rw_sema) && > + !lockdep_is_held( > + &vma->vm_file->f_mapping->i_mmap_rwsem)); > +#endif FYI, in next-20221130 there is a compile error here due to this commit: In file included from security/commoncap.c:19: ./include/linux/hugetlb.h:1262:42: error: incomplete definition of type 'struct hugetlb_vma_lock' WARN_ON_ONCE(!lockdep_is_held(&vma_lock->rw_sema) && ~~~~~~~~^ ./include/linux/lockdep.h:286:47: note: expanded from macro 'lockdep_is_held' #define lockdep_is_held(lock) lock_is_held(&(lock)->dep_map) ^~~~ - Eric