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 630BBC4345F for ; Mon, 15 Apr 2024 08:59:30 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E817F6B00A1; Mon, 15 Apr 2024 04:59:29 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E314D6B00A2; Mon, 15 Apr 2024 04:59:29 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D20D66B00A3; Mon, 15 Apr 2024 04:59:29 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id B7A826B00A1 for ; Mon, 15 Apr 2024 04:59:29 -0400 (EDT) Received: from smtpin23.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 6F70E404D1 for ; Mon, 15 Apr 2024 08:59:29 +0000 (UTC) X-FDA: 82011167658.23.C9DF9EC Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by imf22.hostedemail.com (Postfix) with ESMTP id 4ABE0C0007 for ; Mon, 15 Apr 2024 08:59:25 +0000 (UTC) Authentication-Results: imf22.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf22.hostedemail.com: domain of wangkefeng.wang@huawei.com designates 45.249.212.187 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=1713171567; 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=jG9b4tp2iqoPqz0BKNTgj6LLh18hmWKcvIjjXSjp/Ok=; b=Z3OsIJwPCCZ1njILXVsOSp9Odqta+nwez3vcocjIxAWy/NI4A7TqaAZ9aZjaXiv8ZTNXaZ 0iyUNF8zOU+MjzW658n3Dar5zj2AnM9g6TCwU1i0A/T14kD7w9eKnBVfMw4T7Y1uJDfXyj QuqxWBhn4aRivVZ5c37PB+g8DQFovUM= ARC-Authentication-Results: i=1; imf22.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf22.hostedemail.com: domain of wangkefeng.wang@huawei.com designates 45.249.212.187 as permitted sender) smtp.mailfrom=wangkefeng.wang@huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1713171567; a=rsa-sha256; cv=none; b=L0RYAlaq4EpcDJww+JODRYoeIXTC4M2F9cVRBwbv1IvxNjOBiUTeLIIfXWfHy98zqvTuo3 6MLELtp8W5Q8rOd1rImqEjL/B6XixLyH8O2JEROfWwhrQ7Q/mnOFEwyzaEC8sIZ58kM7cK ooYBp37kroQNjXmXECvSdvfMJlenzpk= Received: from mail.maildlp.com (unknown [172.19.163.48]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4VJ1Hh0Tg4ztTD2; Mon, 15 Apr 2024 16:56:32 +0800 (CST) Received: from dggpemm100001.china.huawei.com (unknown [7.185.36.93]) by mail.maildlp.com (Postfix) with ESMTPS id E08DD18005D; Mon, 15 Apr 2024 16:59:21 +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 16:59:21 +0800 Message-ID: <54623c8c-a94f-4f88-bf53-5f92c634f78a@huawei.com> Date: Mon, 15 Apr 2024 16:59:20 +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: Barry Song <21cnbao@gmail.com> CC: Andrew Morton , Huang Ying , Mel Gorman , Ryan Roberts , David Hildenbrand , Barry Song , Vlastimil Babka , Zi Yan , "Matthew Wilcox (Oracle)" , Jonathan Corbet , Yang Shi , Yu Zhao , References: <20240415081220.3246839-1-wangkefeng.wang@huawei.com> From: Kefeng Wang In-Reply-To: Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-Originating-IP: [10.174.177.243] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To dggpemm100001.china.huawei.com (7.185.36.93) X-Rspamd-Queue-Id: 4ABE0C0007 X-Rspam-User: X-Rspamd-Server: rspam04 X-Stat-Signature: 9x67w39qjuubnaupkg5w7wmu6opq9fyd X-HE-Tag: 1713171565-698985 X-HE-Meta: U2FsdGVkX1+Z4IBkaHrFAy6aqVbPrmJE1n/t3Uk/9zcAbjHWmw4EpDkQfzHMrG0U/fGC2Ti6Mj3BxhDfZhx2d2uzU35Sex40nUcuqlPfXd+L51sIRjrI9soGwQSrBXups46dRpc/kNyBR7iqyCKe0KFiYedyE4fwBwCP8kbQeXGUAOzdTgu7uUN6qjA5M9j6UcjUshBsaa4z3/qT4G57HgRC65BR5edR+SPfgIg5fAzqb1DqryOHg9N/Q6FkJiLAcmGv7rSx5eD9tuOjti+E+OIE4lfBT8UXtqdYJOV9yD9AGDZj7s4vh/XlCo0Er7M3bqHXxvsp3QH9xKUm1gfDF/NV6DNRsx/yJPHtV8IPLS/MfimcpVYIbtr1q8W6IItkvzUGGEomhSIjo0NeiemtXkov/nFp5+J78IthzD0GiRbN+DCr542ov56d/srCr62ZWLwogkY8I4Qp8TkETOOVqsi4n2D+0Y2s8c+cpP86zmex0hWr1rUgYjTpgjNv1gB1ZDuAQHHzVkUR3SQdGYW/pmRBovPYoHNF9n75lcItfLGGQcMOnz85XaNDt/5bys7KcAj0AzyNxAx7YpNLsq6mqQPze3TSI2BqwbI8W4TX2667gSbrPJ2LhBr85A+H8UVXr9dEz6WETlhU13GQw3RXe8vT9WyZNiQJNDYitsQgI7LeF4xyaDWG6zxi6qffEGhR+RoRFaCL58QJokgQacWpeRaBPm4XN0cyxls6tJuUNieJ7MiSJJ/MoM940zDQVHIWK80UvxgL9v0L+WdocG3xWeK95wONq5tY5TfPd3DNxGoeUArfpenvpPpOkyXPLZJJINu/F2rWCsU97JX02omldE8Rk+KhjoTTheOFbrAzk12fW32FWun2ClzFmMqJHHlOhoxKgmepKgatciRMmueeh46EN55DTvcrOVw2i2yZIULGwTDTNgZToQizrin1fDruVSJfxnvtvyz8IS62UQI Cyb9B+a5 lRJzE7jI2kUn/w8KKIaMTUzLAWOw1FGqTuleokplumJd7oLmJA+paZJS05f+ScztTW9gV86itkiJnq+kCQjJ634vEB44bnrSO//jswcA3zwAtm+dKxcEpHWrPun+SCurUMs54lzefWSy7+dCKuo+GGv9vLZE6wUCMW+HVgscuuVHxqQv7mU+nfkvuIrw5PtSKkkreO2xvliPymWLDbThmwvgsic0LeSUreXzZy2nc0tnVW69v6atTiF/JspeYrISzSU8K 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 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. [1] https://lore.kernel.org/linux-mm/b8f5a47a-af1e-44ed-a89b-460d0be56d2c@huawei.com/ > > [1] https://lore.kernel.org/linux-mm/13c59ca8-baac-405e-8640-e693c78ef79a@suse.cz/T/#mecb0514ced830ac4df320113bedd7073bea9ab7a > >> >> With perf lock tools, the lock contention from will-it-scale page_fault1 >> (with 90 tasks run 10s, hugepage-2048KB never, hugepage-64K always) show >> below(only care about zone spinlock and pcp spinlock), >> >> Without patches, >> contended total wait max wait avg wait type caller >> 713 4.64 ms 74.37 us 6.51 us spinlock __alloc_pages+0x23c >> >> With patches, >> contended total wait max wait avg wait type caller >> 2 25.66 us 16.31 us 12.83 us spinlock rmqueue_pcplist+0x2b0 >> >> Similar results on shell8 from unixbench, >> >> Without patches, >> 4942 901.09 ms 1.31 ms 182.33 us spinlock __alloc_pages+0x23c >> 1556 298.76 ms 1.23 ms 192.01 us spinlock rmqueue_pcplist+0x2b0 >> 991 182.73 ms 879.80 us 184.39 us spinlock rmqueue_pcplist+0x2b0 >> >> With patches, >> contended total wait max wait avg wait type caller >> 988 187.63 ms 855.18 us 189.91 us spinlock rmqueue_pcplist+0x2b0 >> 505 88.99 ms 793.27 us 176.21 us spinlock rmqueue_pcplist+0x2b0 >> >> The Benchmarks Score shows a little improvoment(0.28%) from shell8, but the >> zone lock from __alloc_pages() disappeared. >> >> Kefeng Wang (3): >> mm: prepare more high-order pages to be stored on the per-cpu lists >> mm: add control to allow specified high-order pages stored on PCP list >> mm: pcp: show each order page count >> >> Documentation/admin-guide/mm/transhuge.rst | 11 ++++ >> include/linux/gfp.h | 1 + >> include/linux/huge_mm.h | 1 + >> include/linux/mmzone.h | 10 ++- >> include/linux/vmstat.h | 19 ++++++ >> mm/Kconfig.debug | 8 +++ >> mm/huge_memory.c | 74 ++++++++++++++++++++++ >> mm/page_alloc.c | 30 +++++++-- >> mm/vmstat.c | 16 +++++ >> 9 files changed, 164 insertions(+), 6 deletions(-) >> >> -- >> 2.27.0 >> >> >