Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp327873ioo; Thu, 26 May 2022 04:46:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyPNbwkng8SfGmp8P+McjljML07zhYBgLFTXsu7kUf2YecTwiN3Em82I4jwtLtDufy9UPGs X-Received: by 2002:a17:907:1b24:b0:6ff:235c:2ffd with SMTP id mp36-20020a1709071b2400b006ff235c2ffdmr2786363ejc.116.1653565566593; Thu, 26 May 2022 04:46:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653565566; cv=none; d=google.com; s=arc-20160816; b=IhTv3BfS47IeWni6Lx/vMLzsoYV8jEnzlJI8yEAIvP7dpiFg1/9FJUZIuZdqggUw/z 21LROly6ilMa5KrDiASZuB7eannDpQHBtdRo2hDfA+e0vDp4OPMDHPnx//sJZIa1n+fh bM7i+dAhzWd8k8cWj3L/q08SJ5vM5hpOyAJGyGmNu9pEZ08RexaCYxL7Wt3MZF2bp9zo 5IKS7ElKjQsxoEP1yvE7c0Cd7kT12XQgyQ6jloyHH4815fOzNAaJRoBcO0ByvI7zxNe4 j4BKADEkWnU6jBm7ca9AWdRimq7CiafkLpCNEE8libz4M7Z6fSt3oT8PGMSIkmVEXaDl NX2g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=cPBo1/z66AxJUif/4bPiA1dLl6Egi0hfAP6GvoU1sV0=; b=xoI8j4YPwLdRkhFHfKq/35b1qfPGT0uZxFMK++Vg4HO6SQgWMzLKnU1BEXKbzHcLx6 eqKseDbN+dtxKDjhH59i2STP0joXzAncPuOiwE4HfmrdAcFId/ShPNFDpOQBqfZtXLFZ gk1Bk8C5m0AWZGpxYTdIkGozT/JmMOZL44wscsXlUt7VtMQavKn7uEHxLIxcUeJ8/BDq gfM1ewblSeHhM1NBckFq5uf1fFVM3/KSMrtLygATfIxC+Y8106VJG+BVHWwnkBc9C5aV X8bKWQTvkdLWyf6oEY7tJHorPMyPTRLh0n0XiCz+ZgeDXkRZXK08T3oDZHHWDtt8K/94 kxOg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bytedance-com.20210112.gappssmtp.com header.s=20210112 header.b=6NDxIR+6; 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=fail (p=NONE sp=NONE dis=NONE) header.from=bytedance.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a13-20020a509e8d000000b0042bd6c3e7c0si1264915edf.448.2022.05.26.04.45.40; Thu, 26 May 2022 04:46:06 -0700 (PDT) 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=@bytedance-com.20210112.gappssmtp.com header.s=20210112 header.b=6NDxIR+6; 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=fail (p=NONE sp=NONE dis=NONE) header.from=bytedance.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346548AbiEZIBT (ORCPT + 99 others); Thu, 26 May 2022 04:01:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43364 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346547AbiEZIBS (ORCPT ); Thu, 26 May 2022 04:01:18 -0400 Received: from mail-pj1-x1032.google.com (mail-pj1-x1032.google.com [IPv6:2607:f8b0:4864:20::1032]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9EA37B58 for ; Thu, 26 May 2022 01:01:14 -0700 (PDT) Received: by mail-pj1-x1032.google.com with SMTP id w2-20020a17090ac98200b001e0519fe5a8so1085483pjt.4 for ; Thu, 26 May 2022 01:01:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance-com.20210112.gappssmtp.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=cPBo1/z66AxJUif/4bPiA1dLl6Egi0hfAP6GvoU1sV0=; b=6NDxIR+6uUjB7dCwGwcfqdek2+lKlTwfSd4MrrZtOi2+ClUTwfkElbtFD8Eis/0Y0K 4yzinANtUEfNW6aZ5PgGrCpUDiKmjpMuxDDBuBoNx8J+Ltp630gvBrHk6vVEHJODIJqT H2C/fYRd3/28omWbOUzOTnBOAqisf5q8P8Y/ff38fXBVnD4uQD/pu+t/NpvE0qOca6fs 87xzlWTEWFqJeIeqSbDGWHVKqe55zklRpv5o1vKs3+qVQ1s0PyaJIInHW2j4r6Nl7LIZ AqFFcCAYF6n1O5RWdxeTBQYS3DQrroQd6sGgvQCswwxKGSPNyTvhFHu6XWONMl6wHyJC IhDQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=cPBo1/z66AxJUif/4bPiA1dLl6Egi0hfAP6GvoU1sV0=; b=BsCGtwABshzULgw0mpBGmVGP4plDtHTNeXki3QG0cWPmvR6xJ8GINy2CuWELAqewad aFhQYyGA9MD1tiKU2pyNC5W8dbuic38WgezTYeaYs0TFP1kr6eeEIgR6zGjvfafQJqS0 Ee19GOQOZhNAZh2QVvPHyR29idyQvFRQ1sF5sqGWNl8/W6o1xNQ/PXMdSEdguX7Y7C8w XSPIKhhpk68NUDtvfXPbgaeWUmNMv6DDh2AtpKEkw0WK4EzH+jgnKj9v25WSnvdAm91D zBkp5i8jD3IBnBDFSbyt5U8PBwnjAdptYGHV8qLqlfbMrkNuGFfcyuY/xLfle658edGF /lyQ== X-Gm-Message-State: AOAM532Va+DdsvnE5iTWA9XIOyyQ6XKHx3K9znpDJplQBJ0bWZ64ISPU xf1ouMiJKHooShs6actXpFDZfhlztoVHcqWL X-Received: by 2002:a17:903:240b:b0:14b:1100:aebc with SMTP id e11-20020a170903240b00b0014b1100aebcmr37188416plo.133.1653552074176; Thu, 26 May 2022 01:01:14 -0700 (PDT) Received: from localhost ([139.177.225.238]) by smtp.gmail.com with ESMTPSA id e14-20020a170903240e00b0015e8d4eb1fasm806650plo.68.2022.05.26.01.01.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 May 2022 01:01:13 -0700 (PDT) Date: Thu, 26 May 2022 16:01:10 +0800 From: Muchun Song To: Mike Kravetz Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Andrew Morton , stable@vger.kernel.org Subject: Re: [PATCH] hugetlb: fix huge_pmd_unshare address update Message-ID: References: <20220524205003.126184-1-mike.kravetz@oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220524205003.126184-1-mike.kravetz@oracle.com> X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE 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 Tue, May 24, 2022 at 01:50:03PM -0700, Mike Kravetz wrote: > The routine huge_pmd_unshare is passed a pointer to an address > associated with an area which may be unshared. If unshare is successful > this address is updated to 'optimize' callers iterating over huge page > addresses. For the optimization to work correctly, address should be > updated to the last huge page in the unmapped/unshared area. However, > in the common case where the passed address is PUD_SIZE aligned, the > address is incorrectly updated to the address of the preceding huge > page. That wastes CPU cycles as the unmapped/unshared range is scanned > twice. > > Cc: > Fixes: 39dde65c9940 ("shared page table for hugetlb page") > Signed-off-by: Mike Kravetz Acked-by: Muchun Song Thanks.