Received: by 2002:ab2:60d1:0:b0:1f7:5705:b850 with SMTP id i17csp572454lqm; Wed, 1 May 2024 09:08:21 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXAb0cnOcxYzPjuLieN7k9sccJCIrflCTd0IJ1t9NGcNkH5EWAOWfKzzoLfLfPP+JdsF1d3Jvjtj27KyWXQnYYteMfaj470fYRCc0QRJQ== X-Google-Smtp-Source: AGHT+IFB9ygw9Md+9VTNLp4TngVK+eSHsadyPce20A1kHSyWdHoN9N0a6BDZWneEif3+q24lft1z X-Received: by 2002:a9d:64d2:0:b0:6ee:39be:e576 with SMTP id n18-20020a9d64d2000000b006ee39bee576mr3181847otl.1.1714579701594; Wed, 01 May 2024 09:08:21 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714579701; cv=pass; d=google.com; s=arc-20160816; b=zGd5Totvrghej4QwTUfnIOnGE/RyJp2ecYOHSnUO+e97X+kc3e++ae0j1ah3vlmCKp slygILCIjom9IOFS7r4JUGffgXPx6KTekMsFt5icLeG1pbx04uKBjq+To/pnutj30cVV NQNE6IB2xR+P7RR5s3kPXvVf1FsvDJSm/0K9IGdbrdgRn3EgSd144U+XggBE+nBzaTGl W2U64KQ4AG2NTgJ/OgnlMaaNQyqKsAkERltQKmVbTwtjuVFCvuBsnl4VLWywqtAyx7Ot 9GzIBKMNgRBWJMps+wY5fh4QflP4zTviLrZHl+hzuX1N9BeJO8W4LD4IQwxG3ai2x4s4 QSFw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=Ed0/M615snFNcJ9BDnnzSLRF5L6rBaUe+KQVQxDjZvQ=; fh=+58AZzl2A7NeA2BSN/OwGNgeEKMdaD5Oi4rsec00FaA=; b=Oo0DmRgO8IbpKTUY7UIXgs0oHpQurSt4mBjjS548GIHHceRzc/jSoT7XmhBfT48yGr SYqm39fiZBGaR/8kpgs/PCsGNRTHkM8s8TdP2tZdl4NtenILgUIlasVOlN7dw3KwKul5 QHIhjZj7r9oUoJUTDX4nyReXaH0a38L17Q8k5SkgCwa3C1fUturdsCKLi1Fh4zqSB9HF dczg1Bz780eFbPuZ6YmSpGd/W6Xn3Kg6u5Pz0NXkARb686dQrIUc8VRLB71Hk0mC4mXZ wwBeEt0pfNrffWl8mqefkCvAVhTkuLunt+IJuFvH6Z2Fmh+5vKwNFl9ZQnF6GxjjeA/U MtEw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="AoJ5YH/M"; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-165541-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-165541-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id eg10-20020a056122488a00b004dcfe97341asi5660518vkb.60.2024.05.01.09.08.21 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 May 2024 09:08:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-165541-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="AoJ5YH/M"; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-165541-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-165541-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org 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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 47DBB1C21500 for ; Wed, 1 May 2024 16:08:21 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C05B912FF8E; Wed, 1 May 2024 16:08:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="AoJ5YH/M" 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 E6A4C4CE1F for ; Wed, 1 May 2024 16:08:06 +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=1714579687; cv=none; b=OzjTa7fWzRIrwD3obwdZDGEemU7x1wPKDNsLC0cUiUj0XYPFwFoObnQNGzG0qg2SSL7m4LsoGs/QBGLdrNpVCKDiDvYDEF95ZIMX5Fz6vC1sd7PybjkQL3qqk5D27e+25uYd+H6blxXnIS79WEBq2rwhBZOjid0J3YM/Fo29DL4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714579687; c=relaxed/simple; bh=mStrog2oMrxkyglXae6P8Wt6hb3v6cHyjuBTYN/mI7A=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=p+dkAR/fhz8Qh3ISQcvoNYb6JiZjpoPPNb+RK6NhyDVFo51DS5lyMnrEkwPfTdV70rBCuRr+47yCjDOgTI3A/8yedfEE0GEbttiPa6dpvwFb/2g5kpAUMZxEJCN1uTtyh28a431Dn8bB1Ga0Wly1KRn0VT9+G8AcfCsi5uAmacw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=AoJ5YH/M; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 00C9DC113CC; Wed, 1 May 2024 16:08:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1714579686; bh=mStrog2oMrxkyglXae6P8Wt6hb3v6cHyjuBTYN/mI7A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AoJ5YH/MqGf6uSCzNJ0ET0mIDAHqieqnDjfEjSGdAwHSC6WGhTEQjXMjXwxs6HcKG uvEsDHXWz7WT/EZbQn7uILo940XO1L5EBH4Ty60X1kftIIEGbpXEejp4jZv5ztg+Zx /gC+n5v6KvctbSy00csdX7/Ng02LV2G7CUlyMKjBXDOUBkgFxQKlhxyraUtPV3oyRA qKQAFEfpwZo0mGeVZojF9LMXkMLn/6A7aDx4t1mM+dGV2A1XzrDhbB4e5hukAN7DKc 9Gdr1TrHFnpalexcq+zWVEOY2jcMDL3255Sc9+wxUKOOtLuDsnhrGqzqtoNl9gDl6M iTXpNF6wbpJqg== From: SeongJae Park To: Lance Yang Cc: SeongJae Park , akpm@linux-foundation.org, willy@infradead.org, maskray@google.com, ziy@nvidia.com, ryan.roberts@arm.com, david@redhat.com, 21cnbao@gmail.com, mhocko@suse.com, fengwei.yin@intel.com, zokeefe@google.com, shy828301@gmail.com, xiehuan09@gmail.com, libang.li@antgroup.com, wangkefeng.wang@huawei.com, songmuchun@bytedance.com, peterx@redhat.com, minchan@kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v4 0/3] Reclaim lazyfree THP without splitting Date: Wed, 1 May 2024 09:08:03 -0700 Message-Id: <20240501160803.60988-1-sj@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240501042700.83974-1-ioworker0@gmail.com> References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Hi Lance, On Wed, 1 May 2024 12:26:57 +0800 Lance Yang wrote: > Hi all, > > This series adds support for reclaiming PMD-mapped THP marked as lazyfree > without needing to first split the large folio via split_huge_pmd_address(). > > When the user no longer requires the pages, they would use madvise(MADV_FREE) > to mark the pages as lazy free. Subsequently, they typically would not re-write > to that memory again. > > During memory reclaim, if we detect that the large folio and its PMD are both > still marked as clean and there are no unexpected references(such as GUP), so we > can just discard the memory lazily, improving the efficiency of memory > reclamation in this case. > > Performance Testing > =================== > > On an Intel i5 CPU, reclaiming 1GiB of lazyfree THPs using > mem_cgroup_force_empty() results in the following runtimes in seconds > (shorter is better): > > -------------------------------------------- > | Old | New | Change | > -------------------------------------------- > | 0.683426 | 0.049197 | -92.80% | > -------------------------------------------- > > --- > > Changes since v3 [3] > ==================== > - mm/rmap: integrate PMD-mapped folio splitting into pagewalk loop > - Resolve compilation errors by handling the case where > CONFIG_PGTABLE_HAS_HUGE_LEAVES is undefined (thanks to SeongJae Park) I confirmed that the issue I reported before is disappeared with this version of the patchset. For the fix, Tested-by: SeongJae Park Thanks, SJ [...]