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 3E252C3DA64 for ; Thu, 1 Aug 2024 12:58:49 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 29B166B00AC; Thu, 1 Aug 2024 08:58:46 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 1A7066B00AF; Thu, 1 Aug 2024 08:58:46 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DFDCC6B00AD; Thu, 1 Aug 2024 08:58:45 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 7735C6B00AB for ; Thu, 1 Aug 2024 08:58:44 -0400 (EDT) Received: from smtpin18.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 2F805A0D5A for ; Thu, 1 Aug 2024 12:58:44 +0000 (UTC) X-FDA: 82403680968.18.9798FAB Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by imf21.hostedemail.com (Postfix) with ESMTP id 826641C0027 for ; Thu, 1 Aug 2024 12:58:41 +0000 (UTC) Authentication-Results: imf21.hostedemail.com; dkim=none; spf=pass (imf21.hostedemail.com: domain of linyunsheng@huawei.com designates 45.249.212.187 as permitted sender) smtp.mailfrom=linyunsheng@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1722517077; 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=rxv0SvJSDRdaOKYEfMQbHZsJwYGE5lnKnu7PPzrdWTs=; b=Zoxk3fQZ447QtveoJ0AvssdpHTwaKV55dLBP+8Gxw4Eq1UD1yyQPq5frSpql+DHrOx88YR HbBVIDT52EQbaMAMvEGYbkNw1JhtbqBCIGuYVeauudG3rrQSYJacphHa2TZLxlUec61BZC 5rxo+V26FNPPqi5Q6AZI42D5ilLl7Is= ARC-Authentication-Results: i=1; imf21.hostedemail.com; dkim=none; spf=pass (imf21.hostedemail.com: domain of linyunsheng@huawei.com designates 45.249.212.187 as permitted sender) smtp.mailfrom=linyunsheng@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1722517077; a=rsa-sha256; cv=none; b=n2O2qktPnmfOVyDAenfLnMCR/wAE/i/Os5ZUGyNCbVeACPXVSmMG6DpXGg1+YCqmRyDWgF PrB0XTR4p2uzyBZthl3M/TywPg7JWhXwlwmpAenXb6fSCYdVnYj39/BJDbsotWqOLjkfXt dJ3d/WBfqRjyXIy/9Geoy/qD+K3Yg7A= Received: from mail.maildlp.com (unknown [172.19.163.252]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4WZTXw370TzxVws; Thu, 1 Aug 2024 20:58:24 +0800 (CST) Received: from dggpemf200006.china.huawei.com (unknown [7.185.36.61]) by mail.maildlp.com (Postfix) with ESMTPS id 75F81180AE6; Thu, 1 Aug 2024 20:58:37 +0800 (CST) Received: from [10.67.120.129] (10.67.120.129) by dggpemf200006.china.huawei.com (7.185.36.61) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Thu, 1 Aug 2024 20:58:37 +0800 Message-ID: <03c555c5-a25d-434a-aed4-0f2f7aa65adf@huawei.com> Date: Thu, 1 Aug 2024 20:58:36 +0800 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH net-next v12 01/14] mm: page_frag: add a test module for page_frag To: Alexander Duyck CC: , , , , , Andrew Morton , References: <20240731124505.2903877-1-linyunsheng@huawei.com> <20240731124505.2903877-2-linyunsheng@huawei.com> Content-Language: en-US From: Yunsheng Lin In-Reply-To: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit X-Originating-IP: [10.67.120.129] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To dggpemf200006.china.huawei.com (7.185.36.61) X-Stat-Signature: u5hog5zn3queidh19jjd7c1m85nakq8u X-Rspam-User: X-Rspamd-Queue-Id: 826641C0027 X-Rspamd-Server: rspam02 X-HE-Tag: 1722517121-22136 X-HE-Meta: U2FsdGVkX1+opLXKMKubfayz2OYQgwvYTZTnsqeI8VdqbUC7KFei1JK+JI3w2rnEjEo9aW8CaPTJteLLFISwrVZMEkpDbsDRKJRkay7tLaYZRLy4aTpUyncgKP59WUF1gWou4DVNPFKxf8yFz5yF7CJjgt0QMrmYUuW5vzV2lIJI/427nDlXYMrh3hZ4swTgGdTJ1Faxszgu95u7kRcBAOa+Y9EAsLp0M6r7ljJ0xdovIaqa5yZ6clLpdF2Ygvf4YHeoYRM/HqWaczkq9hFLERRkPYOtCgYLstXLSs19aH03/F2Ah5qzT2LVx/sd5ssxKLyn1k/q8YBFEX/CszU/xiqeLslZN/kB2PaO+x/5h1yoLncTP8fbKwLNKDEF1HeM+PZB42NILh79N0jTuCUiHHvagn34O4FUrdbTKttSTqqIAl9tw7qp966N1efTXcqVyw1rz5I8OVmIZWamsHmMFWLvKdKzPqFaCMxrOTw30ASzGSYUigWJBO1cSU2g5/B8EBaXOl8KR2IwLGPHzDAypgN9aNtLuB2TiNpfpUi1sZMhmSH6ooHRFC8nsZLTxMPybuykJxHm3RvcxEFeKy2rYYBG88bk+wrN9YqRGz2QLF60zYJWUsRSc/b6gAHfyuqnK5bcFteTd6DTRpRA5SssSZkJ11RtXOzjoMmbuDYqEgEdf3C/NKXieIL0/dr96QBkFnOdStZTnR5CNmCV5tN39njDUWYSnHTXAsM9X/yAa2VT8zHN3KnGf5ue4y2WqykCIDTXDNHINlzzx32a6Lv3aOWFLEn5oJOLfNLuJ5XNhCIENr0qHQy/mCN5yr7cy3zR2bZJFlBA29IpV+37hLqB5aXq1BpE2jm8ox6yX2mY8UPdUi8sOB3cyW6zaUhhPRrtY94oDN+w1O5vaOLrwQWK/FRXqafO8afDp5WntNLhGM5J4HW5H+L/iVGxUJY95PKoYtgxXTFNSX7dJcmriL1 R2e1uyx+ KvHYhPHL9hNyXbNPXFzDHWyCALjuz+XimfIe9SxtCDk0jaWraSrAdaWFz4QhX/N71J6Ps/gTjTxGJRgXLlOxIcngVKfjhm9CvPJpBB3RkicHmbfpKCMrxhp7TLnJ4dVSB6xMNsCmZ9yJIdb6v4wsb9qLG3OkE8J9HNnpKH+y4vJwkEXxS4n10yiGak9fOve0ctoSmJ+xhcSnET+KucUU2KNfs5FQNm2VMe/8G8CiC/oo1km1FV1iov5UdX5i4H45I1yZQSowxiLTlFChIUekILAlrDmjZNVm0HNk/kQZN8qb6QxYFSKBBFa2THoLm7NekRfjq4L7s0cJW/TnYWjol1aDfJA== 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/8/1 2:29, Alexander Duyck wrote: > On Wed, Jul 31, 2024 at 5:50 AM Yunsheng Lin wrote: >> >> Basing on the lib/objpool.c, change it to something like a >> ptrpool, so that we can utilize that to test the correctness >> and performance of the page_frag. >> >> The testing is done by ensuring that the fragment allocated >> from a frag_frag_cache instance is pushed into a ptrpool >> instance in a kthread binded to a specified cpu, and a kthread >> binded to a specified cpu will pop the fragment from the >> ptrpool and free the fragment. >> >> We may refactor out the common part between objpool and ptrpool >> if this ptrpool thing turns out to be helpful for other place. > > This isn't a patch where you should be introducing stuff you hope to > refactor out and reuse later. Your objpoo/ptrpool stuff is just going > to add bloat and overhead as you are going to have to do pointer > changes to get them in and out of memory and you are having to scan > per-cpu lists. You would be better served using a simple array as your > threads should be stick to a consistent CPU anyway in terms of > testing. > > I would suggest keeping this much more simple. Trying to pattern this > after something like the dmapool_test code would be a better way to go > for this. We don't need all this extra objpool overhead getting in the > way of testing the code you should be focused on. Just allocate your > array on one specific CPU and start placing and removing your pages > from there instead of messing with the push/pop semantics. I am not sure if I understand what you meant here, do you meant something like dmapool_test_alloc() does as something like below? static int page_frag_test_alloc(void **p, int blocks) { int i; for (i = 0; i < blocks; i++) { p[i] = page_frag_alloc(&test_frag, test_alloc_len, GFP_KERNEL); if (!p[i]) goto pool_fail; } for (i = 0; i < blocks; i++) page_frag_free(p[i]); .... } The above was my initial thinking too, I went to the ptrpool thing using at least two CPUs as the below reason: 1. Test the concurrent calling between allocing and freeing more throughly, for example, page->_refcount concurrent handling, cache draining and cache reusing code path will be tested more throughly. 2. Test the performance impact of cache bouncing between different CPUs. I am not sure if there is a more lightweight implementation than ptrpool to do the above testing more throughly. > > Lastly something that is a module only tester that always fails to > probe doesn't sound like it really makes sense as a standard kernel I had the same feeling as you, but when doing testing, it seems convenient enough to do a 'insmod xxx.ko' for testing without a 'rmmod xxx.ko' > module. I still think it would make more sense to move it to the > selftests tree and just have it build there as a module instead of I failed to find one example of test kernel module that is in the selftests tree yet. If it does make sense, please provide an example here, and I am willing to follow the pattern if there is one. > trying to force it into the mm tree. The example of dmapool_test makes > sense as it could be run at early boot to run the test and then it I suppose you meant dmapool is built-in to the kernel and run at early boot? I am not sure what is the point of built-in for dmapool, as it only do one-time testing, and built-in for dmapool only waste some memory when testing is done. > just goes quiet. This module won't load and will always just return > -EAGAIN which doesn't sound like a valid kernel module to me. As above, it seems convenient enough to do a 'insmod xxx.ko' for testing without a 'rmmod xxx.ko'.