Received: by 2002:a05:7412:37c9:b0:e2:908c:2ebd with SMTP id jz9csp2852897rdb; Fri, 22 Sep 2023 10:02:43 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHhZfU3npeMI8d8cbuzi64s/RnU0TAmKlo+QFHgme8tRlMFE8+es8KTR/mGMPIeFZKg5T9c X-Received: by 2002:a05:6a00:cce:b0:68f:cd32:c52d with SMTP id b14-20020a056a000cce00b0068fcd32c52dmr5335pfv.14.1695402162733; Fri, 22 Sep 2023 10:02:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695402162; cv=none; d=google.com; s=arc-20160816; b=GvLRwIYsdw6ivHyUYTeaQuHuLh/5k7IQ9WU4OBbMIMUgMlXw4bgI1n/7A2Fk92ki3w zSCzdwDUtswY5jwm9/+m7xdEK009j5SDo/mGLIwMS68EFeDbC/7YK146t6WpxV/vbKde 271rQv8hYZuVsTPtiafgFi1qcPaTUskghXSrHxy89jpPm9LnYF74Mfa15BcEyR/0leNJ tFeL573TBV62Ip7hBG76E+EyasSW+IVon1NxpEW+/Gz41NUczMOZ2ZNAKsD4mrSXVsRv l741jIaSvNQ3n6sydog1gKnPxNxv2Iwh8XOAa9dl+vCM/cDyaTyxkpyldX4tPNC3oGSD InXw== 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=Yza14izzmzX9DFGrrMMWj4qfz8b3tPM9wOlka8086Gc=; fh=ZLs516Y7qoeT1dAXXeKtHGrayYcnyccj53JY1CFyOaw=; b=K0t46bRYqKIccNtE7Wt+EPv1L2B3tATOJJJaFFOks5a7wGuY3vIh2NIMPRo22sJA8D PlwrK2fJm4mC2UBcPHNxXoA9NyvNB2/Sz2awEXSN5jQ+m34zhNkMyXCP3uqWp4Qrw0Bc xheo24ffoQXhNirgY7yGDUnX7n5oFA9Pa3KNW8k7DsaKX1EZ3NkV4oDo5V588j50Id6Z TyfcxTTBADWd6pUsy2fn5FhjIuNFYGnE5vu/oCRz5ZHjrvEVHcQS0b9kW+cuWeW1O6UG XsHaIP7SOcOrfSBnaaGv1MCkpg50Q7cSMwyo86Ogl2Lph36kGvPjUlTXteMil6NiS7iV Wwdw== 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:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id z186-20020a6333c3000000b00578a66db83fsi3998488pgz.141.2023.09.22.10.02.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Sep 2023 10:02:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 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 lipwig.vger.email (Postfix) with ESMTP id 45B2E82C1323; Fri, 22 Sep 2023 09:57:24 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231310AbjIVQ5Y convert rfc822-to-8bit (ORCPT + 99 others); Fri, 22 Sep 2023 12:57:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34078 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229538AbjIVQ5X (ORCPT ); Fri, 22 Sep 2023 12:57:23 -0400 Received: from shelob.surriel.com (shelob.surriel.com [96.67.55.147]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 70D88F1 for ; Fri, 22 Sep 2023 09:57:17 -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 1qjjSa-00017W-09; Fri, 22 Sep 2023 12:56:56 -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 12:56:55 -0400 In-Reply-To: <20230922164408.GA224968@monkey> References: <20230920021811.3095089-1-riel@surriel.com> <20230920021811.3095089-2-riel@surriel.com> <20230921224201.GB21193@monkey> <20230922164408.GA224968@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=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email 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 (lipwig.vger.email [0.0.0.0]); Fri, 22 Sep 2023 09:57:24 -0700 (PDT) On Fri, 2023-09-22 at 09:44 -0700, Mike Kravetz wrote: > > diff --git a/mm/hugetlb.c b/mm/hugetlb.c > index f906c5fa4d09..8f3d5895fffc 100644 > --- a/mm/hugetlb.c > +++ b/mm/hugetlb.c > @@ -372,6 +372,11 @@ static void > __hugetlb_vma_unlock_write_free(struct vm_area_struct *vma) >                 struct hugetlb_vma_lock *vma_lock = vma- > >vm_private_data; >   >                 __hugetlb_vma_unlock_write_put(vma_lock); > +       } else if (__vma_private_lock(vma)) { > +               struct resv_map *resv_map = vma_resv_map(vma); > + > +               /* no free for anon vmas, but still need to unlock */ > +               up_write(&resv_map->rw_sema); >         } >  } > Nice catch. I'll add that. I was still trying to reproduce the bug here. The libhugetlbfs code compiles with the offending bits commented out, but the misaligned_offset test wasn't causing trouble on my test VM here. Given the potential negative impact of moving from a per-VMA lock to a per-backing-address_space lock, I'll keep the 3 patches separate, and in the order they are in now. Let me go spin and test v2. -- All Rights Reversed.