From patchwork Wed May 4 01:07:42 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Liam R. Howlett" X-Patchwork-Id: 12836618 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 5C77CC433FE for ; Wed, 4 May 2022 01:07:50 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C200E6B0074; Tue, 3 May 2022 21:07:47 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B53E38D0003; Tue, 3 May 2022 21:07:47 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 899316B0075; Tue, 3 May 2022 21:07:47 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 48BBD6B0075 for ; Tue, 3 May 2022 21:07:47 -0400 (EDT) Received: from smtpin25.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay11.hostedemail.com (Postfix) with ESMTP id 2CBE380301 for ; Wed, 4 May 2022 01:07:47 +0000 (UTC) X-FDA: 79426273374.25.B76140A Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by imf18.hostedemail.com (Postfix) with ESMTP id ED27B1C0085 for ; Wed, 4 May 2022 01:07:38 +0000 (UTC) Received: from pps.filterd (m0246630.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 243LIGp3026258; Wed, 4 May 2022 01:07:45 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : subject : date : message-id : references : in-reply-to : content-type : content-transfer-encoding : mime-version; s=corp-2021-07-09; bh=/eX6NLsXus/aCvKX6/hTA8FBB3wGYhEify+xnO2FUW8=; b=pp+qI0IXpXhjCgtPB7kBYN25vc4kNC/DKehVHFIQ30Qdsy0C/OapRid+dYci67ZFmW5P yG21mDadT9sFsdzx0MS/XlpnLZ5z0PLleVLl8bhkRZ0mNteTWcoRIX0mMz5RKQuIyzSW SBPIXByHW0uERmfxbDbDx0tJytDTx01LcpS4BJGdJqnMosaqeHBEke4NdyBTUBH+ZUtt eSzdLXrFYMOAZHNmpH/xmSeOWBv8PQ/k73ct4a95cxAlhgsbBib/otVf0LdUbg2zWhy7 Ii0iKtbUgcuJBm8DuNWa0idBusY68SVhdeMoj0mhHyjUcdllvYobCMjmS3mRNhbbqrBR Qw== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3fruhc72gp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 04 May 2022 01:07:45 +0000 Received: from pps.filterd (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (8.16.1.2/8.16.1.2) with SMTP id 24416SuD039134; Wed, 4 May 2022 01:07:44 GMT Received: from nam12-mw2-obe.outbound.protection.outlook.com (mail-mw2nam12lp2047.outbound.protection.outlook.com [104.47.66.47]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com with ESMTP id 3fruj2wdk7-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 04 May 2022 01:07:44 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WBaM4Gx28YGgXWkUm7G1M4+VFgA/QRfJ0BJMdJDhxa49e0l/QAIfgIRHwJAHubHqvIPx0fw+ZkHmYP6+HAALvKxK0damN7mg3TtF7wc5s59FHPGidbLa0qod+d4GTJhnOShrd/iNPyDYUmQfHKL3qRVLkbGjuHhyYEHKal7y4RdSISmgfdEXORZfZjcKm3XXyO9cqpA6R8OhRgd8cVvguJn5ud9dNmcK5UxD3lFIGm3nidjPz+HJinFDWjrRrehRQMm52o/arEjDAz9oq7xg/TkHlRsZb38S+iki1gDqiq010+q8S14/BYlDHxNW0n5E3nIw/n/Xkgnhp6xE4EZ4zA== 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=/eX6NLsXus/aCvKX6/hTA8FBB3wGYhEify+xnO2FUW8=; b=DLGng/cuucbjT95QkH7sHhPDr0+6J5h2aMBuVkMcAU1+v6f0g+6w5YPWNwWHiR5EkyaREqHtncG2HNYDb8l67cpwcBiuBGEZvpDeeDxooO7za16KfIc/97WmkedRNAjpYd56O27r9oiBQsjEgnB2/zUylpFZXm7nvWOKu3+GIu6TlW8bd5ysj0vhEBu18WjluA2gz5xkW96xZxbCa3rQWyBvNO8AdTYPelL3D7ndU97ki8zPF0TVlyDseEa2sUxlxxYbRrIosrbU1WTshrt0LK5GV89/EDeMG45ByaWfQ/5b6iWvTjTa8S9lR3qLCegMtdORNBTJAFuzJxNuPOfiGw== 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=/eX6NLsXus/aCvKX6/hTA8FBB3wGYhEify+xnO2FUW8=; b=MWnUH3zycjELkCMgoRu0wvNqjXbB9iUlnAATFRjZlDQjkUsalDWIy+MKNrUTkumRzpVo5o/lyyvvrQ5//phXsCc+TYTOh/VWBLM+0y9FuHPgaQYf3WZ2wQP3vFL9dVFsBuyfTrIa90ta/xmGpFkLMUfT0Ntx+PQfmYI22DOJyPY= Received: from SN6PR10MB3022.namprd10.prod.outlook.com (2603:10b6:805:d8::25) by DM8PR10MB5445.namprd10.prod.outlook.com (2603:10b6:8:27::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5206.24; Wed, 4 May 2022 01:07:42 +0000 Received: from SN6PR10MB3022.namprd10.prod.outlook.com ([fe80::318c:d02:2280:c2c]) by SN6PR10MB3022.namprd10.prod.outlook.com ([fe80::318c:d02:2280:c2c%7]) with mapi id 15.20.5206.024; Wed, 4 May 2022 01:07:42 +0000 From: Liam Howlett To: "maple-tree@lists.infradead.org" , "linux-mm@kvack.org" , "linux-kernel@vger.kernel.org" , Andrew Morton Subject: [PATCH v9 03/69] radix tree test suite: add kmem_cache_set_non_kernel() Thread-Topic: [PATCH v9 03/69] radix tree test suite: add kmem_cache_set_non_kernel() Thread-Index: AQHYX1NbAJDDSBeQz0quSojrWOExlg== Date: Wed, 4 May 2022 01:07:42 +0000 Message-ID: <20220504010716.661115-5-Liam.Howlett@oracle.com> References: <20220504010716.661115-1-Liam.Howlett@oracle.com> In-Reply-To: <20220504010716.661115-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.35.1 x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: f7e3ce49-0ab8-4433-f23c-08da2d6a7d9e x-ms-traffictypediagnostic: DM8PR10MB5445:EE_ x-microsoft-antispam-prvs: x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 99vmaje/2wPaDXZ8okv1C0n1WqhmgVE+ccJg9keWiuZvzELpOgsy9K/bRzFyV4uBhwK4EWb3V6iA4D7/lHnF+Sj7vGkjjMM0RC142PUmM08+b73WiKgcjljoeFw4KlXGhKpzW2UpZ5wVoJ/27/DzxKS6NGVKxU41pdA30LDFZDXKQ1ulCAshdyIp2Zh9RocUhz2aS31ahOihd1rBMutvroTrih8UksTp46sndCB0Ld7nWwAp+B5IgwH4fYpcedHEni0Oi4O4TEtCd09XXcw1PpGvUTIylPfsR0+GqVHCArQOShYB6Ewo4c3xQjZI2K8DaVUyCRcUxG7Qmk6jcFWoxpEuOzS5ZreKV3VswJr4ciL0iFXYNt/WmmErs05CXdrL5PUf5El3Xo1S2Fl5v5+unmhqx9USI6nBEKJU1pv8SRyB9TyeMwZZFXO1W4iUiK2EUgb1HhqbG2C5y/WBGrakfhAVaTgXXTmQF0xEEBV/q+JuqgzX5plRpUGCgllFZx/OMGaHHzP2uSB1PBMVTznkdEKrLWaLmLg0TEVnb0G+m2/zu92qW+kH1M2xUVwVWNczXcXtyTX0ZNlCBcKcoyXa5dbSpyB43iqBzTzr/yMdT810YA2EhyNRDmYlMVOGbsbElK5HjGbjvbm56foRNLgLfiJ4jM5iWJZ80edorR/JO60qduOxDSx4QZYkkhXS9PTT8ZHGj0rHS/siqLG0WRS0cw== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SN6PR10MB3022.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230001)(366004)(2906002)(83380400001)(6506007)(26005)(5660300002)(36756003)(6512007)(1076003)(6486002)(508600001)(8936002)(38100700002)(110136005)(64756008)(66446008)(8676002)(71200400001)(66476007)(38070700005)(186003)(44832011)(122000001)(316002)(2616005)(76116006)(66946007)(66556008)(86362001);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-1?q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BhMTSu4kcZ/5i2km+JxJYO6dzO1IBWYYae0mfjDFI6Ut7OujWTHHm?= =?iso-8859-1?q?1BB/GXBg=3D?= MIME-Version: 1.0 X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: SN6PR10MB3022.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: f7e3ce49-0ab8-4433-f23c-08da2d6a7d9e X-MS-Exchange-CrossTenant-originalarrivaltime: 04 May 2022 01:07:42.2292 (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: HRmQtFC/LqIKy0iiA81A+H7w4PPtVX5BQ8ODqTVuDC9VKNkDT7fqIK9n77VTIuprP3huJhldlySSLtt9iS6vHQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM8PR10MB5445 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.486,18.0.858 definitions=2022-05-03_10:2022-05-02,2022-05-03 signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 suspectscore=0 mlxlogscore=999 spamscore=0 bulkscore=0 mlxscore=0 phishscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2205040005 X-Proofpoint-GUID: 2PHibPb4ZW3sRyJKYG4Y-pJKpOU9xrT- X-Proofpoint-ORIG-GUID: 2PHibPb4ZW3sRyJKYG4Y-pJKpOU9xrT- X-Rspamd-Queue-Id: ED27B1C0085 X-Stat-Signature: 9iszypdmjik515trmswx8eyhib5x3p48 X-Rspam-User: Authentication-Results: imf18.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2021-07-09 header.b=pp+qI0IX; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=MWnUH3zy; spf=none (imf18.hostedemail.com: domain of liam.howlett@oracle.com has no SPF policy when checking 205.220.177.32) smtp.mailfrom=liam.howlett@oracle.com; dmarc=pass (policy=none) header.from=oracle.com X-Rspamd-Server: rspam09 X-HE-Tag: 1651626458-610844 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: From: "Liam R. Howlett" kmem_cache_set_non_kernel() is a mechanism to allow a certain number of kmem_cache_alloc requests to succeed even when GFP_KERNEL is not set in the flags. This functionality allows for testing different paths though the code. Signed-off-by: Liam R. Howlett Signed-off-by: Matthew Wilcox (Oracle) --- tools/testing/radix-tree/linux.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/tools/testing/radix-tree/linux.c b/tools/testing/radix-tree/linux.c index d5c1bcba86fe..277aa8b70abc 100644 --- a/tools/testing/radix-tree/linux.c +++ b/tools/testing/radix-tree/linux.c @@ -23,15 +23,26 @@ struct kmem_cache { int nr_objs; void *objs; void (*ctor)(void *); + unsigned int non_kernel; }; +void kmem_cache_set_non_kernel(struct kmem_cache *cachep, unsigned int val) +{ + cachep->non_kernel = val; +} + void *kmem_cache_alloc_lru(struct kmem_cache *cachep, struct list_lru *lru, int gfp) + { void *p; - if (!(gfp & __GFP_DIRECT_RECLAIM)) - return NULL; + if (!(gfp & __GFP_DIRECT_RECLAIM)) { + if (!cachep->non_kernel) + return NULL; + + cachep->non_kernel--; + } pthread_mutex_lock(&cachep->lock); if (cachep->nr_objs) { @@ -90,5 +101,6 @@ kmem_cache_create(const char *name, unsigned int size, unsigned int align, ret->nr_objs = 0; ret->objs = NULL; ret->ctor = ctor; + ret->non_kernel = 0; return ret; }