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 2BB5AC001DC for ; Wed, 19 Jul 2023 03:36:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229555AbjGSDgh (ORCPT ); Tue, 18 Jul 2023 23:36:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55928 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229454AbjGSDge (ORCPT ); Tue, 18 Jul 2023 23:36:34 -0400 Received: from out-17.mta1.migadu.com (out-17.mta1.migadu.com [IPv6:2001:41d0:203:375::11]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6CD06A4 for ; Tue, 18 Jul 2023 20:36:33 -0700 (PDT) Content-Type: text/plain; charset=us-ascii DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1689737791; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=9/bKdSl4bL/ALz46t3piE5f2eCd5ENeQ8V1dbQqCg9c=; b=qTMC2PfZJIX6ph5q/BQMb7swLil9bXc6mnr4B99vRzZ+6MFfqW+rxOLWHjdtrzlwUfXsUK u6s5XHVNbse7WX/9Fprhd6EKbW3t+64IhHP43mIWQyzpXJ/7ytTKH4pUA362YCrmmN8a89 qtXXBcLfZjBeb5AXF7KfaIN25KCsbc4= MIME-Version: 1.0 Subject: Re: [PATCH v2 2/2] hugetlb: optimize update_and_free_pages_bulk to avoid lock cycles X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Muchun Song In-Reply-To: <20230718004942.113174-3-mike.kravetz@oracle.com> Date: Wed, 19 Jul 2023 11:35:44 +0800 Cc: Linux Memory Management List , LKML , Jiaqi Yan , Naoya Horiguchi , Muchun Song , Miaohe Lin , Axel Rasmussen , James Houghton , Michal Hocko , Andrew Morton Content-Transfer-Encoding: 7bit Message-Id: References: <20230718004942.113174-1-mike.kravetz@oracle.com> <20230718004942.113174-3-mike.kravetz@oracle.com> To: Mike Kravetz X-Migadu-Flow: FLOW_OUT Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > On Jul 18, 2023, at 08:49, Mike Kravetz wrote: > > update_and_free_pages_bulk is designed to free a list of hugetlb pages > back to their associated lower level allocators. This may require > allocating vmemmmap pages associated with each hugetlb page. The > hugetlb page destructor must be changed before pages are freed to lower > level allocators. However, the destructor must be changed under the > hugetlb lock. This means there is potentially one lock cycle per page. > > Minimize the number of lock cycles in update_and_free_pages_bulk by: > 1) allocating necessary vmemmap for all hugetlb pages on the list > 2) take hugetlb lock and clear destructor for all pages on the list > 3) free all pages on list back to low level allocators > > Signed-off-by: Mike Kravetz Reviewed-by: Muchun Song Thanks.