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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 322AFC4345F for ; Mon, 15 Apr 2024 12:18:10 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8D9E76B0089; Mon, 15 Apr 2024 08:18:09 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 88A096B008C; Mon, 15 Apr 2024 08:18:09 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7512A6B0092; Mon, 15 Apr 2024 08:18:09 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 57E596B0089 for ; Mon, 15 Apr 2024 08:18:09 -0400 (EDT) Received: from smtpin11.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id E7A111605A5 for ; Mon, 15 Apr 2024 12:18:08 +0000 (UTC) X-FDA: 82011668256.11.ED6EA37 Received: from szxga05-in.huawei.com (szxga05-in.huawei.com [45.249.212.191]) by imf06.hostedemail.com (Postfix) with ESMTP id CE4BE180020 for ; Mon, 15 Apr 2024 12:18:05 +0000 (UTC) Authentication-Results: imf06.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf06.hostedemail.com: domain of wangkefeng.wang@huawei.com designates 45.249.212.191 as permitted sender) smtp.mailfrom=wangkefeng.wang@huawei.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1713183487; h=from:from:sender: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=F4RGmgNJSpd2wDyO/EftFAGGF8H3UwWVC+MHN4k7Huw=; b=WdFIZSMl23XcOd3ji/zvw2Ql6isCtUY3+hecq4YUhBcC0SD1pFTfOY5wup6qnvOcpaiolT cPvOQQbgS9x0oaIrhZWzwQDxeYj1C/cSCWGsYd7D+FSYzUw05Nsu5cKtjDoW6YC3a/SEQK 8OXz/zHmTRqO1CAW/SEDGLN6a0L8YpQ= ARC-Authentication-Results: i=1; imf06.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf06.hostedemail.com: domain of wangkefeng.wang@huawei.com designates 45.249.212.191 as permitted sender) smtp.mailfrom=wangkefeng.wang@huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1713183487; a=rsa-sha256; cv=none; b=qD6Eo8dcqb7t+PQu8LmC1xLzC2STArTwyl5l+zdzf1i3vKsVLsuNwjrkCVJ7qinIrY8yRX fStqHi++gH7XQH+hVtzJF1F1zXKxrsMpoaXLREHCQbweggG6jXwlzvjYTs4mZWT/k+PsX6 5Lduv5NiqnArHvTh4yWSCUzprYXPkX8= Received: from mail.maildlp.com (unknown [172.19.163.17]) by szxga05-in.huawei.com (SkyGuard) with ESMTP id 4VJ5l86vJmz1GHMp; Mon, 15 Apr 2024 20:17:08 +0800 (CST) Received: from dggpemm100001.china.huawei.com (unknown [7.185.36.93]) by mail.maildlp.com (Postfix) with ESMTPS id 900E71A0172; Mon, 15 Apr 2024 20:18:00 +0800 (CST) Received: from [10.174.177.243] (10.174.177.243) by dggpemm100001.china.huawei.com (7.185.36.93) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.35; Mon, 15 Apr 2024 20:17:59 +0800 Message-ID: <90501d59-e3f2-4ac4-9e42-4eca3bb0a91b@huawei.com> Date: Mon, 15 Apr 2024 20:17:59 +0800 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH rfc 0/3] mm: allow more high-order pages stored on PCP lists Content-Language: en-US To: David Hildenbrand , Barry Song <21cnbao@gmail.com> CC: Andrew Morton , Huang Ying , Mel Gorman , Ryan Roberts , Barry Song , Vlastimil Babka , Zi Yan , "Matthew Wilcox (Oracle)" , Jonathan Corbet , Yang Shi , Yu Zhao , References: <20240415081220.3246839-1-wangkefeng.wang@huawei.com> <54623c8c-a94f-4f88-bf53-5f92c634f78a@huawei.com> <3b931621-7cd1-4df8-9070-535ecaee970e@redhat.com> From: Kefeng Wang In-Reply-To: <3b931621-7cd1-4df8-9070-535ecaee970e@redhat.com> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-Originating-IP: [10.174.177.243] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To dggpemm100001.china.huawei.com (7.185.36.93) X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: CE4BE180020 X-Stat-Signature: p3f395ouhi7e85468c8jat75ht5chqe9 X-Rspam-User: X-HE-Tag: 1713183485-543908 X-HE-Meta: U2FsdGVkX1//n3iR1JLaxidQQQMdS2mgBNJJeK+jLAISrNPLClNeIDz0HMJTLDkVVOC53U/lKD66b3gxZ0VON3/R+AmiTbjXAAnt/kPIqiR+JK8usbVOkc/GXpGWQDTDD9VuoLsdWnFEjb302Zxc24ko+t74ZnIcZRhqy+dHzeL4SEh12G+knEoojgBULEbaIQaDcPRCZ8VxNJ9chqH5WH4q1AIXTRrOMcWVNo1QBMGWUqDa8i7T0t9P1IDx0ChKFfq9/3s2tNyTCscx33dojM1nx7k3BFBQe/UDgeGHzlSSzUjhzeS3BbD9/Y27UbR3HsbJF2xBm786EzIkVjrkSPiAlzrYFZ//DwklOLZtSyDheT7dfXgOnfE8tNFri52KIjDnvSiJzJYPFK9/6fltYx3rSWkbT9vVnGQD+sTpGogvhJqZFyTUleW13d0XfX9KNGRkObZO4pmH5TPlrKrh02fi3H3YBE7RwMRc9Qvaf5NFPuele3TwKjlrddjXfyVwP5r0lreKy/wd+DXEyC3Pweti+ipiXvktPxzRIt0XbX6cJyFMdJvhskb7RmNk+ZW9cc1mjFijsnfyYG8vp3mdlN/Av+nryRUkfHwzkri/83tWKVUolUmtsKrgrhlBDUQQowDEbeYNSxCPM4LrogCFfiYrKpIlfGBShXiKdkMzrt7Ha91RBTMNhV6WHUQf13dxiV8HGEfHvEZ2F+UcHknrRNZl9Sw3hvPlcgsqqMsgbcou1/STYmwcyBd1NXIHAKvnMmKGpU+I8FHY3NV4Mz7n8JYhCZNUviQZkSZgpVzAMKIaW3WZF7McQdclbhR3/JtDZb1A+FqLUWYsYatG5/0uJFNQukLIchEjpwzaNhHVM06uF5WsjnRe96EMuq5whL7alojNoQLu81VHmUgLChPckmeTXNVcGSGGh+SN60shv8XuX4Q+wCx7evHeXiFT9Tbi7hc/zeuntHQvKqaVNPo NlwpG2JN I2PoOQI1ogPCgBK/WTojCsjnG+Kg1FIFalZgiQ6A0yL2S8KQW+ub+5tB21oH+EQxo1Jr/bKIiqbP1dcaJGrwBP1K4N3dRVlUWhjHjYQJGGPl0o8wc7NJie3paGXREOxHjYzqCRsqMbZPqjaI2dA2WVqW+y590k9yCAgkMTgiuPDYEyiP2tZqTmwkLeRnge/HY67oSs3xMx/B3mBA6Ag+dlspZLg== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: On 2024/4/15 18:52, David Hildenbrand wrote: > On 15.04.24 10:59, Kefeng Wang wrote: >> >> >> On 2024/4/15 16:18, Barry Song wrote: >>> On Mon, Apr 15, 2024 at 8:12 PM Kefeng Wang >>> wrote: >>>> >>>> Both the file pages and anonymous pages support large folio, high-order >>>> pages except PMD_ORDER will also be allocated frequently which could >>>> increase the zone lock contention, allow high-order pages on pcp lists >>>> could reduce the big zone lock contention, but as commit 44042b449872 >>>> ("mm/page_alloc: allow high-order pages to be stored on the per-cpu >>>> lists") >>>> pointed, it may not win in all the scenes, add a new control sysfs to >>>> enable or disable specified high-order pages stored on PCP lists, >>>> the order >>>> (PAGE_ALLOC_COSTLY_ORDER, PMD_ORDER) won't be stored on PCP list by >>>> default. >>> >>> This is precisely something Baolin and I have discussed and intended >>> to implement[1], >>> but unfortunately, we haven't had the time to do so. >> >> Indeed, same thing. Recently, we are working on unixbench/lmbench >> optimization, I tested Multi-size THP for anonymous memory by hard-cord >> PAGE_ALLOC_COSTLY_ORDER from 3 to 4[1], it shows some improvement but >> not for all cases and not very stable, so re-implemented it by according >> to the user requirement and enable it dynamically. > > I'm wondering, though, if this is really a suitable candidate for a > sysctl toggle. Can anybody really come up with an educated guess for > these values? Not sure this is suitable in sysctl, but mTHP anon is enabled in sysctl, we could trace __alloc_pages() and do order statistic to decide to choose the high-order to be enabled on PCP. > > Especially reading "Benchmarks Score shows a little improvoment(0.28%)" > and "it may not win in all the scenes", to me it mostly sounds like > "minimal impact" -- so who cares? Even though lock conflicts are eliminated, there is very limited performance improvement(even maybe fluctuation), it is not a good testcase to show improvement, just show the zone-lock issue, we need to find other better testcase, maybe some test on Andriod(heavy use 64K, no PMD THP), or LKP maybe give some help? I will try to find other testcase to show the benefit. > > How much is the cost vs. benefit of just having one sane system > configuration? > For arm64 with 4k, five more high-orders(4~8), five more pcplists, and for high-orders, we assumes most of them are moveable, but maybe not, so enable it by default maybe more fragmentization, see 5d0a661d808f ("mm/page_alloc: use only one PCP list for THP-sized allocations").