Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp1364835rwb; Thu, 10 Nov 2022 15:17:30 -0800 (PST) X-Google-Smtp-Source: AA0mqf4zTFsIZZT4f9unSyT0yewJvP64BHVgjx6gt5vTyyvGrrrgVpxcwtfmRn7XscAOVkA8Tq4S X-Received: by 2002:a17:906:aec7:b0:7ae:c1af:a078 with SMTP id me7-20020a170906aec700b007aec1afa078mr397061ejb.294.1668122250390; Thu, 10 Nov 2022 15:17:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668122250; cv=none; d=google.com; s=arc-20160816; b=UNhgbC3CRREuGZFf8gef+8fol9jgZuRbAhOO+nqeF2/Gq1t5/AaLwQC9jc75f2udia nQuh3GXj1xR4DFggngz1tzCs1GutUhw2F4eWB+hvXblS8GUyezdyOkcvapqzSolBK6JA Ypu6JMPDSqNgNeOEHwJdjyBstsTR6GST6iKKUvs/TwelPPixFQnICGfLQc/BM/QdCHAM 7hNnq3pOMJ4ulE8u4shbVKRDVlUjraWvFDe5zzLP+qqB3D+j/dmzKEoYiVOqrYC5eK4Q J+um0tZEj7kHANPvhIIFdJLRAPIWpZir9vydW8Ulamo9FXqS1o0HfsyT5he+z+elSw3+ bKvg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:references:message-id :content-transfer-encoding:cc:date:in-reply-to:from:subject :mime-version:dkim-signature; bh=iHY+kysMGJVbzbEObxWTInmf2L9+jpy/p2OFZ3375RI=; b=qNjfkWf11I3HyHvdJwL3Ukd/DpzWVnNVp3hSudtcZGbks9IGrY2Dx9NZCTyPCf3iAF M0mkLwxTuugbe8GSXe9LMBzAB6/1hA7k4u+TmZ75tSa+7WjESEgr4Mc/GhFpVI6EZ8mZ tjr7exyjMhXAmxwfYjdpwCIibtkRa0RbDxpRXaW+Rkxpl2by8nZcSH08K7GYhNx/z4m5 8LuKAb6QxTHuTw9NAX8Ox9XSeU1FXtKJe948gUX2acBAYEY/XMkhwBSeikbABVdQceRY ne6NLDAnmHCbOSEpqIh7jYlAmp5tMS+VZMSOUVxQ/PFIkncUzX4IhmF/P1Vt5cCaM1ZU LpOQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=WiY7yFDa; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id cw20-20020a170906479400b007add405cccdsi517016ejc.444.2022.11.10.15.17.08; Thu, 10 Nov 2022 15:17:30 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=WiY7yFDa; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231235AbiKJWWl (ORCPT + 92 others); Thu, 10 Nov 2022 17:22:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38828 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231285AbiKJWWh (ORCPT ); Thu, 10 Nov 2022 17:22:37 -0500 Received: from mail-pj1-x1031.google.com (mail-pj1-x1031.google.com [IPv6:2607:f8b0:4864:20::1031]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9447954B2A; Thu, 10 Nov 2022 14:22:36 -0800 (PST) Received: by mail-pj1-x1031.google.com with SMTP id q1-20020a17090a750100b002139ec1e999so3137268pjk.1; Thu, 10 Nov 2022 14:22:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=iHY+kysMGJVbzbEObxWTInmf2L9+jpy/p2OFZ3375RI=; b=WiY7yFDacp64O2Pev/BvEetYI5+ndnbH/0mcVheO1p8LjNYBXlObMkB3N5dVhhoCU3 y+oM+E/QNrEnRv5KY8crf7FtTr8HJj07UnqgLmh5FFixD8jaSWJYV8ScEy8d4zrHj3Zg Mq4anY97G7zF+Qd4O9xBCem99DiQgHh7OYvq5HRSFFQhLwYosO231Nj8+zdDAwXrokhS 9oaqTShTMeMQpR6qiyXoWkE+tn/3/NYcKf/kP+7kz6TBuTMTy7SCdsP5CSi9eOZQTue3 XZl1bp4H6FbFn2eHbkO7RaOCcwyfDw9GeI3ugQT6MEEA9HnF0DWHsQKl5EN2FI4bSdMb U2Iw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=iHY+kysMGJVbzbEObxWTInmf2L9+jpy/p2OFZ3375RI=; b=OOySKm19pJMZZVfqIcuVRTl1bY+IBhc2D6f3c6bKffhc00C+8/R4zEOv4VSEkJl+0x CWWQvJv8Yqd7+08wABAHx7pS2l6DriHO4CxFuyCVJuvU359V9RFF5ZtEbC//c5AchBxL 08AXgn+BcMDM5O53bcmmPBOYNMuMvvyob/M3jkPNna/QFi5nt9ag2UfZ0vbZRdXqSuYd Mk49i9bIRmkTLn3qm8h11DYmsH7eqwL3yedNbEHPTxqWCuGbGrOeuupuYFil34v/ZCM2 DxrIu90ISLsLer9n0ru7FqXiC9w3CKVsCy2aEVjjB3vt7hYgjlralQV9suDKZp3KsbcQ KPGg== X-Gm-Message-State: ACrzQf2pcAOKYU24pCC1bvoodlsJoS/CN/r6yhlrQN5gVO9IhfO4MdDO Q/td8hgVY2fTa5QzaTPQBt8= X-Received: by 2002:a17:90a:6846:b0:20a:c1bf:ad2d with SMTP id e6-20020a17090a684600b0020ac1bfad2dmr2363665pjm.112.1668118955878; Thu, 10 Nov 2022 14:22:35 -0800 (PST) Received: from smtpclient.apple ([66.170.99.95]) by smtp.gmail.com with ESMTPSA id y26-20020a63495a000000b0043941566481sm126737pgk.39.2022.11.10.14.22.34 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 10 Nov 2022 14:22:35 -0800 (PST) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3696.120.41.1.1\)) Subject: Re: [PATCH v8 1/2] hugetlb: don't delete vma_lock in hugetlb MADV_DONTNEED processing From: Nadav Amit In-Reply-To: Date: Thu, 10 Nov 2022 14:22:33 -0800 Cc: Linux-MM , kernel list , Naoya Horiguchi , David Hildenbrand , Axel Rasmussen , Mina Almasry , Peter Xu , Rik van Riel , Vlastimil Babka , Matthew Wilcox , Andrew Morton , Wei Chen , stable@vger.kernel.org Content-Transfer-Encoding: quoted-printable Message-Id: <05FB2C99-9141-4F2A-8664-31CA5587B310@gmail.com> References: <20221108011910.350887-1-mike.kravetz@oracle.com> <20221108011910.350887-2-mike.kravetz@oracle.com> <9BB0EA0C-6E7C-462B-8374-5BFEC34E8415@gmail.com> To: Mike Kravetz X-Mailer: Apple Mail (2.3696.120.41.1.1) X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS 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 On Nov 10, 2022, at 1:48 PM, Mike Kravetz = wrote: >>> void unmap_hugepage_range(struct vm_area_struct *vma, unsigned long = start, >>> unsigned long end, struct page *ref_page, >>> zap_flags_t zap_flags) >>> { >>> + struct mmu_notifier_range range; >>> struct mmu_gather tlb; >>>=20 >>> + mmu_notifier_range_init(&range, MMU_NOTIFY_UNMAP, 0, vma, = vma->vm_mm, >>> + start, end); >>> + adjust_range_if_pmd_sharing_possible(vma, &range.start, = &range.end); >>> tlb_gather_mmu(&tlb, vma->vm_mm); >>> + >>> __unmap_hugepage_range(&tlb, vma, start, end, ref_page, = zap_flags); >>=20 >> Is there a reason for not using range.start and range.end? >=20 > After calling adjust_range_if_pmd_sharing_possible, range.start - = range.end > could be much greater than the range we actually want to unmap. The = range > gets adjusted to account for pmd sharing if that is POSSIBLE. It does = not > know for sure if we will actually 'unshare a pmd'. >=20 > I suppose adjust_range_if_pmd_sharing_possible could be modified to = actually > check if unmapping will result in unsharing, but it does not do that = today. Thanks for the explanation. It=E2=80=99s probably me, but I am still not = sure that I understand the the different between __unmap_hugepage_range() using = (start, end) and __zap_page_range_single() using (address, range.end). Perhaps = it worth a comment in the code? But anyhow=E2=80=A6 shouldn=E2=80=99t unmap_hugepage_range() call mmu_notifier_invalidate_range_start()?