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 41412C25B75 for ; Fri, 31 May 2024 08:50:45 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A762F6B0093; Fri, 31 May 2024 04:50:44 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 9FF2F6B0095; Fri, 31 May 2024 04:50:44 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 89F086B0098; Fri, 31 May 2024 04:50:44 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 6A6546B0093 for ; Fri, 31 May 2024 04:50:44 -0400 (EDT) Received: from smtpin17.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id DC63240D4E for ; Fri, 31 May 2024 08:50:43 +0000 (UTC) X-FDA: 82178070366.17.F8E354B Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by imf22.hostedemail.com (Postfix) with ESMTP id F3290C0002 for ; Fri, 31 May 2024 08:50:40 +0000 (UTC) Authentication-Results: imf22.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf22.hostedemail.com: domain of linyunsheng@huawei.com designates 45.249.212.188 as permitted sender) smtp.mailfrom=linyunsheng@huawei.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1717145442; 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=Z7WSvhinkYjO3E1AbYAInnwwOt9aAUhydutdlrxq7/Q=; b=MvSurddugqyfejTEhZ3KaxLxM6v6cdJri4tHlcnEhFh+bIhTJItScbsC0KLGE0QifC4JFr cckNXp9jdhG2HFMI3O014b19DzWPFwg7Cc4mhuHQQskLZEYbOVexQ39cvAif85XPJ7/f4+ HfhI2mpZf+IDDkYOEem6ch1IWpIYjJM= 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 linyunsheng@huawei.com designates 45.249.212.188 as permitted sender) smtp.mailfrom=linyunsheng@huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1717145442; a=rsa-sha256; cv=none; b=pb4qrNZ8KN8RXuvQvgO6MXpt/LNXZUDPuuJdH1qclnG0iQOS/P8dbyMXFmZWIL8EW8ZsOk Y6SdsZTS8e2wJ9EEqoThgSmH0mOC+Pat9WEgwJpYAPKwL4Jyj/5U81LqxcMcBaVmaecIiH /5+6BsuuwIjkJBlEmcJvsHZPIwIv0ew= Received: from mail.maildlp.com (unknown [172.19.163.252]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4VrGtV6tjwzmWrx; Fri, 31 May 2024 16:46:10 +0800 (CST) Received: from dggpemm500005.china.huawei.com (unknown [7.185.36.74]) by mail.maildlp.com (Postfix) with ESMTPS id 73D4318007A; Fri, 31 May 2024 16:50:36 +0800 (CST) Received: from [10.69.30.204] (10.69.30.204) by dggpemm500005.china.huawei.com (7.185.36.74) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.35; Fri, 31 May 2024 16:50:36 +0800 Subject: Re: [PATCH net-next v5 01/13] mm: page_frag: add a test module for page_frag To: Jakub Kicinski CC: , , , , Alexander Duyck , Andrew Morton , References: <20240528125604.63048-1-linyunsheng@huawei.com> <20240528125604.63048-2-linyunsheng@huawei.com> <20240529172938.3a83784d@kernel.org> <1cba403b-a2c7-5706-78b7-91ccc6caa53b@huawei.com> <20240530081653.769e4377@kernel.org> From: Yunsheng Lin Message-ID: <24240fe0-00ca-a9cc-6087-1de720951896@huawei.com> Date: Fri, 31 May 2024 16:50:35 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.2.0 MIME-Version: 1.0 In-Reply-To: <20240530081653.769e4377@kernel.org> Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.69.30.204] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To dggpemm500005.china.huawei.com (7.185.36.74) X-Rspamd-Queue-Id: F3290C0002 X-Stat-Signature: 37bwsjr8kgpnus5zi4mu19qdoioof97n X-Rspam-User: X-Rspamd-Server: rspam11 X-HE-Tag: 1717145440-616237 X-HE-Meta: U2FsdGVkX1+g9nSjkfVN5Ik1MOoyGvUqntKCwVYBCuh41v10MSXdmu1TdFts+/NTqbOxCgcV3inWIXFy1/c8mC0vuO/+c5XRaHoYYoMlJFuLBvfJlgN9BpNMfZtVZo37W/bmAqGn3y9ZI0qtR3usSCmYspDSvH0cZunkCDh5HHRAEGl8R6yRx9yKS/gSIJ2vcYLac+aAJhq9ETM+JMRbhXDYNhxIY/XKZvzUKeSE6AgXjQyuHBGpFE4x4SowCXCdk8yGnn/YxWP3KuzuiLDGpJylngl+6DiGZJZSZZVSx1EQ5Q1ZUIKeCjDwl78O+ogxIeMUrzuyAG2ooKeFlcoE0TuNr4brWhJowxDQfjz2WsZF7FfG24AQ/kJo0NpGq9lassRvRx+p2ITggW0RVO52ivdIZ/6tWyqPqOh3mG6Tb9nGpGF1zMNAplPO2p88H4ohiGZKmeqLA5qnlI9KXt+swOxo4zLFnT0pMEQM65IHgDtihL+E+iTDGXY7dReoSaZ0kjana56GqfQV3u5ZG4GQUrUg2BSbGIWeIJq96/OxRda6KgXHlh8/twAH6+Gl7rQZ/RmrBPki5WOv7RmjYu6A3p3Tk7MRKziriDXf0zv2jNTNPh9vqhxfevjsmqkVtwJp+y+lIm0E5D+kw2wk/7PTyTVvfn2yznXb0fxX71Gv9SPXMWG7mh/4M69yaAlxg26dZU7tXd3V99W5BIf4LWT7miGMQgW1SXGAhBTPlcpLu8fpS5VBdVQu3omW6dHPeNca2NqPrbPyjnzCO0fkIMkE2Y/m87Ml0k7WyKx58WCy5z1baJf2rimw/Y+6J3c04D3QSTCOsW7OjFWDFEqfGUK1XS6G1QB+gnNubS5sm7IEfAwDgmegYQz3DKXYFn2A1MtK0eT5XzKjnzZhLTR6jBOUJ93ck9YkYOv+9oylBugCzawJuWMKy2AglIopUOsxy+EkXd8emyhpaz14MRVeeN/ i86TEXTf y4R3KoTvsTIqxpE7cXxm5HxarvViU/3GEs9tEY6ttY1HFQSQbAwF96ckeIDdAtjLveXFiJFdw3nfv3/XX+DBOSy3AzXy3SM+2JGYG8G6a8e3L8qG8/5Z++w65ciyr01WI027YPiruDplXnwl5h1kkuWGfFr2e8Pnwexhwd4Eaj/KWKDnkMwpQhm5LisUGKYEv+KRNyQmkpNFbQJoy1ILCeX97Os8CnInmNapOEqIRCfXKEEe9GnrvflB+vjKk0HwWPGtn 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/5/30 23:16, Jakub Kicinski wrote: > On Thu, 30 May 2024 17:17:17 +0800 Yunsheng Lin wrote: >>> Is this test actually meaningfully testing page_frag or rather >>> the objpool construct and the scheduler? :S >> >> For the objpool part, I guess it is ok to say that it is a >> meaningfully testing for both page_frag and objpool if there is >> changing to either of them. > > Why guess when you can measure it. > Slow one down and see if it impacts the benchmark. Before the slowing down on arm64 system: Performance counter stats for 'insmod ./page_frag_test.ko test_push_cpu=16 test_pop_cpu=17' (500 runs): 19.420606 task-clock (msec) # 0.001 CPUs utilized ( +- 0.82% ) 7 context-switches # 0.377 K/sec ( +- 0.30% ) 1 cpu-migrations # 0.038 K/sec ( +- 2.82% ) 84 page-faults # 0.004 M/sec ( +- 0.06% ) 50423999 cycles # 2.596 GHz ( +- 0.82% ) 35558295 instructions # 0.71 insn per cycle ( +- 0.09% ) 8340405 branches # 429.462 M/sec ( +- 0.08% ) 20669 branch-misses # 0.25% of all branches ( +- 0.10% ) 24.047641626 seconds time elapsed ( +- 0.08% ) And there are 5120000 push and pop operations for each iteration, so roughly each push and pop operation costs about 4687ns. By adding 50ns delay in *__page_frag_alloc_va_align() @@ -300,6 +297,8 @@ void *__page_frag_alloc_va_align(struct page_frag_cache *nc, { unsigned int remaining = nc->remaining & align_mask; + ndelay(50); + if (unlikely(fragsz > remaining)) { We have: Performance counter stats for 'insmod ./page_frag_test.ko test_push_cpu=16 test_pop_cpu=17' (500 runs): 18.012657 task-clock (msec) # 0.001 CPUs utilized ( +- 0.01% ) 7 context-switches # 0.395 K/sec ( +- 0.20% ) 1 cpu-migrations # 0.052 K/sec ( +- 1.35% ) 84 page-faults # 0.005 M/sec ( +- 0.06% ) 46765406 cycles # 2.596 GHz ( +- 0.01% ) 35253336 instructions # 0.75 insn per cycle ( +- 0.00% ) 8277063 branches # 459.514 M/sec ( +- 0.00% ) 20558 branch-misses # 0.25% of all branches ( +- 0.07% ) 24.313647557 seconds time elapsed ( +- 0.07% ) (24.313647557 - 24.047641626) * 1000000000 / 5120000 = 51ns, so the testing seems correct. > >> For the scheduler part, this test provides the below module param >> to avoid the the noise from scheduler. >> >> +static int test_push_cpu; >> +module_param(test_push_cpu, int, 0600); >> +MODULE_PARM_DESC(test_push_cpu, "test cpu for pushing fragment"); >> + >> +static int test_pop_cpu; >> +module_param(test_pop_cpu, int, 0600); >> +MODULE_PARM_DESC(test_pop_cpu, "test cpu for popping fragment"); >> >> Or is there any better idea for testing page_frag? > > . >