Message ID | 20211005012959.1110504-4-Liam.Howlett@oracle.com (mailing list archive) |
---|---|
State | New |
Headers | show
Return-Path: <SRS0=pyM+=OZ=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 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1A31AC433F5 for <linux-mm@archiver.kernel.org>; Tue, 5 Oct 2021 01:30:54 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id E375861406 for <linux-mm@archiver.kernel.org>; Tue, 5 Oct 2021 01:30:52 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org E375861406 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 3ACB8900002; Mon, 4 Oct 2021 21:30:52 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 35BAB6B0071; Mon, 4 Oct 2021 21:30:52 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1DF2B900002; Mon, 4 Oct 2021 21:30:52 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0090.hostedemail.com [216.40.44.90]) by kanga.kvack.org (Postfix) with ESMTP id 0C3A16B006C for <linux-mm@kvack.org>; Mon, 4 Oct 2021 21:30:52 -0400 (EDT) Received: from smtpin20.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id BF84331EDC for <linux-mm@kvack.org>; Tue, 5 Oct 2021 01:30:51 +0000 (UTC) X-FDA: 78660654702.20.B3CEA3F Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by imf07.hostedemail.com (Postfix) with ESMTP id 4784A1001C87 for <linux-mm@kvack.org>; Tue, 5 Oct 2021 01:30:51 +0000 (UTC) Received: from pps.filterd (m0246629.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 195017oe004524; Tue, 5 Oct 2021 01:30:33 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=MfiD08bsrJQLjiZ9XGYzpiKPOYT+7m8XH6Z/q+3RHjJhA7IBh0N4OURXuobQHLbY1nbf rz0P4pXdWiAYhs2+jx9GG26xp+dfsi6uxvwoiFG/qZf5PCW//XNuldZ6I4xp5ks5ZHtW 2DlViZchHr8WRGMTIJ1kU66U0AIgrV4GEfHGZxBCCyUofTmNXxioALHH4m354KUzacGP 4aB+H3G6oYXuIOqRP98OxLNmDEuCPfT5zjEqtb24qz6EOGQuuXVlQ8HAzpkTHMT98brj m5LsT0wlq+8rUMAtuo25aIZWPeGewvsQKP4Sg3AmGfZkLRXt2Utve8D7/ZC3xUUgfoPF PQ== Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by mx0b-00069f02.pphosted.com with ESMTP id 3bg43dumgb-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 05 Oct 2021 01:30:32 +0000 Received: from pps.filterd (aserp3020.oracle.com [127.0.0.1]) by aserp3020.oracle.com (8.16.1.2/8.16.1.2) with SMTP id 1951UHf3178354; Tue, 5 Oct 2021 01:30:29 GMT Received: from nam11-bn8-obe.outbound.protection.outlook.com (mail-bn8nam11lp2168.outbound.protection.outlook.com [104.47.58.168]) by aserp3020.oracle.com with ESMTP id 3bev8w02af-4 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 05 Oct 2021 01:30:29 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HM7aqE65gyYutB8PkwauQIzvYPzCzrQUELpBeEtiUEwJtA2OECxA4RGvW8dXnzL8rjEmMab9Z9mqw3ryA0PlJg30KzaxpeWBd2mNUr/HEJXJ1Sj8bHf5ON4ACJJ+rIdcZaZRo8AInjUHkzMgSOsS9OOu/an3kIiVdzK9T6O6A9wSUYhEJ9Qtdgxycd0uHShK19xXwgNnIbuFnoev18iyKaDFGBxIZZHWmo6bgm4nEDFJa0ztKgyInpZQYS38ffo7tLw62ia7zObGx8qQJC39ecIwHgKwHTcv4Oo3BXwf4Nsf3NMdmV7Xrnff3/8mqqaxIlBF7eOqesI5W70dKRzDww== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=3j+08lREa0r9A1JB7kdnPvbg5F8d9idklNPEBbu30uQ=; b=bg5ZwGQzFgQb2hDtr4gJEjxY86Wpj1VMZ9M3BFaGIhwvpi1Ud0OU0MG7zPy+cjXoxWKQM8EYePFvCrVGsFm1HJybtz0XWIc5R69p8P1IKtJbb70nJIwJ7vf9XLCzwQ1y8iog/nZKBqYPQ4jj3D4u04SLD0RjhlaJV0gETpVjGSBc5AKdLCd/w2JYA2EUESCnH6MI0Vl5MGlfZfvpRPiiebCRn7C0fEotNS8EOVkyX9FfzkfPIYYImkrDIPy4gZVWpqIWQ5FQ5AyXjJh1CI8y8WXUOIjHhgpgLLSs7VqmsgmhwCcRx/DzfL1Z6BvOsgwQByxLgjOQkzlfJVN+OOBWeA== 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=Z26SBzb246dMZbBIecbBFBFtXycE8Ltx/DQqWDmYMr1ZETD2in2tSf2GvN4wT/Us9HOK3YUQiwtGLpqtlQ7ep6Ffm9us/LN8VfNYupiVsE1YCkiUqDKekBe/qEXNwAF+847nIhNB+AlDFZvcMKQMb/FMVA+yzPsCJZ2+v5MC6gs= Received: from BL0PR10MB3011.namprd10.prod.outlook.com (2603:10b6:208:7e::29) by BLAPR10MB5218.namprd10.prod.outlook.com (2603:10b6:208:306::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4566.15; Tue, 5 Oct 2021 01:30:26 +0000 Received: from BL0PR10MB3011.namprd10.prod.outlook.com ([fe80::6d61:54c2:40f0:93a]) by BL0PR10MB3011.namprd10.prod.outlook.com ([fe80::6d61:54c2:40f0:93a%5]) with mapi id 15.20.4566.017; Tue, 5 Oct 2021 01:30:26 +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>, David Hildenbrand <david@redhat.com>, Douglas Gilbert <dgilbert@interlog.com> CC: Song Liu <songliubraving@fb.com>, Davidlohr Bueso <dave@stgolabs.net>, "Paul E . McKenney" <paulmck@kernel.org>, Matthew Wilcox <willy@infradead.org>, 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> Subject: [PATCH v3 03/66] radix tree test suite: Add allocation counts and size to kmem_cache Thread-Topic: [PATCH v3 03/66] radix tree test suite: Add allocation counts and size to kmem_cache Thread-Index: AQHXuYiTXcPYXjEkSkODQmzn1G588Q== Date: Tue, 5 Oct 2021 01:30:26 +0000 Message-ID: <20211005012959.1110504-4-Liam.Howlett@oracle.com> References: <20211005012959.1110504-1-Liam.Howlett@oracle.com> In-Reply-To: <20211005012959.1110504-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: fb3c1bf2-1c78-4128-9fb6-08d9879fb5a5 x-ms-traffictypediagnostic: BLAPR10MB5218: x-microsoft-antispam-prvs: <BLAPR10MB521803849167D057B034C8BFFDAF9@BLAPR10MB5218.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: jMYmhvHVPplcH7iIX58+ipcVf45IrmQazo8CkSmAPZteiU+rZonqMcsq5B2xov7cpAFNZArpTMb246Mk0LDMS9gXZ0tzvPLJivTodV0dNORL/Vu1j0ST96dJZZu68ZWQVGCn51w7UyAw4VfOi1KeNWfulyv8tY+OE05cbJY3gg/I3VNHieOLzyv+qaNB9HWd2qRfNKp+zOZwxf/7DgkrILp6nbQjbNF2DAQcedG2ltXIghwy2915JPBParAe2y/vpDbuWH9sVATM7rR9NmpDFbNTZrU2HLUzNGzdk/uBiyujtiNwi3Bg40z7s2zwP1oOvodq0FLig0b1hzBmUquJQvByYnrIuhNG6Y44PnZAs1dj9FTZSVSZkmV5vjj6X9FztnzCEgNnoY4X/3Znbyb+GQW5SkQ13eW81SGHQKFNQqU0+F41PkmTsIxNwicbSlxBksbYVesacX0dlxIHYgpYRoSU/21x3GlC6pC5+cvid5dPE4DoAgtwZAmJ+zKo5RbBWYJ7FSKAwBDXTSo6bLEN/5UViDhA1+03l3tQ0LfjYJt1XVikWdrM7vB8Mgmne3iOkO6jw3KMpUlvoI4xOVqcHbvPqzQmHYWSxI6IhjFrl2IL4ao3k8lQV7HP6lAY2EtIxpjKCa+/9Ju1qBlr+hucGT7MbKF6NNZOgIVRPBBqd7T+OlPbIXJZ+MCXFU7xUrcPFQcyXvQcdx0YSMROfoshcg== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BL0PR10MB3011.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(366004)(26005)(5660300002)(6486002)(186003)(6506007)(86362001)(6512007)(1076003)(36756003)(38100700002)(508600001)(8936002)(71200400001)(8676002)(122000001)(316002)(110136005)(76116006)(91956017)(2616005)(44832011)(7416002)(38070700005)(54906003)(4326008)(66556008)(2906002)(64756008)(83380400001)(66476007)(66946007)(66446008);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-1?q?90wVkpYu2epZ3DfUJ/ZeO2L?= =?iso-8859-1?q?URofGr7Cd1c53MHnumdZurTpCH1ALurGwwbnzHfZ7UTgy4nEEm00eBI2uFEQ?= =?iso-8859-1?q?WP9SzjHueP7tZg1avuCRTTD4bclM/FpGlP43AHiIp9rKiDcAWtrC9yHBDm5A?= =?iso-8859-1?q?9pRV2LzvK1Yx2a/ZiCj8C9T1t2PXowkhpfaSu+RokYlbacefpgQvt45uLRjz?= =?iso-8859-1?q?Y9mTpcpKYKiMh3f3p2zuzt0+MwgP6qp0T8EDW292KEQB3MLZfryLkGrV4mq3?= =?iso-8859-1?q?70/f6yrTx7Hug0DGqKjmjnGZrVD2of8mlr1rxCn4sSEnff/r9RXIeO5aA0iB?= =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YYKbpmEPqkVo7hmkUyzJQ/Wg2iWzoHfk9wnl9tlIMufKnc+Yd+/iF?= =?iso-8859-1?q?gUpk3FZo0xr8BnVHNJJsMjgals+c7ertlRKZjQNJZmX18qoBSiksv7NfH1ZQ?= =?iso-8859-1?q?vUN4Qk+LWnkcFTomCleLauItTSV0oGyLVzM2GbGj3CptoOZvKyPbZUuSrETf?= =?iso-8859-1?q?U?= x-ms-exchange-transport-forked: True 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: BL0PR10MB3011.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: fb3c1bf2-1c78-4128-9fb6-08d9879fb5a5 X-MS-Exchange-CrossTenant-originalarrivaltime: 05 Oct 2021 01:30:26.4977 (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: FrNY6y1BiOUjp1003/7JVcC0f/MzItaCxlBKMvs3X6f+jstt6zwK+gd+aqz4afzo2kbY2XvTlUThRoK0yV9Fgg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLAPR10MB5218 X-Proofpoint-Virus-Version: vendor=nai engine=6300 definitions=10127 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 adultscore=0 phishscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 suspectscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2109230001 definitions=main-2110050007 X-Proofpoint-GUID: qF2W1-rSckRvNCEQ-FCxKMnChj-yn5tR X-Proofpoint-ORIG-GUID: qF2W1-rSckRvNCEQ-FCxKMnChj-yn5tR Authentication-Results: imf07.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2021-07-09 header.b=MfiD08bs; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=Z26SBzb2; spf=none (imf07.hostedemail.com: domain of liam.howlett@oracle.com has no SPF policy when checking 205.220.165.32) smtp.mailfrom=liam.howlett@oracle.com; dmarc=pass (policy=none) header.from=oracle.com X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 4784A1001C87 X-Stat-Signature: mmowh4ccyx3eaayipt6so86xcwqamncr X-HE-Tag: 1633397451-742152 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;