Received: by 2002:a05:7412:2a8a:b0:fc:a2b0:25d7 with SMTP id u10csp278424rdh; Wed, 7 Feb 2024 04:46:23 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXiN/bV6PlVxTw/yBYaw/8zZS8oIdCabNK4apTmoIlj+Br0CZmex1j6OkP95m9hczLK63Vs/6Lnss8l2sZhB6saccwrPbL4wol5Xx3flw== X-Google-Smtp-Source: AGHT+IEuA9aYTGcRQ9Y+OoutTPjvr3cikn9v7cjHTnacztIjeQYw8er4JP7UeBZer4yKx80FjVc9 X-Received: by 2002:a05:6870:1696:b0:219:c8ea:ecfd with SMTP id j22-20020a056870169600b00219c8eaecfdmr2335248oae.15.1707309983385; Wed, 07 Feb 2024 04:46:23 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707309983; cv=pass; d=google.com; s=arc-20160816; b=PUjIMfRYr6jDA64TXJkPIzz2jTCxfrSwe3mb/oDWS8Spq8myL7KCseWD/+iRNGe4C9 qmwq68VbQtA9YKFVILvVp72fjUz3uhQh0RFQfO4x58eDPRhCYPXl1X1dt4+avWhCMTqu 212Jl2+GWEgFoN7RDa4sixdg10caoTqH6U14M1dDzeejHdigaGKUGvKXcNtEANV0tSLD KhFh/PSdd+AiXmfn05YRBYs1fzkh3JAv7PcRb+BDmyAklh38Zkz+s39Y5Nr4NM7IbUZR lsyxWfU8lAu0z7lq+hfuKK9YkQWVayUxmX3oBRhwxOA2WNUwgdqOkduh4bP80AZGHFm3 07ew== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:message-id:subject:cc:to:from:date; bh=+EIYK1IWY3/M1CvOOaeGgB9HdC/drk2D42ROjbBIQ08=; fh=J7hoT5IgfZT+OnL0g9CGFMz7aQJhInxZZGlEiQdGt3g=; b=PGZ3qjHgvZctUbmYTRyhMi0GZ6s+XXmTC8vcbDgvpb7p+1YQI07XiGRgusBhaGSylt QwUcR3LVQiewsLWnavfsnCTRe0n8qKakyiiUx+9OM+fTy6RtjnGVaMQEWqRGfrVuL2L6 4d+0IKXsKoyGw4mbpTrZqXFOQpgmUSFoE/h/ICA7LfoMKBRtWOuKKTRoGCcR+t0QtUq+ L9iirkTlodfHdQW9VLlRAhh621805IZh1h7xd1QICAlyI+B+ExaIia/yJQhdrI0uBD13 OybQNqrYimD+Sn+M2+W/NC84L0uOBabdslA7513KVLu8epJt34LWIo9luKgwtek/9Esw uArw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-56495-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-56495-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com X-Forwarded-Encrypted: i=2; AJvYcCWXeFrT04AtCVLkN3uP/yYKkdh1A6emw3EBvl4g7KCzMPrUxaUQ0bSjGHeZ+4OSQuy2CCFd40Ziun9haThFsOYf/ukhIMIlfc5CvMeCzg== Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id w18-20020a63af12000000b005d8b6894062si1409332pge.653.2024.02.07.04.46.23 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Feb 2024 04:46:23 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-56495-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-56495-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-56495-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id DC15C288405 for ; Wed, 7 Feb 2024 12:44:59 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 01B6C76036; Wed, 7 Feb 2024 12:44:53 +0000 (UTC) Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 800565A0FE for ; Wed, 7 Feb 2024 12:44:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707309892; cv=none; b=bLIXcQnTo7DK0ybQOllli/xQsv4tMSwj4wiEWXWHB1FbS3CBatusPb94efjrDp6XADfpK34vS0S9yPKxrAzNPMbIS22porW2dq0Ie7fkGExIib4P0lElD2UlWmfLwspukBS4tXbPV90XuDlNjielTFav224Q1ZPmPO24apsECa8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707309892; c=relaxed/simple; bh=tYbPcf5/6y9sgM4sHZP3ACfjVZvEn18ioeEU0QslSmk=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=BA0M25swm2Ty9T/QQSfyCiXfXgP3gRvP55GLOnGsGCYKDWI8Hww+wCH4shbT4B0DVgz85/evbqB3fqvbpCEYrjNiuRJduXuhv/2Euvn2NXP5fxXpz8TRvM+6/I/bzSTptmoz7VwPDe676P2tgPWQBVrqc3LBLSyaegAa5o2diG4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 21937C433C7; Wed, 7 Feb 2024 12:44:49 +0000 (UTC) Date: Wed, 7 Feb 2024 12:44:47 +0000 From: Catalin Marinas To: Nanyong Sun Cc: will@kernel.org, mike.kravetz@oracle.com, muchun.song@linux.dev, akpm@linux-foundation.org, anshuman.khandual@arm.com, willy@infradead.org, wangkefeng.wang@huawei.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: Re: [PATCH v3 0/3] A Solution to Re-enable hugetlb vmemmap optimize Message-ID: References: <20240113094436.2506396-1-sunnanyong@huawei.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: On Sat, Jan 27, 2024 at 01:04:15PM +0800, Nanyong Sun wrote: > On 2024/1/26 2:06, Catalin Marinas wrote: > > On Sat, Jan 13, 2024 at 05:44:33PM +0800, Nanyong Sun wrote: > > > HVO was previously disabled on arm64 [1] due to the lack of necessary > > > BBM(break-before-make) logic when changing page tables. > > > This set of patches fix this by adding necessary BBM sequence when > > > changing page table, and supporting vmemmap page fault handling to > > > fixup kernel address translation fault if vmemmap is concurrently accessed. [...] > > How often is this code path called? I wonder whether a stop_machine() > > approach would be simpler. > As long as allocating or releasing hugetlb is called.? We cannot limit users > to only allocate or release hugetlb > when booting or not running any workload on all other cpus, so if use > stop_machine(), it will be triggered > 8 times every 2M and 4096 times every 1G, which is probably too expensive. I'm hoping this can be batched somehow and not do a stop_machine() (or 8) for every 2MB huge page. Just to make sure I understand - is the goal to be able to free struct pages corresponding to hugetlbfs pages? Can we not leave the vmemmap in place and just release that memory to the page allocator? The physical RAM for those struct pages isn't going anywhere, we just have a vmemmap alias to it (cacheable). -- Catalin