Received: by 2002:a05:7412:37c9:b0:e2:908c:2ebd with SMTP id jz9csp2764626rdb; Fri, 22 Sep 2023 07:51:24 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF4tNxM8G7sGBb/BxVHY7sApZq3DzFnQBQ7LitfoscARNqs/PtmRdA6CQUHFbSX2qc4MkBF X-Received: by 2002:a05:6a00:1813:b0:682:537f:2cb8 with SMTP id y19-20020a056a00181300b00682537f2cb8mr11125535pfa.26.1695394283748; Fri, 22 Sep 2023 07:51:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695394283; cv=none; d=google.com; s=arc-20160816; b=AfemMld0Rs4IMz3vS/c1IkYCJ0VqPBGdGLxtP92XkMNYi/h38uGtWie6BGaK7e84Qq tZvnKy+y5KdyMirbQmx4iRHmgLnKcpw19SKG0i/3zeNRL4oR7NscC+PqHTALRxGZazKt StrlTOQoDxOIwAFF5xjmMmyuH3nExJXtuXtP6zjOVUJFNHhySLmyQxpVpwYw2DYfCifO fTCFEY+CMY8WMcs14ibxyepWL9AhzsG8ERYTKnh6FXXxAdmezAD57n8MKm61V1xluhfA FVo6GAKsspaNSzyNf+Y9HdccY/Wn6YdekypScvWED2pWygURtL/Qb61v/ojM8V3lq0dQ xHNw== 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=GYJT1/XNzOr+vpXRRiW2lIFnTzKk9z3MRIGWLOSuXt4=; fh=ZLs516Y7qoeT1dAXXeKtHGrayYcnyccj53JY1CFyOaw=; b=r10hEpANwpVCJlJxtBua1NC5/3ymOlzAQ0NZZO1S+WTaAhpCVXB/FvkIVUJPA5Ya7V gslfpOBaUoULrLOL8hv9GlwzJHqEFE/SqAceDaz9nFtGm18pkG3emvdvM7UlvbOQ50sM SnkYpDCEZYriCB89ScJfPXZRFCjtbWugfoY6MYnEKbn1ZOufyHYy692wljc3oCqk0McV 13pzU/c6wEowGBXEfxIa8LdE+1H5IWE92uoIU4UAEiPiJSYyclZ2gqhSJwk+P/FIPntD fvhG1udm7NSHS1STMNPyzZdnMiPQW2h2xZFvv/tR30+hThWhhSnN8g3LRjfqTAgqqhzL lJ6g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id ct27-20020a056a000f9b00b0068e48477befsi4096958pfb.211.2023.09.22.07.51.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Sep 2023 07:51:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 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 howler.vger.email (Postfix) with ESMTP id 66B108567E6F; Fri, 22 Sep 2023 07:38:30 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230457AbjIVOic convert rfc822-to-8bit (ORCPT + 99 others); Fri, 22 Sep 2023 10:38:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46338 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230403AbjIVOia (ORCPT ); Fri, 22 Sep 2023 10:38:30 -0400 Received: from shelob.surriel.com (shelob.surriel.com [96.67.55.147]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D2031100 for ; Fri, 22 Sep 2023 07:38:24 -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 1qjhI3-00082q-1q; Fri, 22 Sep 2023 10:37:55 -0400 Message-ID: Subject: Re: [PATCH 1/2] hugetlbfs: extend hugetlb_vma_lock to private VMAs 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 Date: Fri, 22 Sep 2023 10:37:55 -0400 In-Reply-To: <20230921224201.GB21193@monkey> References: <20230920021811.3095089-1-riel@surriel.com> <20230920021811.3095089-2-riel@surriel.com> <20230921224201.GB21193@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_NONE, 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 (howler.vger.email [0.0.0.0]); Fri, 22 Sep 2023 07:38:30 -0700 (PDT) On Thu, 2023-09-21 at 15:42 -0700, Mike Kravetz wrote: > On 09/19/23 22:16, riel@surriel.com wrote: > > From: Rik van Riel > > > > Extend the locking scheme used to protect shared hugetlb mappings > > from truncate vs page fault races, in order to protect private > > hugetlb mappings (with resv_map) against MADV_DONTNEED. > > > > Add a read-write semaphore to the resv_map data structure, and > > use that from the hugetlb_vma_(un)lock_* functions, in preparation > > for closing the race between MADV_DONTNEED and page faults. > > > > Signed-off-by: Rik van Riel > > --- > >  include/linux/hugetlb.h |  6 ++++++ > >  mm/hugetlb.c            | 36 ++++++++++++++++++++++++++++++++---- > >  2 files changed, 38 insertions(+), 4 deletions(-) > > This looks straight forward. > > However, I ran just this patch through libhugetlbfs test suite and it > hung on > misaligned_offset (2M: 32). > https://github.com/libhugetlbfs/libhugetlbfs/blob/master/tests/misaligned_offset.c Speaking of "looks straightforward", how do I compile the libhugetlbfs code? The __morecore variable, which is pointed at either the THP or hugetlbfs morecore function, does not seem to be defined anywhere in the sources. Do I need to run some magic script (didn't find it) to get a special header file set up before I can build libhugetlbfs? $ make CC32 obj32/morecore.o morecore.c: In function ‘__lh_hugetlbfs_setup_morecore’: morecore.c:368:17: error: ‘__morecore’ undeclared (first use in this function); did you mean ‘thp_morecore’? 368 | __morecore = &thp_morecore; | ^~~~~~~~~~ | thp_morecore morecore.c:368:17: note: each undeclared identifier is reported only once for each function it appears in make: *** [Makefile:292: obj32/morecore.o] Error 1 $ grep __morecore *.[ch] morecore.c: __morecore = &thp_morecore; morecore.c: __morecore = &hugetlbfs_morecore; -- All Rights Reversed.