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 DA7B1C433F5 for ; Thu, 26 May 2022 08:01:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346556AbiEZIBV (ORCPT ); Thu, 26 May 2022 04:01:21 -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-Google-Smtp-Source: ABdhPJwDoYXHfQff5yRn4D7OgwdsNB7fZai9C6375HvH4oaizoEl5HaKAQtrJ59CkBsSddya7lY9xw== 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> 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.