Message ID | 20210817154651.1570984-4-Liam.Howlett@oracle.com (mailing list archive) |
---|---|
State | New |
Headers | show
Return-Path: <SRS0=Mz2w=NI=kvack.org=owner-linux-mm@kernel.org> X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D0D16C432BE for <linux-mm@archiver.kernel.org>; Tue, 17 Aug 2021 15:47:58 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 8062760ED5 for <linux-mm@archiver.kernel.org>; Tue, 17 Aug 2021 15:47:58 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 8062760ED5 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=oracle.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id E51846B0082; Tue, 17 Aug 2021 11:47:35 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E04096B0083; Tue, 17 Aug 2021 11:47:35 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C2DA38D0001; Tue, 17 Aug 2021 11:47:35 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0062.hostedemail.com [216.40.44.62]) by kanga.kvack.org (Postfix) with ESMTP id A490B6B0082 for <linux-mm@kvack.org>; Tue, 17 Aug 2021 11:47:35 -0400 (EDT) Received: from smtpin03.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 4FD6A235D0 for <linux-mm@kvack.org>; Tue, 17 Aug 2021 15:47:35 +0000 (UTC) X-FDA: 78485002470.03.72CAA46 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by imf20.hostedemail.com (Postfix) with ESMTP id C1945D000658 for <linux-mm@kvack.org>; Tue, 17 Aug 2021 15:47:34 +0000 (UTC) Received: from pps.filterd (m0246629.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 17HFjffU011253; Tue, 17 Aug 2021 15:47:11 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : references : in-reply-to : content-type : content-transfer-encoding : mime-version; s=corp-2021-07-09; bh=3j+08lREa0r9A1JB7kdnPvbg5F8d9idklNPEBbu30uQ=; b=G/4fefs/XPizzfiGUv+nVeNTAc90qhpFGflmsdVkETW5m7MTnBQduw84BENdvGB9maEo X+eoCqznlRr0RZl2Y4qYJ6qsDU1301VMfS5jxANR8chjMVGFajeiT3tdjM+UZyfXDG2S fnasJtqz0UFgeqpNMhdCW3qqgYCjA36uz8Wl0tCX4/4iM9JShc/mLFJvfiZoiBNa+QyI UQbLuxxWfkHuFJLJKnlqrRO6Q0hwxZxvZCiZdknL3vYIZWVtiyTMoKtiWEjwEfqfibu0 jtDMLR6ONyNh1yQ31UpnQtBr54p4uqOy8W5/yuUQEE153zU9zsmPmboxuD61vcMWHzd9 Hw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : references : in-reply-to : content-type : content-transfer-encoding : mime-version; s=corp-2020-01-29; bh=3j+08lREa0r9A1JB7kdnPvbg5F8d9idklNPEBbu30uQ=; b=cz6itQgL7A2xFsAiiFSGaXRKnbCv924pTEXaLlWnYXQl+J/aAWenUvmTvKPAmGDbl68t /zRxl005OzXZTPrIb+MYrMJXyy66OOP3sRUjr6+xIfb0wzlB7GOun64Kt5cznI/fhZan GQZ61I29w9oxCZtukeYIp1Iiv2M6wMVONqrHzPTX1odPG4vvkJLjYk60Tx/SdFB6MrnB iGigkti0/gGR8dFYBVFPu7lOkNlf5k5G4kuSzB7AeD1mZrzCvCiAkjzUU0yfM6v4KqMo LokS19XUmwvq4QbWjj01enBdKMzYuJRuSSlYeW7cztGL+7o4WBIOoxMrPVEVhvphE53A fA== Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by mx0b-00069f02.pphosted.com with ESMTP id 3age7d8bt2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 17 Aug 2021 15:47:10 +0000 Received: from pps.filterd (aserp3030.oracle.com [127.0.0.1]) by aserp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 17HFkt3Y094574; Tue, 17 Aug 2021 15:47:09 GMT Received: from nam11-bn8-obe.outbound.protection.outlook.com (mail-bn8nam11lp2173.outbound.protection.outlook.com [104.47.58.173]) by aserp3030.oracle.com with ESMTP id 3ae3vftd2y-4 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 17 Aug 2021 15:47:09 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=oAcDvbCFDdBQPgIocFKupt64D/h/6hHo0sxutDiaoK8g6l8YnrXn9ipp0b1wOor2pFUu/c4WIr8pYURsGjOMkiNm6hfuiMoBtNXCzrWvo1D0W6BFcY7yO6NGzrjPAduxOSZYAfoMJ0PizZtneF2FWoZgQvjoecQBd2t3SJo5Hlh+uA4W3XnJqs0mV/cXiIQFx990Oc6XavQ4nqkvebZkQKYzP0b/caqccGUor1X2HxNnRnykdp6UqwgQEObep+fy9jcHAlIO56ynDgnZeE3trjgmPfJBboKz8trELswW9e7JlXrhU95QnC8heSno80M2QTwf7nI3jNvPT27WhQuV+A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=3j+08lREa0r9A1JB7kdnPvbg5F8d9idklNPEBbu30uQ=; b=BeVKalSQo/HDtZpTWn1/mbSRULrftLH4Zb41CKM5t2Ys++CknDwrHp+FIDnM4qbYDHvaIN74RvzqPDKmQzkOTvWI8uH0qC5DwmJfxRYPyeoNLojz+tJNR5JejMQ0RqXYq66YT4uJJigb7w+TQRjTmE/WesMl0UWvVuTQ/IkTULjbD5RLEMz2RamWA4RLDUpR3zsmUx3Iv/rlBAH95sNEcuXzT7DEIuQCJY9QFvv6c6M/zL0i0eesf9HYjXXiZOqTK/6ovGUUvl0nZMOorjd2cO/FCFeCGY+5N+h7IMXoanY+a0G6L0Z/16bRZh+wQUgzfZ5voLRNjiKE+nr+EmulWA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=3j+08lREa0r9A1JB7kdnPvbg5F8d9idklNPEBbu30uQ=; b=ObXaZ3wl506hC0AwU3ixrxul6O0t838HF0m1uW2+QIurCcaFxqgAs9Qrn9XahJFWzmjlGYAlNIpQbU49LkcSQx68Lc27JLVIONWn7vEoR4M2UH6V9w9Bi/2fgIz6yZNwb0M83ckmZH7OeWN0/h3M+RzDEItSMz5j3lgMwGwEiD0= Received: from DM6PR10MB4380.namprd10.prod.outlook.com (2603:10b6:5:223::19) by DM6PR10MB3097.namprd10.prod.outlook.com (2603:10b6:5:1a9::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4415.16; Tue, 17 Aug 2021 15:47:05 +0000 Received: from DM6PR10MB4380.namprd10.prod.outlook.com ([fe80::585:1aa0:6582:92f3]) by DM6PR10MB4380.namprd10.prod.outlook.com ([fe80::585:1aa0:6582:92f3%6]) with mapi id 15.20.4415.024; Tue, 17 Aug 2021 15:47:05 +0000 From: Liam Howlett <liam.howlett@oracle.com> To: "maple-tree@lists.infradead.org" <maple-tree@lists.infradead.org>, "linux-mm@kvack.org" <linux-mm@kvack.org>, "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>, Andrew Morton <akpm@linux-foundation.org> CC: Song Liu <songliubraving@fb.com>, Davidlohr Bueso <dave@stgolabs.net>, "Paul E . McKenney" <paulmck@kernel.org>, Matthew Wilcox <willy@infradead.org>, Laurent Dufour <ldufour@linux.ibm.com>, David Rientjes <rientjes@google.com>, Axel Rasmussen <axelrasmussen@google.com>, Suren Baghdasaryan <surenb@google.com>, Vlastimil Babka <vbabka@suse.cz>, Rik van Riel <riel@surriel.com>, Peter Zijlstra <peterz@infradead.org>, Michel Lespinasse <walken.cr@gmail.com>, Liam Howlett <liam.howlett@oracle.com> Subject: [PATCH v2 03/61] radix tree test suite: Add allocation counts and size to kmem_cache Thread-Topic: [PATCH v2 03/61] radix tree test suite: Add allocation counts and size to kmem_cache Thread-Index: AQHXk38gS29shnsm60m0L52s3L7k1w== Date: Tue, 17 Aug 2021 15:47:04 +0000 Message-ID: <20210817154651.1570984-4-Liam.Howlett@oracle.com> References: <20210817154651.1570984-1-Liam.Howlett@oracle.com> In-Reply-To: <20210817154651.1570984-1-Liam.Howlett@oracle.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: git-send-email 2.30.2 x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: c6bc6dbb-1c72-4f6c-1c64-08d961964381 x-ms-traffictypediagnostic: DM6PR10MB3097: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: <DM6PR10MB30975C9CB2F37D3430BB265BFDFE9@DM6PR10MB3097.namprd10.prod.outlook.com> x-ms-oob-tlc-oobclassifiers: OLM:2449; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: GD06udPNaTRzNMmVFsu/joDV3um76OMUeDiZcEyF85AAMD8fsTcoyLUyHh1f/xZTkWUaB3B5+Gu8m6eBDFVyrya5KoxFdm5HiU3LqPgbtvRXLjd5dWiqJkK9HddVqis78bhGfR/E4KyeCzH32DBpoiVb9L2pVsDmrEUeQMUh4WCflYWDH8dvGUWBBBxPl5MzTPHUQlN2om+Gbat6n+bRhImmsZrABQNJj8K/tC5NNx8GGSKRJ6dZAPkCmbsG4+dFrhzEAJXC6swBzWtZT4Y9bxagzpdD79G++f9TVIyX2bVtqareY1LwyHcA0btlkl/k0BRCDtrEMun3zaALJoR96L4cVrIBR/OkU1sr1vOtfnZ+0f9aEBOGetqkSH0d/R3Wm8bxxLqhyo2R6ULIdoybGV6xQOW5LDhDpKufI1cP96sf62tX5wc4croaYlUQSCycJklyu6DUjQ/MG9VrEZh8S92SIEpV8TBPyN0qRWeQZ939+k/gjm+5eCUP+zgQ61AAjIcBLXk3yCAsMYUucGI16ezAgZgqZSYmdzaXCNMt8ZBOLmY14lx0FpYuqV0NG/TI+AJUbUv20BcKZeDgGjpd1boEUSrZRn7Mrr4y3Eindyzp9RvvwH9g+zGN9Ldzn/K25lN93136Y1yy0oEuX9qtjfBxj4y+kxcjsNKOq7JT4Sn4KMr9CXeTUST9lXHnaawwE6f/ihgwjPhz6yy0SQeWIg== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM6PR10MB4380.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(366004)(376002)(39860400002)(396003)(346002)(136003)(8676002)(6506007)(2616005)(54906003)(8936002)(478600001)(26005)(1076003)(38070700005)(110136005)(316002)(5660300002)(36756003)(6486002)(71200400001)(91956017)(66446008)(122000001)(6512007)(38100700002)(83380400001)(7416002)(44832011)(2906002)(186003)(4326008)(107886003)(86362001)(66946007)(64756008)(66556008)(66476007)(76116006);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-1?q?Gkf/8KrqPIbSEF1gCkFUoE1?= =?iso-8859-1?q?PG92Odp6xggwmngs06GCfcwLRwvAN/5UeGTWBdv1EwxeONv1pGef1Xnb+Tnp?= =?iso-8859-1?q?9/FP+GnDEVp4jm/Lx6gJ6xcVUHelxUGsg4ToZ07yYLe5NNU7d7hNEa1g67rB?= =?iso-8859-1?q?MDK275UuJNAv3sOH8OgTJJgb/tBenD4otGpKnal4B/X7pBtUjiCG+CXzurLp?= =?iso-8859-1?q?pwyIP7+mCpBQzZpw6HiL9WRHbn2PuKa1OU0UqY9dYgMdJfylfcQ1iUMYH50u?= =?iso-8859-1?q?aRwbBOD/FIo8ZylnJe96Tj1XyBfHJUkPP+w5zeSY4GCUc7hSTJt7DCM8j91N?= =?iso-8859-1?q?w57cfhIZdDGE6+IgM/mUlNvg50jB8itseaNh1ExZ40ZdMIKTFasprnmwDtCj?= =?iso-8859-1?q?aBGbvDRDbnftU1G2Ua7JRGffYaxWLSSRCPeO0bZkpGB74SvRtvrqqDwTwNmV?= =?iso-8859-1?q?C0hVKJaHoy2W5nrMbf5iQaabylGfyKNQgLzJlnfTLxURMjW9rLJNhc+kFu32?= =?iso-8859-1?q?oCtajiGEjdKxM9dsf4bye215pXFCfBC6SeABh/E3Ag9hH36LEkY8S/zhZTH0?= =?iso-8859-1?q?A9kBY+uAEf6JupjftcQ7vq5ympcxelmgTYLiDyjxUTOWVWBwYmf98+eOLjhS?= =?iso-8859-1?q?Z8vawUypoED8SB1hq2JMZ31nkrVWg+0sx/OHgWHXLw68ugn6sIkoRWrxZeix?= =?iso-8859-1?q?QqIEuELInLFf+11JaIaD7x5F5DjQqAmstSZ8TyEPpzMiWi3ADhmpO3zinEOo?= =?iso-8859-1?q?tL/segRbPIeXuFsig0yqcCAXR98aDtm9KszPqo6Aj3H+jYZS+AOmzGSp6iYz?= =?iso-8859-1?q?fIn8wCE8XxgWI/0Hb8a93bOL05qLgiDZeJbycwJsyNt/PHqixO/H1df1dq3N?= =?iso-8859-1?q?PBG/2kqFTPyZNBifWFOu4EL6if1lHZByliJHNdSJe9rDAZox6LAacpnsKrld?= =?iso-8859-1?q?CqFc0FAthwgzHpg7zcc8c1wu4XeKyA/Kq8fpMbeRfJa2ZnxBmTy+SVxUfQ/m?= =?iso-8859-1?q?aOXPoGWIlMWhAIP/5AMAj2cPLh0a2Lnee+3EF2fwMXLxaEzbRxnJLt4FDeMJ?= =?iso-8859-1?q?XeesGq+llDjBxg8WFpzp4gIr51eLb0cfa9UK5926kBxGSmbYJYxJK36f4WhU?= =?iso-8859-1?q?0tCvddkYah3EebNFFxsDcOvi/pkZ1pnxU/X31gcDfUVOsG1AfNimWjbugWtG?= =?iso-8859-1?q?/FTqVmhL5p8FLr74e649I9zz79wKziBK7EjVI4v+3W5lICPdv+Z1rMautAS/?= =?iso-8859-1?q?RWtmyHxQjApVqosw4tgKO+9q1tMnK6QKz3D3N7Ak95ieVMSKVonr5nlwmExy?= =?iso-8859-1?q?D7fn5kF9YPMq3oWotZpYgFsePAexGKONB7qRXhSDAVG44CwxSvvMPqGMiNBs?= =?iso-8859-1?q?a?= Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: DM6PR10MB4380.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: c6bc6dbb-1c72-4f6c-1c64-08d961964381 X-MS-Exchange-CrossTenant-originalarrivaltime: 17 Aug 2021 15:47:04.4217 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: JuvvtTElIGQJUIP9Z5A3VO943G0L5JplB+48rKMMpA3DidGzOLq1+naeUJWO6O811152MBu9+hgRtTagKAEi+g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR10MB3097 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=10079 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 adultscore=0 mlxscore=0 malwarescore=0 mlxlogscore=999 spamscore=0 bulkscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2107140000 definitions=main-2108170097 X-Proofpoint-GUID: kGO6AZ5l9TsL8h0f_2OwfZ8NjrTH0v83 X-Proofpoint-ORIG-GUID: kGO6AZ5l9TsL8h0f_2OwfZ8NjrTH0v83 Authentication-Results: imf20.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2021-07-09 header.b="G/4fefs/"; dkim=pass header.d=oracle.com header.s=corp-2020-01-29 header.b=cz6itQgL; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=ObXaZ3wl; dmarc=pass (policy=none) header.from=oracle.com; spf=none (imf20.hostedemail.com: domain of liam.howlett@oracle.com has no SPF policy when checking 205.220.165.32) smtp.mailfrom=liam.howlett@oracle.com X-Stat-Signature: izufuyzubcqwbbbmge1di3gpwqjgupec X-Rspamd-Queue-Id: C1945D000658 X-Rspamd-Server: rspam05 X-HE-Tag: 1629215254-929264 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: <linux-mm.kvack.org> |
Series |
Introducing the Maple Tree
|
expand
|
diff --git a/tools/testing/radix-tree/linux.c b/tools/testing/radix-tree/linux.c index 00ee01a14652..f95e71d65f00 100644 --- a/tools/testing/radix-tree/linux.c +++ b/tools/testing/radix-tree/linux.c @@ -25,6 +25,8 @@ struct kmem_cache { void *objs; void (*ctor)(void *); unsigned int non_kernel; + unsigned long nr_allocated; + unsigned long nr_tallocated; }; void kmem_cache_set_non_kernel(struct kmem_cache *cachep, unsigned int val) @@ -32,6 +34,26 @@ void kmem_cache_set_non_kernel(struct kmem_cache *cachep, unsigned int val) cachep->non_kernel = val; } +unsigned long kmem_cache_get_alloc(struct kmem_cache *cachep) +{ + return cachep->size * cachep->nr_allocated; +} + +unsigned long kmem_cache_nr_allocated(struct kmem_cache *cachep) +{ + return cachep->nr_allocated; +} + +unsigned long kmem_cache_nr_tallocated(struct kmem_cache *cachep) +{ + return cachep->nr_tallocated; +} + +void kmem_cache_zero_nr_tallocated(struct kmem_cache *cachep) +{ + cachep->nr_tallocated = 0; +} + void *kmem_cache_alloc(struct kmem_cache *cachep, int gfp) { void *p; @@ -63,7 +85,9 @@ void *kmem_cache_alloc(struct kmem_cache *cachep, int gfp) memset(p, 0, cachep->size); } + uatomic_inc(&cachep->nr_allocated); uatomic_inc(&nr_allocated); + uatomic_inc(&cachep->nr_tallocated); if (kmalloc_verbose) printf("Allocating %p from slab\n", p); return p; @@ -73,6 +97,7 @@ void kmem_cache_free(struct kmem_cache *cachep, void *objp) { assert(objp); uatomic_dec(&nr_allocated); + uatomic_dec(&cachep->nr_allocated); if (kmalloc_verbose) printf("Freeing %p to slab\n", objp); pthread_mutex_lock(&cachep->lock); @@ -124,6 +149,8 @@ kmem_cache_create(const char *name, unsigned int size, unsigned int align, ret->size = size; ret->align = align; ret->nr_objs = 0; + ret->nr_allocated = 0; + ret->nr_tallocated = 0; ret->objs = NULL; ret->ctor = ctor; ret->non_kernel = 0;