From patchwork Thu Jan 27 13:21:19 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Karolina Drobnik X-Patchwork-Id: 12726792 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 ABF1FC433FE for ; Thu, 27 Jan 2022 13:22:38 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2A1076B0072; Thu, 27 Jan 2022 08:22:38 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 250A96B0073; Thu, 27 Jan 2022 08:22:38 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 13F596B0075; Thu, 27 Jan 2022 08:22:38 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0109.hostedemail.com [216.40.44.109]) by kanga.kvack.org (Postfix) with ESMTP id 06ADC6B0072 for ; Thu, 27 Jan 2022 08:22:38 -0500 (EST) Received: from smtpin10.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id BADCD83C3C for ; Thu, 27 Jan 2022 13:22:37 +0000 (UTC) X-FDA: 79076131554.10.81EABC3 Received: from mail-lf1-f54.google.com (mail-lf1-f54.google.com [209.85.167.54]) by imf02.hostedemail.com (Postfix) with ESMTP id B8E8B80035 for ; Thu, 27 Jan 2022 13:22:35 +0000 (UTC) Received: by mail-lf1-f54.google.com with SMTP id n8so5320599lfq.4 for ; Thu, 27 Jan 2022 05:22:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=FWO9YIEbl2WruOoU06oIsmAAcZW9kF52DRpY/EbaFsA=; b=O2Zbvkv9Qo3ikXFhJqnd1ezNZDO17wGjQRqAXzhVozz0qRI/n+bM+RFStWuqC51Fp3 L/QMuVP4sF4599qYyXAI53RB9inYqg0Eit18lqpeDQ/XuzWNSzOewA+MuX0SYhZkhdM2 UGSn+HQOxTEbon0NY/WcVG2d5HcB70yxD4K3NVW5AYHm7UJZWZ0UwJJTmRsou2i3o8GU ewBuMNLyXJ+MFCTPyWe9mIGmrXsDrzuR2n/JHlGKXyhourqIp1EcELodWwcMFmsqX8Rq ucnJZSB+aHqRHj1DzY/l89WnwdxnYtSjqcDYRLkNgGH9z198TbzKpH5I4m0MyckBlwu4 BC+Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=FWO9YIEbl2WruOoU06oIsmAAcZW9kF52DRpY/EbaFsA=; b=N9Qj85fNYDSkQcYDnA4Q8Gae30TG5VGM0e8Z7wUUW/KA/Hmns30mrzAhPui1K9wPQv DFnMdURFGm9aY6bkgi0lqb7uMTU++5G5ERM+iZl4UrJiJU5HTbVVvDng4pP/8xcMSBDr wuxnH4Rx/oynGRy/dRaznyoo1blYJVuczFh3dbbUXtIZ3XGkzidbXqeYzcE0WRYu07uj TMphWe9AdDJxUeBDzVat3IGUY6165pfoGmvUh3Y7WH+mWwmShqVYcAHQ8bTQ9CJaN8Qi squUntcVRT21ol/olgNheUW5z3zIZwfAma0n9U/BJFEnlbdwtf611+GaaM1nQzZ5RoIm j1Cg== X-Gm-Message-State: AOAM532WX+O+7ZCiyXAcJIYHMuwk5YO0CP8jWp6bUsmFTFzvkxaVZKOg 5WXgd+4P98xo8ikXp4xDWV2LZal3kAM= X-Google-Smtp-Source: ABdhPJwMjP9wKO8E6h1MFu/ndgKiDvcZg5RIQP5a7Qt7P6fabYmuMKOssUiblVY1O2jqwDj+i8h5pA== X-Received: by 2002:a05:6512:228f:: with SMTP id f15mr2957438lfu.115.1643289754311; Thu, 27 Jan 2022 05:22:34 -0800 (PST) Received: from elysium.toya.net.pl (staticline-31-183-166-172.toya.net.pl. [31.183.166.172]) by smtp.gmail.com with ESMTPSA id s16sm1306918lfp.197.2022.01.27.05.22.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jan 2022 05:22:33 -0800 (PST) From: Karolina Drobnik To: linux-mm@kvack.org Cc: akpm@linux-foundation.org, mike.rapoport@gmail.com, linux-kernel@vger.kernel.org, Karolina Drobnik Subject: [PATCH 01/16] tools: Move gfp.h and slab.h from radix-tree to lib Date: Thu, 27 Jan 2022 14:21:19 +0100 Message-Id: <777d0cfcf531357cfe39d53987aa964a3a42ce8b.1643206612.git.karolinadrobnik@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: References: MIME-Version: 1.0 Authentication-Results: imf02.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=O2Zbvkv9; spf=pass (imf02.hostedemail.com: domain of karolinadrobnik@gmail.com designates 209.85.167.54 as permitted sender) smtp.mailfrom=karolinadrobnik@gmail.com; dmarc=pass (policy=none) header.from=gmail.com X-Rspam-User: nil X-Rspamd-Queue-Id: B8E8B80035 X-Stat-Signature: bqkf47ektgoeiwjfq59zt84xe4uqh4qh X-Rspamd-Server: rspam12 X-HE-Tag: 1643289755-832709 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: Merge radix-tree definitions from gfp.h and slab.h with these in tools/lib, so they can be used in other test suites. Fix style issues in slab.h. Update radix-tree test files. Signed-off-by: Karolina Drobnik --- tools/include/linux/gfp.h | 28 ++++++++++++++ .../radix-tree => include}/linux/slab.h | 15 ++++---- tools/lib/slab.c | 38 +++++++++++++++++++ tools/testing/radix-tree/Makefile | 3 +- tools/testing/radix-tree/linux.c | 27 ------------- tools/testing/radix-tree/linux/gfp.h | 33 ---------------- 6 files changed, 76 insertions(+), 68 deletions(-) rename tools/{testing/radix-tree => include}/linux/slab.h (68%) create mode 100644 tools/lib/slab.c delete mode 100644 tools/testing/radix-tree/linux/gfp.h diff --git a/tools/include/linux/gfp.h b/tools/include/linux/gfp.h index 22030756fbc0..4dce3cddd134 100644 --- a/tools/include/linux/gfp.h +++ b/tools/include/linux/gfp.h @@ -1,4 +1,32 @@ +/* SPDX-License-Identifier: GPL-2.0 */ #ifndef _TOOLS_INCLUDE_LINUX_GFP_H #define _TOOLS_INCLUDE_LINUX_GFP_H +#include + +#define __GFP_ZERO 0x8000u +#define __GFP_DIRECT_RECLAIM 0x400000u + +#define __GFP_BITS_SHIFT 26 +#define __GFP_BITS_MASK ((gfp_t)((1 << __GFP_BITS_SHIFT) - 1)) + +#define __GFP_HIGH 0x20u +#define __GFP_IO 0x40u +#define __GFP_FS 0x80u +#define __GFP_NOWARN 0x200u +#define __GFP_ATOMIC 0x80000u +#define __GFP_ACCOUNT 0x100000u +#define __GFP_KSWAPD_RECLAIM 0x2000000u + +#define __GFP_RECLAIM (__GFP_DIRECT_RECLAIM | __GFP_KSWAPD_RECLAIM) +#define GFP_ZONEMASK 0x0fu +#define GFP_ATOMIC (__GFP_HIGH | __GFP_ATOMIC | __GFP_KSWAPD_RECLAIM) +#define GFP_KERNEL (__GFP_RECLAIM | __GFP_IO | __GFP_FS) +#define GFP_NOWAIT (__GFP_KSWAPD_RECLAIM) + +static inline bool gfpflags_allow_blocking(const gfp_t gfp_flags) +{ + return !!(gfp_flags & __GFP_DIRECT_RECLAIM); +} + #endif /* _TOOLS_INCLUDE_LINUX_GFP_H */ diff --git a/tools/testing/radix-tree/linux/slab.h b/tools/include/linux/slab.h similarity index 68% rename from tools/testing/radix-tree/linux/slab.h rename to tools/include/linux/slab.h index 2958830ce4d7..07d7930d4003 100644 --- a/tools/testing/radix-tree/linux/slab.h +++ b/tools/include/linux/slab.h @@ -1,20 +1,21 @@ /* SPDX-License-Identifier: GPL-2.0 */ -#ifndef SLAB_H -#define SLAB_H +#ifndef _TOOLS_SLAB_H +#define _TOOLS_SLAB_H #include #include -#define SLAB_HWCACHE_ALIGN 1 #define SLAB_PANIC 2 #define SLAB_RECLAIM_ACCOUNT 0x00020000UL /* Objects are reclaimable */ -void *kmalloc(size_t size, gfp_t); -void kfree(void *); +#define kzalloc_node(size, flags, node) kmalloc(size, flags) + +void *kmalloc(size_t size, gfp_t gfp); +void kfree(void *p); static inline void *kzalloc(size_t size, gfp_t gfp) { - return kmalloc(size, gfp | __GFP_ZERO); + return kmalloc(size, gfp | __GFP_ZERO); } void *kmem_cache_alloc(struct kmem_cache *cachep, int flags); @@ -24,4 +25,4 @@ struct kmem_cache *kmem_cache_create(const char *name, unsigned int size, unsigned int align, unsigned int flags, void (*ctor)(void *)); -#endif /* SLAB_H */ +#endif /* _TOOLS_SLAB_H */ diff --git a/tools/lib/slab.c b/tools/lib/slab.c new file mode 100644 index 000000000000..959997fb0652 --- /dev/null +++ b/tools/lib/slab.c @@ -0,0 +1,38 @@ +// SPDX-License-Identifier: GPL-2.0 + +#include +#include + +#include +#include +#include +#include + +int kmalloc_nr_allocated; +int kmalloc_verbose; + +void *kmalloc(size_t size, gfp_t gfp) +{ + void *ret; + + if (!(gfp & __GFP_DIRECT_RECLAIM)) + return NULL; + + ret = malloc(size); + uatomic_inc(&kmalloc_nr_allocated); + if (kmalloc_verbose) + printf("Allocating %p from malloc\n", ret); + if (gfp & __GFP_ZERO) + memset(ret, 0, size); + return ret; +} + +void kfree(void *p) +{ + if (!p) + return; + uatomic_dec(&kmalloc_nr_allocated); + if (kmalloc_verbose) + printf("Freeing %p to malloc\n", p); + free(p); +} diff --git a/tools/testing/radix-tree/Makefile b/tools/testing/radix-tree/Makefile index aa6abfe0749c..c4ea4fbb0bfc 100644 --- a/tools/testing/radix-tree/Makefile +++ b/tools/testing/radix-tree/Makefile @@ -5,7 +5,8 @@ CFLAGS += -I. -I../../include -g -Og -Wall -D_LGPL_SOURCE -fsanitize=address \ LDFLAGS += -fsanitize=address -fsanitize=undefined LDLIBS+= -lpthread -lurcu TARGETS = main idr-test multiorder xarray -CORE_OFILES := xarray.o radix-tree.o idr.o linux.o test.o find_bit.o bitmap.o +CORE_OFILES := xarray.o radix-tree.o idr.o linux.o test.o find_bit.o bitmap.o \ + slab.o OFILES = main.o $(CORE_OFILES) regression1.o regression2.o regression3.o \ regression4.o tag_check.o multiorder.o idr-test.o iteration_check.o \ iteration_check_2.o benchmark.o diff --git a/tools/testing/radix-tree/linux.c b/tools/testing/radix-tree/linux.c index 2d9c59df60de..81539f543954 100644 --- a/tools/testing/radix-tree/linux.c +++ b/tools/testing/radix-tree/linux.c @@ -14,7 +14,6 @@ int nr_allocated; int preempt_count; -int kmalloc_verbose; int test_verbose; struct kmem_cache { @@ -78,32 +77,6 @@ void kmem_cache_free(struct kmem_cache *cachep, void *objp) pthread_mutex_unlock(&cachep->lock); } -void *kmalloc(size_t size, gfp_t gfp) -{ - void *ret; - - if (!(gfp & __GFP_DIRECT_RECLAIM)) - return NULL; - - ret = malloc(size); - uatomic_inc(&nr_allocated); - if (kmalloc_verbose) - printf("Allocating %p from malloc\n", ret); - if (gfp & __GFP_ZERO) - memset(ret, 0, size); - return ret; -} - -void kfree(void *p) -{ - if (!p) - return; - uatomic_dec(&nr_allocated); - if (kmalloc_verbose) - printf("Freeing %p to malloc\n", p); - free(p); -} - struct kmem_cache * kmem_cache_create(const char *name, unsigned int size, unsigned int align, unsigned int flags, void (*ctor)(void *)) diff --git a/tools/testing/radix-tree/linux/gfp.h b/tools/testing/radix-tree/linux/gfp.h deleted file mode 100644 index 32159c08a52e..000000000000 --- a/tools/testing/radix-tree/linux/gfp.h +++ /dev/null @@ -1,33 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef _GFP_H -#define _GFP_H - -#include - -#define __GFP_BITS_SHIFT 26 -#define __GFP_BITS_MASK ((gfp_t)((1 << __GFP_BITS_SHIFT) - 1)) - -#define __GFP_HIGH 0x20u -#define __GFP_IO 0x40u -#define __GFP_FS 0x80u -#define __GFP_NOWARN 0x200u -#define __GFP_ZERO 0x8000u -#define __GFP_ATOMIC 0x80000u -#define __GFP_ACCOUNT 0x100000u -#define __GFP_DIRECT_RECLAIM 0x400000u -#define __GFP_KSWAPD_RECLAIM 0x2000000u - -#define __GFP_RECLAIM (__GFP_DIRECT_RECLAIM|__GFP_KSWAPD_RECLAIM) - -#define GFP_ZONEMASK 0x0fu -#define GFP_ATOMIC (__GFP_HIGH|__GFP_ATOMIC|__GFP_KSWAPD_RECLAIM) -#define GFP_KERNEL (__GFP_RECLAIM | __GFP_IO | __GFP_FS) -#define GFP_NOWAIT (__GFP_KSWAPD_RECLAIM) - - -static inline bool gfpflags_allow_blocking(const gfp_t gfp_flags) -{ - return !!(gfp_flags & __GFP_DIRECT_RECLAIM); -} - -#endif From patchwork Thu Jan 27 13:21:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Karolina Drobnik X-Patchwork-Id: 12726791 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 AA419C4332F for ; Thu, 27 Jan 2022 13:22:39 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 341556B0073; Thu, 27 Jan 2022 08:22:39 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 1DC976B0075; Thu, 27 Jan 2022 08:22:39 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0A3286B0078; Thu, 27 Jan 2022 08:22:39 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0190.hostedemail.com [216.40.44.190]) by kanga.kvack.org (Postfix) with ESMTP id F12A06B0073 for ; Thu, 27 Jan 2022 08:22:38 -0500 (EST) Received: from smtpin13.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id BC22B181D861A for ; Thu, 27 Jan 2022 13:22:38 +0000 (UTC) X-FDA: 79076131596.13.032AB1C Received: from mail-lf1-f46.google.com (mail-lf1-f46.google.com [209.85.167.46]) by imf04.hostedemail.com (Postfix) with ESMTP id 7BAD040038 for ; Thu, 27 Jan 2022 13:22:37 +0000 (UTC) Received: by mail-lf1-f46.google.com with SMTP id p27so5343105lfa.1 for ; Thu, 27 Jan 2022 05:22:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=tPBQi8ycxhPpw53EXEIDBSTw4oWSjfC+savcVruO6uA=; b=Tpaq7+XtiHccGdmKT2dHoLOUmnzNF+jfgtEk86QJIzlWNOHSysoJYKZ7Dqbi/kaJAO WkU0TxVs/FwZTd84TaKffKnwoEufv6KXABBbCUNEyhdHIyXHVUk9I3VYaBTc25ZHt60c pZM/wASw8EWb7NpExZuMVLf3zpNnGWNi1MeQM5Tj5lEGHUm8B+olnXufkAy0vH+hv5U7 fsA3H1GRaM6SH8ZkPrEiN0Jt+vgQNXVBMMAEcBr800FFQDTTvZtK6GHpYjOI6jn03xPi CfreNskhgv2nhcPmFFLQztCnB7SZOXPG4AfJ4SDky6ZE4DsN3vuR8F4jYUpevN2CHOPV Zb5Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=tPBQi8ycxhPpw53EXEIDBSTw4oWSjfC+savcVruO6uA=; b=WCFG+q2Go6KU/nhs9TJiX/wpA+Q8Z/Q6BjC2wWDkNJo2cIk6GUpKxBQuWbRqJ2KS8X jHa7chi3Du0LEfIZqP14pYgSyGlZphj1jZKK4eC4Sz5YWF4d8BOwJnhRJL1j/qpt8G5h 4mpKodKARW6vI8gz/pKFDNd07+dC7Mj6tkY/+6cyaW1BrnJNKBX0CHOQd6QkZqluW71r VJ3zQNmBgdf5RhHio4PGTJWAWmzSltHxyhez9220UcUeE29Dsq2F1Rg7utjIIz6dt16n h5b8baHM9xvpcUUk7l7scTWN0XVm4iXtFg+p2RuDdISaKDlMJIrV3O0fdUZqbAchQ4Pl QNAg== X-Gm-Message-State: AOAM531eP1cfFw7gMaA49V1jq9KPcG0WmRXultB/Q/Z+jjXm0FBPoTkd dZwlklVRXOgYflx/l0utERu1aTKxXZU= X-Google-Smtp-Source: ABdhPJwSkig+CIrvQ7RJLWbX3c1g4+OgDnSWHAkTP04VyFSrh+c+5R/3TRnzbH8VSa30R2THSSL5ng== X-Received: by 2002:ac2:4e08:: with SMTP id e8mr2910679lfr.266.1643289756126; Thu, 27 Jan 2022 05:22:36 -0800 (PST) Received: from elysium.toya.net.pl (staticline-31-183-166-172.toya.net.pl. [31.183.166.172]) by smtp.gmail.com with ESMTPSA id s16sm1306918lfp.197.2022.01.27.05.22.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jan 2022 05:22:35 -0800 (PST) From: Karolina Drobnik To: linux-mm@kvack.org Cc: akpm@linux-foundation.org, mike.rapoport@gmail.com, linux-kernel@vger.kernel.org, Karolina Drobnik Subject: [PATCH 02/16] tools/include: Add phys_addr_t to types.h Date: Thu, 27 Jan 2022 14:21:20 +0100 Message-Id: <0baedc091016e35d738a9439d9475371d00f8206.1643206612.git.karolinadrobnik@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: References: MIME-Version: 1.0 X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 7BAD040038 X-Stat-Signature: ddmgb8q8bmno7swne9m1p68j93g7n3hr Authentication-Results: imf04.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=Tpaq7+Xt; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf04.hostedemail.com: domain of karolinadrobnik@gmail.com designates 209.85.167.46 as permitted sender) smtp.mailfrom=karolinadrobnik@gmail.com X-Rspam-User: nil X-HE-Tag: 1643289757-415858 X-Bogosity: Ham, tests=bogofilter, spamicity=0.007151, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Update types.h file to include phys_addr_t typedef so it can be used in testing. Signed-off-by: Karolina Drobnik --- tools/include/linux/types.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tools/include/linux/types.h b/tools/include/linux/types.h index 6e14a533ab4e..35cedaf191e8 100644 --- a/tools/include/linux/types.h +++ b/tools/include/linux/types.h @@ -64,6 +64,12 @@ typedef __u64 __bitwise __be64; typedef __u16 __bitwise __sum16; typedef __u32 __bitwise __wsum; +#ifdef CONFIG_PHYS_ADDR_T_64BIT +typedef u64 phys_addr_t; +#else +typedef u32 phys_addr_t; +#endif + typedef struct { int counter; } atomic_t; From patchwork Thu Jan 27 13:21:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Karolina Drobnik X-Patchwork-Id: 12726793 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 4BAA0C433F5 for ; Thu, 27 Jan 2022 13:22:41 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7D9176B0075; Thu, 27 Jan 2022 08:22:40 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 6BE086B0078; Thu, 27 Jan 2022 08:22:40 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 53DC66B007B; Thu, 27 Jan 2022 08:22:40 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0224.hostedemail.com [216.40.44.224]) by kanga.kvack.org (Postfix) with ESMTP id 422E66B0075 for ; Thu, 27 Jan 2022 08:22:40 -0500 (EST) Received: from smtpin11.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id EED6C8249980 for ; Thu, 27 Jan 2022 13:22:39 +0000 (UTC) X-FDA: 79076131638.11.0EFE5F3 Received: from mail-lf1-f49.google.com (mail-lf1-f49.google.com [209.85.167.49]) by imf25.hostedemail.com (Postfix) with ESMTP id 7285EA0035 for ; Thu, 27 Jan 2022 13:22:39 +0000 (UTC) Received: by mail-lf1-f49.google.com with SMTP id n8so5320958lfq.4 for ; Thu, 27 Jan 2022 05:22:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=0AfNznDv6b7CrorpQrureC1eis+2zp1+WJpTDBcjrg8=; b=Tpzav9Qcow8f/pxSrd/1LhlA99lKNKxHITJN5mLMqV4a6/cCMgMQgzoRqzmYo0UA8s TEU5fIwe6djDHfsxziS2Z+MkiXuajna1PLxMA8cOYqFYsyuHpYNU7RX1BJgBEMSb89FA C+S5TTgbtxf/YyiJxJ+eRyBhC4A80K88oQ+reovHR1Ne8AKZDtcMw46xu1BnHkIAHlpM xS/Vj7bn/28RZlUyjTrpsztedS9tYivODL517FtuQLPCksXMOSb4R9axghrgtyyBz/xj 5vbbsY/o2cn/HLIBDFm8Kl+WdiJ8zp/kok17dRR3Zz/a1LJENuJkICdeqL1tX1RSZKu+ IEZA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=0AfNznDv6b7CrorpQrureC1eis+2zp1+WJpTDBcjrg8=; b=KXUSIre8di37CJnku3PQYf06orAt6tDcDE7WDGXZfWMIAIJRrkod+RQMmylkDnXmGp Q91tb0BmPVlbfKddjEgqM/WgX1bs56QIcw/LWdtCCBBA4YVbymYsJAJ4HBVUC/iCBG0X vF3nb0onLG2NbkP3GK3RMOYoOyja9ExAumGMX00JjvZT+ilBVDOEn89FDXXoTi2bvFc7 rHbiQc0HkBM7I6tv0F6VTCmcqskqkVOKt1u/QGnn1TBfH1ZdG3kdzKmcYOJC2uQ+Avv0 r8JPgSdQKxe2T9V/OTRUURU3YPGt/HCZVFhJj7lCcqjVg33654HRsD11JhJsF+SeoXxu paJg== X-Gm-Message-State: AOAM530jwBAtulJ/DTMuCkG5EdY8/QBRpTw8i6kY6uE6Iypn/7+Zi+L+ BzHz39UvpLj+5nqQ4tyXKBxsLu+wMF8= X-Google-Smtp-Source: ABdhPJyoeNuos9aqWTGAoXTpIpIZkPB0VXonEll0U9lZ8AVvbT5A+Shj4Tw++CheTL1P3HCnwpvKCA== X-Received: by 2002:a05:6512:128c:: with SMTP id u12mr2810354lfs.441.1643289758153; Thu, 27 Jan 2022 05:22:38 -0800 (PST) Received: from elysium.toya.net.pl (staticline-31-183-166-172.toya.net.pl. [31.183.166.172]) by smtp.gmail.com with ESMTPSA id s16sm1306918lfp.197.2022.01.27.05.22.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jan 2022 05:22:37 -0800 (PST) From: Karolina Drobnik To: linux-mm@kvack.org Cc: akpm@linux-foundation.org, mike.rapoport@gmail.com, linux-kernel@vger.kernel.org, Karolina Drobnik Subject: [PATCH 03/16] tools/include: Add _RET_IP_ and math definitions to kernel.h Date: Thu, 27 Jan 2022 14:21:21 +0100 Message-Id: <5baa036aadb6436c7c36589ce591baaf827aec0b.1643206612.git.karolinadrobnik@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: References: MIME-Version: 1.0 X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: 7285EA0035 X-Stat-Signature: zaahcnc8dsex6sus4zbn366sfowf95do Authentication-Results: imf25.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=Tpzav9Qc; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf25.hostedemail.com: domain of karolinadrobnik@gmail.com designates 209.85.167.49 as permitted sender) smtp.mailfrom=karolinadrobnik@gmail.com X-Rspam-User: nil X-HE-Tag: 1643289759-271977 X-Bogosity: Ham, tests=bogofilter, spamicity=0.074083, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Add max_t, min_t and clamp functions, together with _RET_IP_ definition, so they can be used in testing. Signed-off-by: Karolina Drobnik --- tools/include/linux/kernel.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tools/include/linux/kernel.h b/tools/include/linux/kernel.h index 9701e8307db0..4b0673bf52c2 100644 --- a/tools/include/linux/kernel.h +++ b/tools/include/linux/kernel.h @@ -15,6 +15,8 @@ #define UINT_MAX (~0U) #endif +#define _RET_IP_ ((unsigned long)__builtin_return_address(0)) + #define PERF_ALIGN(x, a) __PERF_ALIGN_MASK(x, (typeof(x))(a)-1) #define __PERF_ALIGN_MASK(x, mask) (((x)+(mask))&~(mask)) @@ -51,6 +53,10 @@ _min1 < _min2 ? _min1 : _min2; }) #endif +#define max_t(type, x, y) max((type)x, (type)y) +#define min_t(type, x, y) min((type)x, (type)y) +#define clamp(val, lo, hi) min((typeof(val))max(val, lo), hi) + #ifndef BUG_ON #ifdef NDEBUG #define BUG_ON(cond) do { if (cond) {} } while (0) From patchwork Thu Jan 27 13:21:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Karolina Drobnik X-Patchwork-Id: 12726794 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 4E515C433EF for ; Thu, 27 Jan 2022 13:22:43 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C3F1C6B0078; Thu, 27 Jan 2022 08:22:42 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id B516F6B007B; Thu, 27 Jan 2022 08:22:42 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9F3786B007D; Thu, 27 Jan 2022 08:22:42 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (relay.a.hostedemail.com [64.99.140.24]) by kanga.kvack.org (Postfix) with ESMTP id 7FB846B0078 for ; Thu, 27 Jan 2022 08:22:42 -0500 (EST) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay13.hostedemail.com (Postfix) with ESMTP id 46BC36126A for ; Thu, 27 Jan 2022 13:22:42 +0000 (UTC) X-FDA: 79076131764.02.38DC0DD Received: from mail-lj1-f178.google.com (mail-lj1-f178.google.com [209.85.208.178]) by imf19.hostedemail.com (Postfix) with ESMTP id 49E4D1A001F for ; Thu, 27 Jan 2022 13:22:41 +0000 (UTC) Received: by mail-lj1-f178.google.com with SMTP id c15so4239991ljf.11 for ; Thu, 27 Jan 2022 05:22:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=T8R8u/y1SMQUrHN6xG6XUjC1eIHn79OeaNWZhotIs0E=; b=fSYUxbVKRSvwPkl4pNB1gwAS5LgowfbuqJ3JrlRsxkfpXDrTP0UBI//31a2rA0Q3tk UXyuaVKDoLuTozxIPyM51x7fnvbrO/tExwh9G3B+R9B5iNMtfwUOMDx5sCrZxp/O80Ir 3PwCTus2Yl6xK03laCBfoo5JWrkSeWrcTuSwG1pNypIBTlWH45KBZedlzmlZBiwdyxAM tP57QMSjCZ/iA5zgJlUROnleuOWhN+yIpUYfpQWhvi54TWZWiUcJVFe1GFtQ+t3Npcnv UGVoeAZwuT8Ra/kQjRR2Yob2i0zBSaLiD7bh+yePLPALXOcpGaU6byCq+0l4gOSIQpEP 1eUQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=T8R8u/y1SMQUrHN6xG6XUjC1eIHn79OeaNWZhotIs0E=; b=vYNndjskLc7v4oxuquS7ZNnZ5NfldvdsdqxkQAdnjP6bXFAiKAf3dFjubpj8N76LIv uDIQb0mMFVtt72tXQcLky2mHDroN7HtZvzwX2toADqxR7TT8gncdNwpjbvAxv0OtKK7Z Yl+yDVmFwZwlCXg8pwoqiy6ehX6qL+H6zGKSdvFdzE2E/zdmDo0fYg/Ai3IdMI1Kyw/J feUMxmQv9PxihI7Mq7UW8yqIG0T1TaKT/v32hByJ6hZRSDda/VCBa8+g1UbXrlnfi+uS gcktXcnxBmLzWL6CkjvOmEDydM4sTAzsWL7aVD+GlmObAESGQ90NiLUOfExUui+1TeBT 3Ccw== X-Gm-Message-State: AOAM531xV8BTOiprf404kKugGywtxrr7Qcog4TlWapFUnacDFhgfVv1V PeTo8DgBjy4ug5nvOdVskFh2TUFhmaM= X-Google-Smtp-Source: ABdhPJxxR6hh92eR2oORQboC+bVMbj54WKUsdTR2rFidNqQWLEJ/4r5Om8UG7xkPh9pjotcZdAgd5g== X-Received: by 2002:a05:651c:19ac:: with SMTP id bx44mr2701574ljb.528.1643289759993; Thu, 27 Jan 2022 05:22:39 -0800 (PST) Received: from elysium.toya.net.pl (staticline-31-183-166-172.toya.net.pl. [31.183.166.172]) by smtp.gmail.com with ESMTPSA id s16sm1306918lfp.197.2022.01.27.05.22.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jan 2022 05:22:39 -0800 (PST) From: Karolina Drobnik To: linux-mm@kvack.org Cc: akpm@linux-foundation.org, mike.rapoport@gmail.com, linux-kernel@vger.kernel.org, Karolina Drobnik Subject: [PATCH 04/16] tools/include: Update atomic.h header Date: Thu, 27 Jan 2022 14:21:22 +0100 Message-Id: X-Mailer: git-send-email 2.30.2 In-Reply-To: References: MIME-Version: 1.0 X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 49E4D1A001F X-Stat-Signature: b4wcptj9qh6kz3nnahab1eficmnfq3mm X-Rspam-User: nil Authentication-Results: imf19.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=fSYUxbVK; spf=pass (imf19.hostedemail.com: domain of karolinadrobnik@gmail.com designates 209.85.208.178 as permitted sender) smtp.mailfrom=karolinadrobnik@gmail.com; dmarc=pass (policy=none) header.from=gmail.com X-HE-Tag: 1643289761-367508 X-Bogosity: Ham, tests=bogofilter, spamicity=0.001357, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Add atomic_long_t typedef and atomic_long_set function so they can be used in testing. Signed-off-by: Karolina Drobnik --- tools/include/linux/atomic.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tools/include/linux/atomic.h b/tools/include/linux/atomic.h index 00a6c4ca562b..5d2431889606 100644 --- a/tools/include/linux/atomic.h +++ b/tools/include/linux/atomic.h @@ -4,6 +4,10 @@ #include +typedef atomic_t atomic_long_t; + +void atomic_long_set(atomic_long_t *v, long i); + /* atomic_cmpxchg_relaxed */ #ifndef atomic_cmpxchg_relaxed #define atomic_cmpxchg_relaxed atomic_cmpxchg From patchwork Thu Jan 27 13:21:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Karolina Drobnik X-Patchwork-Id: 12726795 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 20868C433F5 for ; Thu, 27 Jan 2022 13:22:45 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6C2746B007D; Thu, 27 Jan 2022 08:22:44 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 589306B007E; Thu, 27 Jan 2022 08:22:44 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3B1346B0080; Thu, 27 Jan 2022 08:22:44 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0234.hostedemail.com [216.40.44.234]) by kanga.kvack.org (Postfix) with ESMTP id 1D6C06B007D for ; Thu, 27 Jan 2022 08:22:44 -0500 (EST) Received: from smtpin20.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 97DBE8249980 for ; Thu, 27 Jan 2022 13:22:43 +0000 (UTC) X-FDA: 79076131806.20.B3B74A9 Received: from mail-lf1-f47.google.com (mail-lf1-f47.google.com [209.85.167.47]) by imf30.hostedemail.com (Postfix) with ESMTP id 1E49A8003B for ; Thu, 27 Jan 2022 13:22:42 +0000 (UTC) Received: by mail-lf1-f47.google.com with SMTP id bu18so5301299lfb.5 for ; Thu, 27 Jan 2022 05:22:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=35RmHaXHeK6m669VGWye938TGxDNkaZqMu9rSBAQF5s=; b=YUcoE76+4sjVcbnKqrHIRVuvrkgseo+HMN6QisGZ1lJTQYR/7eyxgZ+HuTT/jDU6W6 RzXDKU5hXpi8CMeV2p/b7YwenLHUel2xK9gTf5LL8Yx7gbiJVjQuWoYgGtZ9xExLgECB 00teM8r52fpGevmEPEo6rjvmFosQrztHzHLVHzB8mah8QBWnD4A6iFfcTHumfVMJLSxN oiE4+svngvELyB8dNHCWXiCnDvHAO+tr2sOrag3gN9M2nWoZnCqvCtz7HKu5DdHj05W7 PBlR8viV1s66E1L2TmgbrNi5G+FXNBGkSOlTNfO1UmCbrX9T2QhVkOAv5q067eAiQq2G E0Ag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=35RmHaXHeK6m669VGWye938TGxDNkaZqMu9rSBAQF5s=; b=i4bb51VULTyT7gd5QQACGXMyzmBZw0+P5bcrnU4cbRwathEhdTdyK0VG6DWjXy9Ayq N7z/PCnZ+l3EwDhiVHGO1//n7VXxtl9t8bP3/ILTaNZYPKOoB+QMYdbhy3qItJ1Y4tZf UYqDBgQKr1d9gZM3Cr+3bnaUEvmu7xl9KhEebESCHzXPdzIa5Fw5SMRMYvZFuNxh/WaN fdDVnDH7X/Y7NdSx8X51g6D3TbsK74ggg1Y6gQ8QvfLtwME/N2mGxXXDRthWhG0l2609 ZHiWqhawehopgj8gXsEmfUmQFlAfFryUWdXxRUC+Co9spe8z9/GZNII9e+wTqaERqXZh JCnA== X-Gm-Message-State: AOAM533OfTNYvbKbE5DZ1wmhqKzAsHaePCtlpBVJZyopExb8Emseu2vK cdsXlAwq2IRwQTBwoN90XKr2W5SzByA= X-Google-Smtp-Source: ABdhPJxGXS3Ydevkg8USVm6RAv96Sx5DoiZwm7Oitp+enfsZwD5opc4AidIKoa6LRYzdGYv7EB3/EQ== X-Received: by 2002:a05:6512:128b:: with SMTP id u11mr2881216lfs.470.1643289761830; Thu, 27 Jan 2022 05:22:41 -0800 (PST) Received: from elysium.toya.net.pl (staticline-31-183-166-172.toya.net.pl. [31.183.166.172]) by smtp.gmail.com with ESMTPSA id s16sm1306918lfp.197.2022.01.27.05.22.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jan 2022 05:22:41 -0800 (PST) From: Karolina Drobnik To: linux-mm@kvack.org Cc: akpm@linux-foundation.org, mike.rapoport@gmail.com, linux-kernel@vger.kernel.org, Karolina Drobnik Subject: [PATCH 05/16] tools/include: Add mm.h file Date: Thu, 27 Jan 2022 14:21:23 +0100 Message-Id: <09f20db2ce4fa1dde0c397b0b6f8f8887af1078b.1643206612.git.karolinadrobnik@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: References: MIME-Version: 1.0 X-Rspam-User: nil X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: 1E49A8003B X-Stat-Signature: c6mwp4s6pd3ijhcj45fb55ibpme4pe71 Authentication-Results: imf30.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=YUcoE76+; spf=pass (imf30.hostedemail.com: domain of karolinadrobnik@gmail.com designates 209.85.167.47 as permitted sender) smtp.mailfrom=karolinadrobnik@gmail.com; dmarc=pass (policy=none) header.from=gmail.com X-HE-Tag: 1643289762-169949 X-Bogosity: Ham, tests=bogofilter, spamicity=0.001309, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Add a stubbed mm.h file with dummy page-related definitions, memory alignment and physical to virtual address conversions, so they can be used in testing. Signed-off-by: Karolina Drobnik --- tools/include/linux/mm.h | 42 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 tools/include/linux/mm.h -- 2.30.2 diff --git a/tools/include/linux/mm.h b/tools/include/linux/mm.h new file mode 100644 index 000000000000..a03d9bba5151 --- /dev/null +++ b/tools/include/linux/mm.h @@ -0,0 +1,42 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef _TOOLS_LINUX_MM_H +#define _TOOLS_LINUX_MM_H + +#include +#include + +#define PAGE_SHIFT 12 +#define PAGE_SIZE (_AC(1, UL) << PAGE_SHIFT) +#define PAGE_MASK (~(PAGE_SIZE - 1)) + +#define PHYS_ADDR_MAX (~(phys_addr_t)0) + +#define __ALIGN_KERNEL(x, a) __ALIGN_KERNEL_MASK(x, (typeof(x))(a) - 1) +#define __ALIGN_KERNEL_MASK(x, mask) (((x) + (mask)) & ~(mask)) +#define ALIGN(x, a) __ALIGN_KERNEL((x), (a)) +#define ALIGN_DOWN(x, a) __ALIGN_KERNEL((x) - ((a) - 1), (a)) + +#define PAGE_ALIGN(addr) ALIGN(addr, PAGE_SIZE) + +#define __va(x) ((void *)((unsigned long)(x))) +#define __pa(x) ((unsigned long)(x)) + +#define pfn_to_page(pfn) ((void *)((pfn) * PAGE_SIZE)) + +#define phys_to_virt phys_to_virt +static inline void *phys_to_virt(unsigned long address) +{ + return __va(address); +} + +void reserve_bootmem_region(phys_addr_t start, phys_addr_t end); + +static inline void totalram_pages_inc(void) +{ +} + +static inline void totalram_pages_add(long count) +{ +} + +#endif From patchwork Thu Jan 27 13:21:24 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Karolina Drobnik X-Patchwork-Id: 12726796 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 1D457C433F5 for ; Thu, 27 Jan 2022 13:22:48 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A1B4D6B0080; Thu, 27 Jan 2022 08:22:47 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 9C9F16B0081; Thu, 27 Jan 2022 08:22:47 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 86C146B0082; Thu, 27 Jan 2022 08:22:47 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0199.hostedemail.com [216.40.44.199]) by kanga.kvack.org (Postfix) with ESMTP id 74F2A6B0080 for ; Thu, 27 Jan 2022 08:22:47 -0500 (EST) Received: from smtpin12.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 2D0DF92EC1 for ; Thu, 27 Jan 2022 13:22:47 +0000 (UTC) X-FDA: 79076131974.12.29F03BB Received: from mail-lj1-f173.google.com (mail-lj1-f173.google.com [209.85.208.173]) by imf18.hostedemail.com (Postfix) with ESMTP id A18361C003A for ; Thu, 27 Jan 2022 13:22:46 +0000 (UTC) Received: by mail-lj1-f173.google.com with SMTP id t14so4258488ljh.8 for ; Thu, 27 Jan 2022 05:22:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Z3WKe5MuRmY4zN4IvItxJ8jznSVtPjz9vO4zFd861RQ=; b=T66Injwrec5LwBXZnsP7VFbYqMrxRvYvxH213pyAiI9MatiLYgAXZUG4baoxb9SdoN zXRnHcMI3VFWnwAVspqlbxQ/kBbEExqseE3QLYuexEmmxzQyzdIO1mwKcnIU3qFovZRe axntKsmgOA6YIiqEnZKi1hdhr9ySsXO+ufvx/UnYYhj0vIlglhCU1fFsPDo9q8bqxZjh 4XCjhpHFLz24tQWje+FwpBjbdj7keLnECIkrakQRcGMhqU3Ceh8A9O6JRzWAgC9DntlY XK/ghA7MXVN/dIdTqSurh+eu1eodFL1aMJMFV1PgoK3CgP2Jl8199aBXVyj5AKL7aYAW q6RA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Z3WKe5MuRmY4zN4IvItxJ8jznSVtPjz9vO4zFd861RQ=; b=UcS7jwtHbnjoXOtosbQKE0IjYaB9P5j2322naerjQ0ljA7VgczTT9sWqkiPGeaQmux A1qpmkvHYKj9kVsyN6hygOM4ajbjpRO/cQU1NAaQlj8Av0DtCTkh9mVgGG2RMkKTra1h ap6N66JEVVVOUygcBZZBlnqFYanuLLJY5zcp0RTnyBEeLe4nC7pcsFQFZ4vnznFjtkZf zRJU8MmFYk9P1FUJSZeUCQl1Yr4eT/QOvwFupOw1akE1oU1v2XUMvfpxGj1ZhsPUacel z5yE1J1m6iu/xdiLrwsCe75Hs2F7MC+zWG1JPQ6sk9YFmygfnm7tjIOYZPPrCPlUG7xu YH+Q== X-Gm-Message-State: AOAM531qiEjtI4N43R+/HpwT9dvVmOYR5du3jzvGGclvcTjBkxt0h/1e P9CJhANVg0UJAiHQE9hAlYIwtpSeg5A= X-Google-Smtp-Source: ABdhPJxy2gXRtc5o8b2nv144G8N91GofksrX0f+NfvkffEZSILog5gQNtT8qgbvgJ5Um3bJMR2RcZg== X-Received: by 2002:a2e:1f02:: with SMTP id f2mr2753589ljf.364.1643289764862; Thu, 27 Jan 2022 05:22:44 -0800 (PST) Received: from elysium.toya.net.pl (staticline-31-183-166-172.toya.net.pl. [31.183.166.172]) by smtp.gmail.com with ESMTPSA id s16sm1306918lfp.197.2022.01.27.05.22.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jan 2022 05:22:43 -0800 (PST) From: Karolina Drobnik To: linux-mm@kvack.org Cc: akpm@linux-foundation.org, mike.rapoport@gmail.com, linux-kernel@vger.kernel.org, Karolina Drobnik Subject: [PATCH 06/16] tools/include: Add cache.h stub Date: Thu, 27 Jan 2022 14:21:24 +0100 Message-Id: X-Mailer: git-send-email 2.30.2 In-Reply-To: References: MIME-Version: 1.0 X-Stat-Signature: o9jog331q6rpypjeh8abwyd751g4fqq8 X-Rspam-User: nil Authentication-Results: imf18.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=T66Injwr; spf=pass (imf18.hostedemail.com: domain of karolinadrobnik@gmail.com designates 209.85.208.173 as permitted sender) smtp.mailfrom=karolinadrobnik@gmail.com; dmarc=pass (policy=none) header.from=gmail.com X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: A18361C003A X-HE-Tag: 1643289766-638088 X-Bogosity: Ham, tests=bogofilter, spamicity=0.078143, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Add a dummy version of the cache header. Signed-off-by: Karolina Drobnik --- tools/include/linux/cache.h | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 tools/include/linux/cache.h diff --git a/tools/include/linux/cache.h b/tools/include/linux/cache.h new file mode 100644 index 000000000000..ff010a11f47d --- /dev/null +++ b/tools/include/linux/cache.h @@ -0,0 +1,10 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef _TOOLS_LINUX_CACHE_H +#define _TOOLS_LINUX_CACHE_H + +#define L1_CACHE_SHIFT 5 +#define L1_CACHE_BYTES BIT(L1_CACHE_SHIFT) + +#define SMP_CACHE_BYTES L1_CACHE_BYTES + +#endif From patchwork Thu Jan 27 13:21:25 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Karolina Drobnik X-Patchwork-Id: 12726797 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 9FE20C4332F for ; Thu, 27 Jan 2022 13:22:49 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 1B67E6B0082; Thu, 27 Jan 2022 08:22:49 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 0F1906B0083; Thu, 27 Jan 2022 08:22:48 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D9C736B0085; Thu, 27 Jan 2022 08:22:48 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0083.hostedemail.com [216.40.44.83]) by kanga.kvack.org (Postfix) with ESMTP id C17576B0082 for ; Thu, 27 Jan 2022 08:22:48 -0500 (EST) Received: from smtpin14.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 8BBF092747 for ; Thu, 27 Jan 2022 13:22:48 +0000 (UTC) X-FDA: 79076132016.14.143A790 Received: from mail-lj1-f176.google.com (mail-lj1-f176.google.com [209.85.208.176]) by imf01.hostedemail.com (Postfix) with ESMTP id 38D984002F for ; Thu, 27 Jan 2022 13:22:48 +0000 (UTC) Received: by mail-lj1-f176.google.com with SMTP id c15so4240445ljf.11 for ; Thu, 27 Jan 2022 05:22:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=yT95iXzR6dpzPFKNDISp4lTVmaXmzkxChM4JvbaJZPc=; b=l3x6b8iRrWCQ8gKFWVBWoWc5uvelzzEri/BmCVuHLaBZAr2TgNdXinohv62fA8viIb MTOT9kzcRJBLLELVAB1AbyJLAqzq0I4T8i2ZnThFbFD1YSIWtb8Hyt+RyCx5dSvzhxuO k8/+aLI2f+U9vsdK0LMTJ3Sd7oEnYMfFZsTwpMmU0kjqAWuB0vlho/ccg5xqEJYQot/O 9dIuFrgJHnok6sJ7BRIt2mHAwYLKOGnrCc2C5sDCdgExX6ev6fZDxaSOJPkKeMjIaoWy KOhfG3AfydNsshsHDQ0LNbevdWjRgrCSdwQePRPMMp9rUiNcI59umvshf0Lll4tyXjvp 1ZUw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=yT95iXzR6dpzPFKNDISp4lTVmaXmzkxChM4JvbaJZPc=; b=lSVSW6v4x/7cEEjqQVM3wAm/y2GVpBox5m+5dvExuJtl6meFvHmH2mYDXDdLTE8XdU TmFSzjbslSn1I4+29ctPH8zNgEin3v9gHV6MFZqYQdKtq5jqpnZD4YjpkFMYKyyucmlj yIqOKxFE21CYhX0lw8nkVH2PmLopjOE0dPRwljvA2Fhy4VpXOLqWMm0pSYQtoaT7XJUZ QHvCiB+Aw6KcfqCEhXE6U1IDHN+3zUj+gW5CTj76Y+3v/P/CnIYzPvuW0ryzROsjLVsd 5hfNkP4HAfiw45M8OCMVLwNVg/HUhkQLqMi7AY8KdkvuFV9P3UR/RnJqLMyXW8vjGhex A6+A== X-Gm-Message-State: AOAM531488oK0Y0vJE+KR0VstjuGRb+4eVkuFQTKsTUJoo+OcjLdcMhN cN3z9zVFTQFwvDU7nW7O5wnLeMRqSo4= X-Google-Smtp-Source: ABdhPJyihm0hkJ2ppnMAbeewpve4xm0MzXpLFvYL2OMFS4t93zSc/rcbDcVP8gUJOX3HOgjuujjnEQ== X-Received: by 2002:a05:651c:104e:: with SMTP id x14mr2764415ljm.23.1643289766913; Thu, 27 Jan 2022 05:22:46 -0800 (PST) Received: from elysium.toya.net.pl (staticline-31-183-166-172.toya.net.pl. [31.183.166.172]) by smtp.gmail.com with ESMTPSA id s16sm1306918lfp.197.2022.01.27.05.22.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jan 2022 05:22:46 -0800 (PST) From: Karolina Drobnik To: linux-mm@kvack.org Cc: akpm@linux-foundation.org, mike.rapoport@gmail.com, linux-kernel@vger.kernel.org, Karolina Drobnik Subject: [PATCH 07/16] tools/include: Add io.h stub Date: Thu, 27 Jan 2022 14:21:25 +0100 Message-Id: <2d9aa000afe81b45157617664134b871207c2067.1643206612.git.karolinadrobnik@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: References: MIME-Version: 1.0 X-Stat-Signature: qc3gc88d3fhcr5gp3sgnhxo61tp11csj X-Rspam-User: nil Authentication-Results: imf01.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=l3x6b8iR; spf=pass (imf01.hostedemail.com: domain of karolinadrobnik@gmail.com designates 209.85.208.176 as permitted sender) smtp.mailfrom=karolinadrobnik@gmail.com; dmarc=pass (policy=none) header.from=gmail.com X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: 38D984002F X-HE-Tag: 1643289768-703726 X-Bogosity: Ham, tests=bogofilter, spamicity=0.118036, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Add a dummy io.h header. Signed-off-by: Karolina Drobnik --- tools/include/linux/io.h | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 tools/include/linux/io.h diff --git a/tools/include/linux/io.h b/tools/include/linux/io.h new file mode 100644 index 000000000000..e129871fe661 --- /dev/null +++ b/tools/include/linux/io.h @@ -0,0 +1,5 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef _TOOLS_IO_H +#define _TOOLS_IO_H + +#endif From patchwork Thu Jan 27 13:21:26 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Karolina Drobnik X-Patchwork-Id: 12726798 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 8E3CBC433F5 for ; Thu, 27 Jan 2022 13:22:51 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D7B606B0085; Thu, 27 Jan 2022 08:22:50 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id D4DB26B0087; Thu, 27 Jan 2022 08:22:50 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C15B26B0088; Thu, 27 Jan 2022 08:22:50 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0063.hostedemail.com [216.40.44.63]) by kanga.kvack.org (Postfix) with ESMTP id 9A7CD6B0085 for ; Thu, 27 Jan 2022 08:22:50 -0500 (EST) Received: from smtpin31.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 5E10793D6D for ; Thu, 27 Jan 2022 13:22:50 +0000 (UTC) X-FDA: 79076132100.31.9885796 Received: from mail-lj1-f172.google.com (mail-lj1-f172.google.com [209.85.208.172]) by imf18.hostedemail.com (Postfix) with ESMTP id 03DA31C003A for ; Thu, 27 Jan 2022 13:22:49 +0000 (UTC) Received: by mail-lj1-f172.google.com with SMTP id c7so3763510ljr.13 for ; Thu, 27 Jan 2022 05:22:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=sNs/YC3QiYenr3GANxWYR7pSc71WK+SMMsFAwX5F+fg=; b=bo5jfQso9TY3UU96h2gnRTXgYv/XKjYblbfYnmqLkmzAihU16AsudndNYWsjC6mK50 GgeVDjKpSqb3OMwdukhaQw9zPl/+ahmPt1wir3eqgiLoamT1jTWK/2H2TrDFVUGgG/Ud G70wtPfe29t3I/NDPgKUDRdXkfTKLQ+TDYeFCCMSolNlhNDvaKLRmRxQT9AR+0saiCti 2YP7JVQZiJ/tidivMdkD3Wq9U8YnHygxwCrvybKy4/xA4XzTLcska4TsSV61XUcb2I7T pZ3Am+2sR5a4bZ688u99NDGkvcv9QBI8dhYamJakKyQ4GGVNl6vz4b3b/3fo7sLp8XKc UF0w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=sNs/YC3QiYenr3GANxWYR7pSc71WK+SMMsFAwX5F+fg=; b=MMqI3i5+MJ56l7NEuvz5FhjNoEcsf2C2KAV3bOhrq8KPnLwgDYXakgN1j0325K6eIQ z8KnucvlUawpuhTwfExfRz23LeOuzt2b7heZi5xcgeGMqPbm5+pcgS6/c7od9gllNcXi Pfli/TTB1D2Mi1Kt7jqrQflUW6FHGoylo/0tajraQ2VHL+F3AcjorgTGpmqZZ42b483I Wfzr3e6wRW13rPvPdjgFH0GHtLBawOM9LCF/va7JI1n5UBRtHhsGUbJvJktAlerR3H0w GYsyjgpNS7RCW7gPf0NDqmf33XI10yUXiqNsnFKxXEhdYK+AnhSvkeNYQqdoOZW3Y8Gt Uj6Q== X-Gm-Message-State: AOAM531kZCGzLR81omVR6XKHQb7XBKSQ+M1vyzooNI6vm6a3j8TEUK2A Rbq+MAbLUzGojvDGmwlUHKiprZ5nLTk= X-Google-Smtp-Source: ABdhPJxy6RE/jb21DtuvNjU+DrPHz0yY5OTVBMOvY6qI1VkkJ67hh4MQHRIeGU+WNnEjyN960wd5xQ== X-Received: by 2002:a2e:9cd5:: with SMTP id g21mr2771938ljj.246.1643289768611; Thu, 27 Jan 2022 05:22:48 -0800 (PST) Received: from elysium.toya.net.pl (staticline-31-183-166-172.toya.net.pl. [31.183.166.172]) by smtp.gmail.com with ESMTPSA id s16sm1306918lfp.197.2022.01.27.05.22.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jan 2022 05:22:48 -0800 (PST) From: Karolina Drobnik To: linux-mm@kvack.org Cc: akpm@linux-foundation.org, mike.rapoport@gmail.com, linux-kernel@vger.kernel.org, Karolina Drobnik Subject: [PATCH 08/16] tools/include: Add pfn.h stub Date: Thu, 27 Jan 2022 14:21:26 +0100 Message-Id: <62d0484f651bde15938c6faa9cc1b95388cfd329.1643206612.git.karolinadrobnik@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: References: MIME-Version: 1.0 X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: 03DA31C003A X-Stat-Signature: izp71po6z3fowcbwh5q5nkc849rt34gw Authentication-Results: imf18.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=bo5jfQso; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf18.hostedemail.com: domain of karolinadrobnik@gmail.com designates 209.85.208.172 as permitted sender) smtp.mailfrom=karolinadrobnik@gmail.com X-Rspam-User: nil X-HE-Tag: 1643289769-510789 X-Bogosity: Ham, tests=bogofilter, spamicity=0.081984, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Add a stubbed pfn header with definitions used in testing. Signed-off-by: Karolina Drobnik --- tools/include/linux/pfn.h | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 tools/include/linux/pfn.h diff --git a/tools/include/linux/pfn.h b/tools/include/linux/pfn.h new file mode 100644 index 000000000000..7512a58189eb --- /dev/null +++ b/tools/include/linux/pfn.h @@ -0,0 +1,10 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef _TOOLS_LINUX_PFN_H_ +#define _TOOLS_LINUX_PFN_H_ + +#include + +#define PFN_UP(x) (((x) + PAGE_SIZE - 1) >> PAGE_SHIFT) +#define PFN_DOWN(x) ((x) >> PAGE_SHIFT) +#define PFN_PHYS(x) ((phys_addr_t)(x) << PAGE_SHIFT) +#endif From patchwork Thu Jan 27 13:21:27 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Karolina Drobnik X-Patchwork-Id: 12726799 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 641D7C433FE for ; Thu, 27 Jan 2022 13:22:53 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id EFDF06B0088; Thu, 27 Jan 2022 08:22:52 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id E86436B0089; Thu, 27 Jan 2022 08:22:52 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CD9076B008A; Thu, 27 Jan 2022 08:22:52 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0137.hostedemail.com [216.40.44.137]) by kanga.kvack.org (Postfix) with ESMTP id B6C416B0088 for ; Thu, 27 Jan 2022 08:22:52 -0500 (EST) Received: from smtpin28.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 7BCF8181CBC11 for ; Thu, 27 Jan 2022 13:22:52 +0000 (UTC) X-FDA: 79076132184.28.99D8D3B Received: from mail-lf1-f44.google.com (mail-lf1-f44.google.com [209.85.167.44]) by imf02.hostedemail.com (Postfix) with ESMTP id EE8538000D for ; Thu, 27 Jan 2022 13:22:51 +0000 (UTC) Received: by mail-lf1-f44.google.com with SMTP id n8so5322259lfq.4 for ; Thu, 27 Jan 2022 05:22:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=xpVlgTajQnqvJqRBDECMdTOPT5OH4VewpY+I2k89SJw=; b=Fc7RyjvN2P/MMNY+073yQvT0fuI5+/QBlZLBP4WGdpj05lpGHeUbxdUbtfWtGgtSG8 9ldcb8VjtZXqCtNgd7bg6/pLb357CdIJTg5lIpDepmG3aE4jGVmeR4ellyebalknS252 uMETIjWVpmjcKxplVluodcNqbn0RjLFCmkDj/Wou99EjgiBBlk/Bed+9NnzfFj29JjiH ijUwOgRg8l0NNhIZcfYml4qunWGLqwCW05JGwI3vjuQzLjENs0tksQaI7dNhhlEleiWc U4yR8iMSI5wpkPSjK8/O6BdIZaZ6nN50szfAqQccYqfeKjCXq/B1ceBo5h9VcJxeMASo gEQA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=xpVlgTajQnqvJqRBDECMdTOPT5OH4VewpY+I2k89SJw=; b=t8D1Vl3G0ni/ZkzCBSsvJUhry5mi+GKJYQiw0juairmdKT5GMcBb4lqlgTPjHheXIe RZI8pZMLPgOOQ6vaQNcR3ZD/F/7Ehax9vVzXFY/X9ESHXdp/SSiQa56ZrabC5J5zO8fX u4XzbTJ0doPG2ketQ/8i+wTiZPskhdAD1vzjfoycE19PK+uE/7UhNq5zQMkTSuejcZL+ s6U3hPeuTCV1yhUsKfiUFzeisYYIFxNs6HvnaSSrrl2aDAlKnGhIEoRvQIPJaPezZ/GW LEKTNLwQGq+wsZv0z6Rt49GToLLh3UZjpgsh+9Zzl9SUnAOYNwfpC8hjwc+p0Mye34TS aO3A== X-Gm-Message-State: AOAM530XsGAU6Pmg1dS1IElyqgcB7lWYuN3ERgwvRaeVj4K6DiqPMKH8 394GI67Etms6IM53pDG8S1SHoddwCYU= X-Google-Smtp-Source: ABdhPJzeX3TZdWKhhlRjwG4LqWA2iq8Of5FsUyIyEWBOvklizbRwHs2mLSF1sgLqvjbEIbno0nwMWA== X-Received: by 2002:ac2:4196:: with SMTP id z22mr3065815lfh.36.1643289770688; Thu, 27 Jan 2022 05:22:50 -0800 (PST) Received: from elysium.toya.net.pl (staticline-31-183-166-172.toya.net.pl. [31.183.166.172]) by smtp.gmail.com with ESMTPSA id s16sm1306918lfp.197.2022.01.27.05.22.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jan 2022 05:22:50 -0800 (PST) From: Karolina Drobnik To: linux-mm@kvack.org Cc: akpm@linux-foundation.org, mike.rapoport@gmail.com, linux-kernel@vger.kernel.org, Karolina Drobnik Subject: [PATCH 09/16] tools/include: Add debugfs.h stub Date: Thu, 27 Jan 2022 14:21:27 +0100 Message-Id: X-Mailer: git-send-email 2.30.2 In-Reply-To: References: MIME-Version: 1.0 X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: EE8538000D X-Stat-Signature: se4n3e7h4a1sjg8ngtouskt84zowk9gk Authentication-Results: imf02.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=Fc7RyjvN; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf02.hostedemail.com: domain of karolinadrobnik@gmail.com designates 209.85.167.44 as permitted sender) smtp.mailfrom=karolinadrobnik@gmail.com X-Rspam-User: nil X-HE-Tag: 1643289771-789927 X-Bogosity: Ham, tests=bogofilter, spamicity=0.026279, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Add a dummy debugfs.h header. Signed-off-by: Karolina Drobnik --- tools/include/linux/debugfs.h | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 tools/include/linux/debugfs.h diff --git a/tools/include/linux/debugfs.h b/tools/include/linux/debugfs.h new file mode 100644 index 000000000000..4ba06140b1be --- /dev/null +++ b/tools/include/linux/debugfs.h @@ -0,0 +1,5 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef _TOOLS_DEBUGFS_H +#define _TOOLS_DEBUGFS_H + +#endif From patchwork Thu Jan 27 13:21:28 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Karolina Drobnik X-Patchwork-Id: 12726800 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 1F827C433F5 for ; Thu, 27 Jan 2022 13:22:57 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A900F6B008A; Thu, 27 Jan 2022 08:22:56 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id A3F2A6B008C; Thu, 27 Jan 2022 08:22:56 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8B8266B0092; Thu, 27 Jan 2022 08:22:56 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0173.hostedemail.com [216.40.44.173]) by kanga.kvack.org (Postfix) with ESMTP id 78C156B008A for ; Thu, 27 Jan 2022 08:22:56 -0500 (EST) Received: from smtpin23.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 3943192747 for ; Thu, 27 Jan 2022 13:22:56 +0000 (UTC) X-FDA: 79076132352.23.6DDD463 Received: from mail-lf1-f42.google.com (mail-lf1-f42.google.com [209.85.167.42]) by imf30.hostedemail.com (Postfix) with ESMTP id D767180047 for ; Thu, 27 Jan 2022 13:22:54 +0000 (UTC) Received: by mail-lf1-f42.google.com with SMTP id u6so5258688lfm.10 for ; Thu, 27 Jan 2022 05:22:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=BH2NLT8SGNgoeYwUFav/BNXbEd+bbRySz4smjmCbJyI=; b=a0hCYDmnHMUzt9DaEUCi7Qi35Es4vjKwKLpGRoW9kwIHD/tquKia/+ZDAhuzLpZT9c IPzVD2ruD3bPh5bGA9pZDR1h3zPKWUc4zaZ81MpzWRddI3MD/1ktg7j6/WyOOk1dYi0w HKuPK3OoT1T4iIrs3mJTd0dVyCLJOjvecRbuCpAwt2dO571bHYer7cdkmxDAQii7v51m fgE+FxNB3J5yoWAHpUc9Iw+L2YNr06htXm9i58TfYl8f53F+a+T2F3B1jLJKLaZTZRJY 8AVqcgWjz1Jjh650OmZVZZYNumh5Bd3meqTo03LptCqMSkC7QPcLNsNkROvk28jRtqBw L6QA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=BH2NLT8SGNgoeYwUFav/BNXbEd+bbRySz4smjmCbJyI=; b=5HqsOn0UYEZEL2sd7z/LVDkTc0cq9lBlX+/8wKOmLE0jtZ65V91x9c3TW6dgnolB6n IAuaOQSXF8KdYNVHMBMgrkPGwPeRJ8+xKvGYOUInCR8+C7dqNkfYZXJNscdEqeT0YZ2r YFjpiMTmEcwgJH9zH8IPf2rf8EgUOiMqDukwQ/Belkn5oVa7hAI7Vc+RUVEG+YHUyx7a WkLe77XVURLm6TiUNr02I5v2js9mWr6IdVK1OaH6QS8refH3Ox029DZDOqViYqmsxgbO /4ZKSsuI5XDAZ0DqHLL7fM+tZa+wjTGGdWD81Cw/KXaevNUjGi8fxrEYG/yG0g40MEAY do5w== X-Gm-Message-State: AOAM532s2O7xjHKDP9zh7tQnlLFFJMF76kcHRgW4h6J8lI1X03pA3e54 1hdFkfd5ZKHjW+EYVxjhEScDrwjXt9s= X-Google-Smtp-Source: ABdhPJxJozDlM11qrB40IjrfS6qRCBytDJ8ZgBKOwJs4RkPUdfzovloH0XJXyL2lXPAMX56nCWTArA== X-Received: by 2002:ac2:5186:: with SMTP id u6mr3027485lfi.519.1643289773372; Thu, 27 Jan 2022 05:22:53 -0800 (PST) Received: from elysium.toya.net.pl (staticline-31-183-166-172.toya.net.pl. [31.183.166.172]) by smtp.gmail.com with ESMTPSA id s16sm1306918lfp.197.2022.01.27.05.22.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jan 2022 05:22:52 -0800 (PST) From: Karolina Drobnik To: linux-mm@kvack.org Cc: akpm@linux-foundation.org, mike.rapoport@gmail.com, linux-kernel@vger.kernel.org, Karolina Drobnik Subject: [PATCH 10/16] memblock tests: Add skeleton of the memblock simulator Date: Thu, 27 Jan 2022 14:21:28 +0100 Message-Id: <92442409bbc72476509a2ceb2e182473ac69612b.1643206612.git.karolinadrobnik@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: References: MIME-Version: 1.0 X-Rspam-User: nil X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: D767180047 X-Stat-Signature: zkoifpsrok39ttbmndppce8cx9zi45n6 Authentication-Results: imf30.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=a0hCYDmn; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf30.hostedemail.com: domain of karolinadrobnik@gmail.com designates 209.85.167.42 as permitted sender) smtp.mailfrom=karolinadrobnik@gmail.com X-HE-Tag: 1643289774-294256 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: Add basic project files, together with local stubs of required headers. Update tools/include/slab.h to include definitions used by memblock. Signed-off-by: Karolina Drobnik --- MAINTAINERS | 1 + tools/include/linux/slab.h | 10 ++++ tools/testing/memblock/.gitignore | 6 +++ tools/testing/memblock/Makefile | 51 +++++++++++++++++++ tools/testing/memblock/asm/dma.h | 5 ++ tools/testing/memblock/internal.h | 12 +++++ tools/testing/memblock/lib/slab.c | 9 ++++ tools/testing/memblock/linux/init.h | 34 +++++++++++++ tools/testing/memblock/linux/kernel.h | 12 +++++ tools/testing/memblock/linux/kmemleak.h | 18 +++++++ tools/testing/memblock/linux/memory_hotplug.h | 19 +++++++ tools/testing/memblock/linux/mmzone.h | 35 +++++++++++++ tools/testing/memblock/linux/printk.h | 25 +++++++++ tools/testing/memblock/main.c | 6 +++ tools/testing/memblock/mmzone.c | 20 ++++++++ .../testing/memblock/scripts/Makefile.include | 17 +++++++ 16 files changed, 280 insertions(+) create mode 100644 tools/testing/memblock/.gitignore create mode 100644 tools/testing/memblock/Makefile create mode 100644 tools/testing/memblock/asm/dma.h create mode 100644 tools/testing/memblock/internal.h create mode 100644 tools/testing/memblock/lib/slab.c create mode 100644 tools/testing/memblock/linux/init.h create mode 100644 tools/testing/memblock/linux/kernel.h create mode 100644 tools/testing/memblock/linux/kmemleak.h create mode 100644 tools/testing/memblock/linux/memory_hotplug.h create mode 100644 tools/testing/memblock/linux/mmzone.h create mode 100644 tools/testing/memblock/linux/printk.h create mode 100644 tools/testing/memblock/main.c create mode 100644 tools/testing/memblock/mmzone.c create mode 100644 tools/testing/memblock/scripts/Makefile.include diff --git a/MAINTAINERS b/MAINTAINERS index ea3e6c914384..602dc6e9ebad 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -12402,6 +12402,7 @@ S: Maintained F: Documentation/core-api/boot-time-mm.rst F: include/linux/memblock.h F: mm/memblock.c +F: tools/testing/memblock/ MEMORY CONTROLLER DRIVERS M: Krzysztof Kozlowski diff --git a/tools/include/linux/slab.h b/tools/include/linux/slab.h index 07d7930d4003..f41d8a0eb1a4 100644 --- a/tools/include/linux/slab.h +++ b/tools/include/linux/slab.h @@ -13,6 +13,16 @@ void *kmalloc(size_t size, gfp_t gfp); void kfree(void *p); +bool slab_is_available(void); + +enum slab_state { + DOWN, + PARTIAL, + PARTIAL_NODE, + UP, + FULL +}; + static inline void *kzalloc(size_t size, gfp_t gfp) { return kmalloc(size, gfp | __GFP_ZERO); diff --git a/tools/testing/memblock/.gitignore b/tools/testing/memblock/.gitignore new file mode 100644 index 000000000000..5b80ece3d135 --- /dev/null +++ b/tools/testing/memblock/.gitignore @@ -0,0 +1,6 @@ +# SPDX-License-Identifier: GPL-2.0 + +main +memblock.c +linux/memblock.h +asm/cmpxchg.h diff --git a/tools/testing/memblock/Makefile b/tools/testing/memblock/Makefile new file mode 100644 index 000000000000..35105923f235 --- /dev/null +++ b/tools/testing/memblock/Makefile @@ -0,0 +1,51 @@ +# SPDX-License-Identifier: GPL-2.0 + +# Memblock simulator requires AddressSanitizer (libasan) and liburcu libraries +CFLAGS += -I. -I../../include -Wall -O2 -fsanitize=address \ + -fsanitize=undefined -D CONFIG_PHYS_ADDR_T_64BIT +LDFLAGS += -fsanitize=address -fsanitize=undefined +TARGETS = main +OFILES = main.o memblock.o lib/slab.o mmzone.o slab.o +EXTR_SRC = ../../../mm/memblock.c + +ifeq ($(BUILD), 32) + CFLAGS += -m32 + LDFLAGS += -m32 +endif + +# Process user parameters +include scripts/Makefile.include + +main: $(OFILES) + +$(OFILES): include + +include: ../../../include/linux/memblock.h ../../include/linux/*.h \ + ../../include/asm/*.h + + @mkdir -p linux + test -L linux/memblock.h || ln -s ../../../../include/linux/memblock.h linux/memblock.h + test -L asm/cmpxchg.h || ln -s ../../../arch/x86/include/asm/cmpxchg.h asm/cmpxchg.h + +memblock.c: $(EXTR_SRC) + test -L memblock.c || ln -s $(EXTR_SRC) memblock.c + +clean: + $(RM) $(TARGETS) $(OFILES) linux/memblock.h memblock.c asm/cmpxchg.h + +help: + @echo 'Memblock simulator' + @echo '' + @echo 'Available targets:' + @echo ' main - Build the memblock simulator' + @echo ' clean - Remove generated files and symlinks in the directory' + @echo '' + @echo 'Configuration:' + @echo ' make NUMA=1 - simulate enabled NUMA' + @echo ' make MOVABLE_NODE=1 - override `movable_node_is_enabled`' + @echo ' definition to simulate movable NUMA nodes' + @echo ' make 32BIT_PHYS_ADDR_T=1 - Use 32 bit physical addresses' + +vpath %.c ../../lib + +.PHONY: clean include help diff --git a/tools/testing/memblock/asm/dma.h b/tools/testing/memblock/asm/dma.h new file mode 100644 index 000000000000..13ff8e5d22ef --- /dev/null +++ b/tools/testing/memblock/asm/dma.h @@ -0,0 +1,5 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef _TOOLS_DMA_H +#define _TOOLS_DMA_H + +#endif diff --git a/tools/testing/memblock/internal.h b/tools/testing/memblock/internal.h new file mode 100644 index 000000000000..94b52a8718b5 --- /dev/null +++ b/tools/testing/memblock/internal.h @@ -0,0 +1,12 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +#ifndef _MM_INTERNAL_H +#define _MM_INTERNAL_H + +struct page {}; + +void memblock_free_pages(struct page *page, unsigned long pfn, + unsigned int order) +{ +} + +#endif diff --git a/tools/testing/memblock/lib/slab.c b/tools/testing/memblock/lib/slab.c new file mode 100644 index 000000000000..6be6020328fb --- /dev/null +++ b/tools/testing/memblock/lib/slab.c @@ -0,0 +1,9 @@ +// SPDX-License-Identifier: GPL-2.0 +#include + +enum slab_state slab_state; + +bool slab_is_available(void) +{ + return slab_state >= UP; +} diff --git a/tools/testing/memblock/linux/init.h b/tools/testing/memblock/linux/init.h new file mode 100644 index 000000000000..8c09788dfeb1 --- /dev/null +++ b/tools/testing/memblock/linux/init.h @@ -0,0 +1,34 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef _LINUX_INIT_H +#define _LINUX_INIT_H + +#include +#include +#include + +#define __section(section) __attribute__((__section__(section))) + +#define __initconst __section(".init.rodata") +#define __meminit +#define __meminitdata +#define __refdata +#define __initdata + +struct obs_kernel_param { + const char *str; + int (*setup_func)(char *st); + int early; +}; + +#define __setup_param(str, unique_id, fn, early) \ + static const char __setup_str_##unique_id[] __initconst \ + __aligned(1) = str; \ + static struct obs_kernel_param __setup_##unique_id \ + __used __section(".init.setup") \ + __aligned(__alignof__(struct obs_kernel_param)) = \ + { __setup_str_##unique_id, fn, early } + +#define early_param(str, fn) \ + __setup_param(str, fn, fn, 1) + +#endif diff --git a/tools/testing/memblock/linux/kernel.h b/tools/testing/memblock/linux/kernel.h new file mode 100644 index 000000000000..d2f148bd8902 --- /dev/null +++ b/tools/testing/memblock/linux/kernel.h @@ -0,0 +1,12 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +#ifndef _MEMBLOCK_LINUX_KERNEL_H +#define _MEMBLOCK_LINUX_KERNEL_H + +#include <../../include/linux/kernel.h> +#include +#include +#include +#include +#include + +#endif diff --git a/tools/testing/memblock/linux/kmemleak.h b/tools/testing/memblock/linux/kmemleak.h new file mode 100644 index 000000000000..462f8c5e8aa0 --- /dev/null +++ b/tools/testing/memblock/linux/kmemleak.h @@ -0,0 +1,18 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +#ifndef _KMEMLEAK_H +#define _KMEMLEAK_H + +static inline void kmemleak_free_part_phys(phys_addr_t phys, size_t size) +{ +} + +static inline void kmemleak_alloc_phys(phys_addr_t phys, size_t size, + int min_count, gfp_t gfp) +{ +} + +static inline void dump_stack(void) +{ +} + +#endif diff --git a/tools/testing/memblock/linux/memory_hotplug.h b/tools/testing/memblock/linux/memory_hotplug.h new file mode 100644 index 000000000000..47988765a219 --- /dev/null +++ b/tools/testing/memblock/linux/memory_hotplug.h @@ -0,0 +1,19 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef _LINUX_MEMORY_HOTPLUG_H +#define _LINUX_MEMORY_HOTPLUG_H + +#include +#include +#include +#include + +static inline bool movable_node_is_enabled(void) +{ +#ifdef MOVABLE_NODE + return true; +#else + return false; +#endif +} + +#endif diff --git a/tools/testing/memblock/linux/mmzone.h b/tools/testing/memblock/linux/mmzone.h new file mode 100644 index 000000000000..7c2eb5c9bb54 --- /dev/null +++ b/tools/testing/memblock/linux/mmzone.h @@ -0,0 +1,35 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef _TOOLS_MMZONE_H +#define _TOOLS_MMZONE_H + +#include + +struct pglist_data *first_online_pgdat(void); +struct pglist_data *next_online_pgdat(struct pglist_data *pgdat); + +#define for_each_online_pgdat(pgdat) \ + for (pgdat = first_online_pgdat(); \ + pgdat; \ + pgdat = next_online_pgdat(pgdat)) + +enum zone_type { + __MAX_NR_ZONES +}; + +#define MAX_NR_ZONES __MAX_NR_ZONES +#define MAX_ORDER 11 +#define MAX_ORDER_NR_PAGES (1 << (MAX_ORDER - 1)) + +#define pageblock_order (MAX_ORDER - 1) +#define pageblock_nr_pages BIT(pageblock_order) + +struct zone { + atomic_long_t managed_pages; +}; + +typedef struct pglist_data { + struct zone node_zones[MAX_NR_ZONES]; + +} pg_data_t; + +#endif diff --git a/tools/testing/memblock/linux/printk.h b/tools/testing/memblock/linux/printk.h new file mode 100644 index 000000000000..61af424d8c6c --- /dev/null +++ b/tools/testing/memblock/linux/printk.h @@ -0,0 +1,25 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef _PRINTK_H +#define _PRINTK_H + +#include +#include + +/* + * memblock_dbg is called with u64 arguments that don't match the "%llu" + * specifier in printf. This results in warnings that cannot be fixed without + * modifying memblock.c, which we wish to avoid. As these messaged are not used + * in testing anyway, the mismatch can be ignored. + */ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wformat" +#define printk printf +#pragma GCC diagnostic push + +#define pr_info printk +#define pr_debug printk +#define pr_cont printk +#define pr_err printk +#define pr_warn printk + +#endif diff --git a/tools/testing/memblock/main.c b/tools/testing/memblock/main.c new file mode 100644 index 000000000000..62958da35d0f --- /dev/null +++ b/tools/testing/memblock/main.c @@ -0,0 +1,6 @@ +// SPDX-License-Identifier: GPL-2.0-or-later + +int main(int argc, char **argv) +{ + return 0; +} diff --git a/tools/testing/memblock/mmzone.c b/tools/testing/memblock/mmzone.c new file mode 100644 index 000000000000..7b0909e8b759 --- /dev/null +++ b/tools/testing/memblock/mmzone.c @@ -0,0 +1,20 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +#include + +struct pglist_data *first_online_pgdat(void) +{ + return NULL; +} + +struct pglist_data *next_online_pgdat(struct pglist_data *pgdat) +{ + return NULL; +} + +void reserve_bootmem_region(phys_addr_t start, phys_addr_t end) +{ +} + +void atomic_long_set(atomic_long_t *v, long i) +{ +} diff --git a/tools/testing/memblock/scripts/Makefile.include b/tools/testing/memblock/scripts/Makefile.include new file mode 100644 index 000000000000..699b0d6cda07 --- /dev/null +++ b/tools/testing/memblock/scripts/Makefile.include @@ -0,0 +1,17 @@ +# SPDX-License-Identifier: GPL-2.0 +# Definitions for user-provided arguments + +# Simulate CONFIG_NUMA=y +ifeq ($(NUMA), 1) + CFLAGS += -D CONFIG_NUMA +endif + +# Simulate movable NUMA memory regions +ifeq ($(MOVABLE_NODE), 1) + CFLAGS += -D MOVABLE_NODE +endif + +# Use 32 bit physical addresses +ifeq ($(32BIT_PHYS_ADDR_T), 1) + CFLAGS += -U CONFIG_PHYS_ADDR_T_64BIT +endif From patchwork Thu Jan 27 13:21:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Karolina Drobnik X-Patchwork-Id: 12726801 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 B2FA3C433FE for ; Thu, 27 Jan 2022 13:22:58 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4C36F6B0092; Thu, 27 Jan 2022 08:22:58 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 3FE556B0093; Thu, 27 Jan 2022 08:22:58 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1DB996B0095; Thu, 27 Jan 2022 08:22:58 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0242.hostedemail.com [216.40.44.242]) by kanga.kvack.org (Postfix) with ESMTP id 0B1036B0092 for ; Thu, 27 Jan 2022 08:22:58 -0500 (EST) Received: from smtpin04.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id C7F2B181D4711 for ; Thu, 27 Jan 2022 13:22:57 +0000 (UTC) X-FDA: 79076132394.04.54AEBAF Received: from mail-lf1-f49.google.com (mail-lf1-f49.google.com [209.85.167.49]) by imf12.hostedemail.com (Postfix) with ESMTP id 7DECA4000B for ; Thu, 27 Jan 2022 13:22:57 +0000 (UTC) Received: by mail-lf1-f49.google.com with SMTP id o12so5233617lfg.12 for ; Thu, 27 Jan 2022 05:22:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=7K2ZoWo7A3VK2p2YuUqNX5mlstHmQYkZvdeMYQDRBgA=; b=DvJ42WZGL6xIU1SJVI32SaW4vRcAdT3+YIjAhClWAeYHr0wzntb9gm+G25e6D+Mr8U oNB5s6lrm/QtXOr6x/ieRMbB1Dz3tte5Xm+ZY013YoUl5RquBqcELw0u8Bko4/uv30KE Jookr+6Q5ce8zNoDPpQPEVYlv4J4oFC6L6bBovv8MNOlXfDeOxUrk12FDWG9EKsK26dp gkMH29Ggmv12iKwEZIQIjbgII4qW5nyCAv2Ds7yFzzATTCXVFyTSdghqb3Z+AuZYbMq6 AbXtyhywP71xbk2Oet9QPNykRKUMcMjYHFpovkh6H0qEj9Ih1oUmiLG8YIvO5TkQrqLn 8z9A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=7K2ZoWo7A3VK2p2YuUqNX5mlstHmQYkZvdeMYQDRBgA=; b=YIk7+WhCiAlbNQzTV9fhyVOxQQxo+l5qcq6/S3RnoVKxpP95wUaFn1Z8I8ruT2HGW1 7Hk1KKqylqiSysUrr9+CPS/WuedlnUhQx1nIAF/I5M0v51KSRItp9CVH3dg47DccypU5 azRkFc8xyTpriLGOKFh8udqyqq5uY6hiSBfFyJ1h8BE2zG6wglRVOf/Zh/O7l96rvZv3 gYyhEGE0Q3jd8n0PISEw+BEWmUZ+VhOZi0PhhHeLsTh0Rdy4L4+7ia2lf9ReaNlZF26k h1OpVCWv32sDzK1M8tD1bYpjxIvHH3PlU4PXLTDaULE2q9rHQp40hULOlXnpxCeqgeNQ CrtA== X-Gm-Message-State: AOAM533pGFFRwBrRUhzOK7KsaEaF/R/AYkd6J7P+SeKQBjNMy65AjGyo ogznbdHVFxngrmjY2CzELXE0a7EkcqQ= X-Google-Smtp-Source: ABdhPJwIKvJeJYr78aiPnHxXfUNWm4IOcWHHMSgnsZOOuQeVo9MyJQTvMcHuNzRtP+rWvkLnJ+jTKQ== X-Received: by 2002:a05:6512:1699:: with SMTP id bu25mr2815086lfb.681.1643289775573; Thu, 27 Jan 2022 05:22:55 -0800 (PST) Received: from elysium.toya.net.pl (staticline-31-183-166-172.toya.net.pl. [31.183.166.172]) by smtp.gmail.com with ESMTPSA id s16sm1306918lfp.197.2022.01.27.05.22.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jan 2022 05:22:54 -0800 (PST) From: Karolina Drobnik To: linux-mm@kvack.org Cc: akpm@linux-foundation.org, mike.rapoport@gmail.com, linux-kernel@vger.kernel.org, Karolina Drobnik Subject: [PATCH 11/16] memblock tests: Add memblock reset function Date: Thu, 27 Jan 2022 14:21:29 +0100 Message-Id: <4ceb25e17a162c7e15c1cbe138019a4be48d3c93.1643206612.git.karolinadrobnik@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: References: MIME-Version: 1.0 X-Rspamd-Queue-Id: 7DECA4000B X-Rspam-User: nil Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=DvJ42WZG; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf12.hostedemail.com: domain of karolinadrobnik@gmail.com designates 209.85.167.49 as permitted sender) smtp.mailfrom=karolinadrobnik@gmail.com X-Stat-Signature: guuzxowktr7tddhdbeeq5kfdzsfh55zk X-Rspamd-Server: rspam08 X-HE-Tag: 1643289777-9031 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000002, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Memblock simulator needs to be able to reset memblock data structures between different test cases. Add a function that sets all fields to their default values. Add a test checking if memblock is being initialized to expected values. Signed-off-by: Karolina Drobnik --- tools/testing/memblock/Makefile | 4 ++- tools/testing/memblock/main.c | 2 ++ tools/testing/memblock/tests/basic_api.c | 32 ++++++++++++++++++++++++ tools/testing/memblock/tests/basic_api.h | 10 ++++++++ tools/testing/memblock/tests/common.c | 27 ++++++++++++++++++++ tools/testing/memblock/tests/common.h | 15 +++++++++++ 6 files changed, 89 insertions(+), 1 deletion(-) create mode 100644 tools/testing/memblock/tests/basic_api.c create mode 100644 tools/testing/memblock/tests/basic_api.h create mode 100644 tools/testing/memblock/tests/common.c create mode 100644 tools/testing/memblock/tests/common.h diff --git a/tools/testing/memblock/Makefile b/tools/testing/memblock/Makefile index 35105923f235..31c4ef625ede 100644 --- a/tools/testing/memblock/Makefile +++ b/tools/testing/memblock/Makefile @@ -5,7 +5,9 @@ CFLAGS += -I. -I../../include -Wall -O2 -fsanitize=address \ -fsanitize=undefined -D CONFIG_PHYS_ADDR_T_64BIT LDFLAGS += -fsanitize=address -fsanitize=undefined TARGETS = main -OFILES = main.o memblock.o lib/slab.o mmzone.o slab.o +TEST_OFILES = tests/basic_api.o tests/common.o +DEP_OFILES = memblock.o lib/slab.o mmzone.o slab.o +OFILES = main.o $(DEP_OFILES) $(TEST_OFILES) EXTR_SRC = ../../../mm/memblock.c ifeq ($(BUILD), 32) diff --git a/tools/testing/memblock/main.c b/tools/testing/memblock/main.c index 62958da35d0f..da65b0adee91 100644 --- a/tools/testing/memblock/main.c +++ b/tools/testing/memblock/main.c @@ -1,6 +1,8 @@ // SPDX-License-Identifier: GPL-2.0-or-later +#include "tests/basic_api.h" int main(int argc, char **argv) { + memblock_basic_checks(); return 0; } diff --git a/tools/testing/memblock/tests/basic_api.c b/tools/testing/memblock/tests/basic_api.c new file mode 100644 index 000000000000..7f2597b3dd4d --- /dev/null +++ b/tools/testing/memblock/tests/basic_api.c @@ -0,0 +1,32 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +#include +#include +#include "basic_api.h" + +#define EXPECTED_MEMBLOCK_REGIONS 128 + +static int memblock_initialization_check(void) +{ + reset_memblock(); + + assert(memblock.memory.regions); + assert(memblock.memory.cnt == 1); + assert(memblock.memory.max == EXPECTED_MEMBLOCK_REGIONS); + assert(strcmp(memblock.memory.name, "memory") == 0); + + assert(memblock.reserved.regions); + assert(memblock.reserved.cnt == 1); + assert(memblock.memory.max == EXPECTED_MEMBLOCK_REGIONS); + assert(strcmp(memblock.reserved.name, "reserved") == 0); + + assert(!memblock.bottom_up); + assert(memblock.current_limit == MEMBLOCK_ALLOC_ANYWHERE); + + return 0; +} + +int memblock_basic_checks(void) +{ + memblock_initialization_check(); + return 0; +} diff --git a/tools/testing/memblock/tests/basic_api.h b/tools/testing/memblock/tests/basic_api.h new file mode 100644 index 000000000000..1ceecfca1f47 --- /dev/null +++ b/tools/testing/memblock/tests/basic_api.h @@ -0,0 +1,10 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +#ifndef _MEMBLOCK_BASIC_H +#define _MEMBLOCK_BASIC_H + +#include +#include "common.h" + +int memblock_basic_checks(void); + +#endif diff --git a/tools/testing/memblock/tests/common.c b/tools/testing/memblock/tests/common.c new file mode 100644 index 000000000000..03de6eab0c3c --- /dev/null +++ b/tools/testing/memblock/tests/common.c @@ -0,0 +1,27 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +#include "tests/common.h" +#include + +#define INIT_MEMBLOCK_REGIONS 128 +#define INIT_MEMBLOCK_RESERVED_REGIONS INIT_MEMBLOCK_REGIONS + +void reset_memblock(void) +{ + memset(memblock.memory.regions, 0, + memblock.memory.cnt * sizeof(struct memblock_region)); + memset(memblock.reserved.regions, 0, + memblock.reserved.cnt * sizeof(struct memblock_region)); + + memblock.memory.cnt = 1; + memblock.memory.max = INIT_MEMBLOCK_REGIONS; + memblock.memory.name = "memory"; + memblock.memory.total_size = 0; + + memblock.reserved.cnt = 1; + memblock.reserved.max = INIT_MEMBLOCK_RESERVED_REGIONS; + memblock.reserved.name = "reserved"; + memblock.reserved.total_size = 0; + + memblock.bottom_up = false; + memblock.current_limit = MEMBLOCK_ALLOC_ANYWHERE; +} diff --git a/tools/testing/memblock/tests/common.h b/tools/testing/memblock/tests/common.h new file mode 100644 index 000000000000..48efc4270ea1 --- /dev/null +++ b/tools/testing/memblock/tests/common.h @@ -0,0 +1,15 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +#ifndef _MEMBLOCK_TEST_H +#define _MEMBLOCK_TEST_H + +#include +#include + +struct region { + phys_addr_t base; + phys_addr_t size; +}; + +void reset_memblock(void); + +#endif From patchwork Thu Jan 27 13:21:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Karolina Drobnik X-Patchwork-Id: 12726802 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 9A075C433EF for ; Thu, 27 Jan 2022 13:23:00 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 279FA6B0098; Thu, 27 Jan 2022 08:23:00 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 1B51E6B0096; Thu, 27 Jan 2022 08:23:00 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0062A6B0098; Thu, 27 Jan 2022 08:22:59 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0028.hostedemail.com [216.40.44.28]) by kanga.kvack.org (Postfix) with ESMTP id DDB0A6B0095 for ; Thu, 27 Jan 2022 08:22:59 -0500 (EST) Received: from smtpin16.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 99CEC8249980 for ; Thu, 27 Jan 2022 13:22:59 +0000 (UTC) X-FDA: 79076132478.16.B4D83C9 Received: from mail-lj1-f175.google.com (mail-lj1-f175.google.com [209.85.208.175]) by imf21.hostedemail.com (Postfix) with ESMTP id 424111C0002 for ; Thu, 27 Jan 2022 13:22:59 +0000 (UTC) Received: by mail-lj1-f175.google.com with SMTP id q22so4283974ljh.7 for ; Thu, 27 Jan 2022 05:22:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=S1q+vnglpO2PDv2QmjtSXkjrsf77H3g2pU/xh3PtXsQ=; b=dBoiU1gV4FcN5h0v1+Ht5FHOoXQeAL25AFLxoz/HhI1aTyz+dzrdmjyM7KgAfIU5Kx +Oh+BJYNSfMgfqiBCxlizwUauGa9t1H5FoBokNBdRNGJTcPuBEYEb+1cM2wYoy++6f1b m64NXmz+zWb9MT8KE86VJUuJZLnCuetMwLTfXD/z6Ubfa+uEQFGUx1YFJN19tSuVzK6s IXIAT5iYtQbpXAseRn9OR7Hw/ktnnNS5UdBBZeZd1r9myqhRsu+DxZ0FP89/q855f8+c 66yZY6kGbao2rU8l6Kt4Ek2OMeIWkEggjjZhcri0DbF9a68H26pKvlIFqHfx6wb/ZFL9 xgMA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=S1q+vnglpO2PDv2QmjtSXkjrsf77H3g2pU/xh3PtXsQ=; b=vuLEFNUxFKAqdKZsAXvh6FfH7vuAHyEIduczAfdQw32Qb/dYIZEUDGg7am5kcFEJJl S6U50oM+RIFJnwLKGvW9q4sBcfxoq7NA2vvGUQ2aj0raoqOPzNYEfqYz6fFnxyWcqhio /IQ4CzfeghzN/JVDG8ctu/tA630IKSAP5AR9FtM9go/49KprDRvIlz1kCcVsUj0GX+fV jNn5SAZ38oE0qHygulz4v2e40DKwv/L8g9aa6rRbRK/mFZT2q64OIQ05lp9/x686lzs0 LmiPY7uGbRLICh9MGim05Aosb+4wPWYoFArD1ONWh4tnKiQzQyGTPkwQBuws6goBjBiR Jxpw== X-Gm-Message-State: AOAM5332LXQ3ZCHJYbVvd5MDB0AH8ledZ8ISH1BUGf6b/iETCiPqs3wD HeyRU7O2vn8cJ/F0a2c4+iy/idP9NJE= X-Google-Smtp-Source: ABdhPJyW21GLrmtKSmGHnLJmdJ5DP3VKdlko5bJTSPTxdviTYdSWzSMpaEY/E2uPRqOTTYtWphLnWg== X-Received: by 2002:a2e:8e98:: with SMTP id z24mr2842965ljk.19.1643289777871; Thu, 27 Jan 2022 05:22:57 -0800 (PST) Received: from elysium.toya.net.pl (staticline-31-183-166-172.toya.net.pl. [31.183.166.172]) by smtp.gmail.com with ESMTPSA id s16sm1306918lfp.197.2022.01.27.05.22.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jan 2022 05:22:57 -0800 (PST) From: Karolina Drobnik To: linux-mm@kvack.org Cc: akpm@linux-foundation.org, mike.rapoport@gmail.com, linux-kernel@vger.kernel.org, Karolina Drobnik Subject: [PATCH 12/16] memblock tests: Add memblock_add tests Date: Thu, 27 Jan 2022 14:21:30 +0100 Message-Id: <13745fec282f5c96d39faea7cac8e034abbbfd5c.1643206612.git.karolinadrobnik@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: References: MIME-Version: 1.0 X-Rspamd-Server: rspam11 X-Rspamd-Queue-Id: 424111C0002 X-Stat-Signature: ra7hr7mjr4pwmrm4tjcpq116xpjsxa6s Authentication-Results: imf21.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=dBoiU1gV; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf21.hostedemail.com: domain of karolinadrobnik@gmail.com designates 209.85.208.175 as permitted sender) smtp.mailfrom=karolinadrobnik@gmail.com X-Rspam-User: nil X-HE-Tag: 1643289779-460159 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000720, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Add checks for adding a new region in different scenarios: - The region does not overlap with existing entries - The region overlaps with one of the previous entries: from the top (its end address is bigger than the base of the existing region) or from the bottom (its base address is smaller than the end address of one of the regions) - The region is within an already defined region - The same region is added twice to the collection of available memory regions Add checks for memblock initialization to verify it sets memblock data structures to expected values. Signed-off-by: Karolina Drobnik --- tools/testing/memblock/tests/basic_api.c | 215 +++++++++++++++++++++++ 1 file changed, 215 insertions(+) diff --git a/tools/testing/memblock/tests/basic_api.c b/tools/testing/memblock/tests/basic_api.c index 7f2597b3dd4d..6c047b7b31ab 100644 --- a/tools/testing/memblock/tests/basic_api.c +++ b/tools/testing/memblock/tests/basic_api.c @@ -1,6 +1,7 @@ // SPDX-License-Identifier: GPL-2.0-or-later #include #include +#include #include "basic_api.h" #define EXPECTED_MEMBLOCK_REGIONS 128 @@ -25,8 +26,222 @@ static int memblock_initialization_check(void) return 0; } +/* + * A simple test that adds a memory block of a specified base address + * and size to the collection of available memory regions (memblock.memory). + * It checks if a new entry was created and if region counter and total memory + * were correctly updated. + */ +static int memblock_add_simple_check(void) +{ + struct memblock_region *rgn; + + rgn = &memblock.memory.regions[0]; + + struct region r = { + .base = SZ_1G, + .size = SZ_4M + }; + + reset_memblock(); + memblock_add(r.base, r.size); + + assert(rgn->base == r.base); + assert(rgn->size == r.size); + + assert(memblock.memory.cnt == 1); + assert(memblock.memory.total_size == r.size); + + return 0; +} + +/* + * A test that tries to add two memory blocks that don't overlap with one another. + * It checks if two correctly initialized entries were added to the collection + * of available memory regions (memblock.memory) and if this change was reflected + * in memblock.memory's total size and region counter. + */ +static int memblock_add_disjoint_check(void) +{ + struct memblock_region *rgn1, *rgn2; + + rgn1 = &memblock.memory.regions[0]; + rgn2 = &memblock.memory.regions[1]; + + struct region r1 = { + .base = SZ_1G, + .size = SZ_8K + }; + struct region r2 = { + .base = SZ_1G + SZ_16K, + .size = SZ_8K + }; + + reset_memblock(); + memblock_add(r1.base, r1.size); + memblock_add(r2.base, r2.size); + + assert(rgn1->base == r1.base); + assert(rgn1->size == r1.size); + + assert(rgn2->base == r2.base); + assert(rgn2->size == r2.size); + + assert(memblock.memory.cnt == 2); + assert(memblock.memory.total_size == r1.size + r2.size); + + return 0; +} + +/* + * A test that tries to add two memory blocks, where the second one overlaps + * with the beginning of the first entry (that is r1.base < r2.base + r2.size). + * After this, it checks if two entries are merged into one region that starts + * at r2.base and has size of two regions minus their intersection. It also + * verifies the reported total size of the available memory and region counter. + */ +static int memblock_add_overlap_top_check(void) +{ + struct memblock_region *rgn; + phys_addr_t total_size; + + rgn = &memblock.memory.regions[0]; + + struct region r1 = { + .base = SZ_512M, + .size = SZ_1G + }; + struct region r2 = { + .base = SZ_256M, + .size = SZ_512M + }; + + total_size = (r1.base - r2.base) + r1.size; + + reset_memblock(); + memblock_add(r1.base, r1.size); + memblock_add(r2.base, r2.size); + + assert(rgn->base == r2.base); + assert(rgn->size == total_size); + + assert(memblock.memory.cnt == 1); + assert(memblock.memory.total_size == total_size); + + return 0; +} + +/* + * A test that tries to add two memory blocks, where the second one overlaps + * with the end of the first entry (that is r2.base < r1.base + r1.size). + * After this, it checks if two entries are merged into one region that starts + * at r1.base and has size of two regions minus their intersection. It verifies + * that memblock can still see only one entry and has a correct total size of + * the available memory. + */ +static int memblock_add_overlap_bottom_check(void) +{ + struct memblock_region *rgn; + phys_addr_t total_size; + + rgn = &memblock.memory.regions[0]; + + struct region r1 = { + .base = SZ_128M, + .size = SZ_512M + }; + struct region r2 = { + .base = SZ_256M, + .size = SZ_1G + }; + + total_size = (r2.base - r1.base) + r2.size; + + reset_memblock(); + memblock_add(r1.base, r1.size); + memblock_add(r2.base, r2.size); + + assert(rgn->base == r1.base); + assert(rgn->size == total_size); + + assert(memblock.memory.cnt == 1); + assert(memblock.memory.total_size == total_size); + + return 0; +} + +/* + * A test that tries to add two memory blocks, where the second one is + * within the range of the first entry (that is r1.base < r2.base && + * r2.base + r2.size < r1.base + r1.size). It checks if two entries are merged + * into one region that stays the same. The counter and total size of available + * memory are expected to not be updated. + */ +static int memblock_add_within_check(void) +{ + struct memblock_region *rgn; + + rgn = &memblock.memory.regions[0]; + + struct region r1 = { + .base = SZ_8M, + .size = SZ_32M + }; + struct region r2 = { + .base = SZ_16M, + .size = SZ_1M + }; + + reset_memblock(); + memblock_add(r1.base, r1.size); + memblock_add(r2.base, r2.size); + + assert(rgn->base == r1.base); + assert(rgn->size == r1.size); + + assert(memblock.memory.cnt == 1); + assert(memblock.memory.total_size == r1.size); + + return 0; +} + +/* + * A simple test that tries to add the same memory block twice. The counter + * and total size of available memory are expected to not be updated. + */ +static int memblock_add_twice_check(void) +{ + struct region r = { + .base = SZ_16K, + .size = SZ_2M + }; + + reset_memblock(); + + memblock_add(r.base, r.size); + memblock_add(r.base, r.size); + + assert(memblock.memory.cnt == 1); + assert(memblock.memory.total_size == r.size); + + return 0; +} + +static int memblock_add_checks(void) +{ + memblock_add_simple_check(); + memblock_add_disjoint_check(); + memblock_add_overlap_top_check(); + memblock_add_overlap_bottom_check(); + memblock_add_within_check(); + memblock_add_twice_check(); + + return 0; +} + int memblock_basic_checks(void) { memblock_initialization_check(); + memblock_add_checks(); return 0; } From patchwork Thu Jan 27 13:21:31 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Karolina Drobnik X-Patchwork-Id: 12726803 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 B878AC433F5 for ; Thu, 27 Jan 2022 13:23:03 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4C51C6B0096; Thu, 27 Jan 2022 08:23:03 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 424DD6B0099; Thu, 27 Jan 2022 08:23:03 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2C6AD6B009A; Thu, 27 Jan 2022 08:23:03 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0063.hostedemail.com [216.40.44.63]) by kanga.kvack.org (Postfix) with ESMTP id 1669D6B0096 for ; Thu, 27 Jan 2022 08:23:03 -0500 (EST) Received: from smtpin22.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id D8FD89275C for ; Thu, 27 Jan 2022 13:23:02 +0000 (UTC) X-FDA: 79076132604.22.9CE37C3 Received: from mail-lf1-f43.google.com (mail-lf1-f43.google.com [209.85.167.43]) by imf29.hostedemail.com (Postfix) with ESMTP id 85F5D120087 for ; Thu, 27 Jan 2022 13:23:01 +0000 (UTC) Received: by mail-lf1-f43.google.com with SMTP id a28so5285376lfl.7 for ; Thu, 27 Jan 2022 05:23:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=wo9oDoTr9+opMofUsU18MLG30yml/POvjUCw9DWmUTs=; b=jP/+ihSr4g51rsEx0q+yw/44YG9CAcNNZB3nCAL6BfNzapzprh4l5M+lKCVLrDbYmb E4hBP5y6i9thwDqyUm40qQ99PtTsUQcuhuenOZujAhVV78ruxXA6D4vTQhbftnQTaZp0 lzmu4Y4gQHAdTlY6IXE616VAFkNk3PimSmI+Ew1T4ahiNsOAEd4HVgeKyo9qw5iDyWCY lQKyRY3kAPEh4uD8wQPgYYgr5NvCxbICgR/AnGK/MuCsvKKsontQOCWWW29UatoO6BpD raZES3d/+P+f8IuFCoEc1k18WzbBDZADts+aDwXu5MZUiUVr0Vie3USGi4wPj5yPMZJB MN4g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=wo9oDoTr9+opMofUsU18MLG30yml/POvjUCw9DWmUTs=; b=xXlVOkeRGP/x9sOoV4/XgCHNAQOvaq2x+T9rgzv/W+ozgaecpth43YPSR4nYR2fpc9 tgpmoCsKJ1dqNVzi8hwa6d9sKJSQ9QBO8DHKPTlXLpkgA9uPAsKD9EHfXtA99LitRKdD lYFIxSQe8doG7LYC/d+1oU6LlZa5G7+g1t7jnnoQwGKzpVBYzZl++cme9bd4uyP1KiBL cS97FNuHyWYkv43cg8qRwqtWfEwoRYa3nwnEfPr1dyGRDMfKiDpVjyyo0iiU2wJ2WxMl YbhzOd8HapnmE2PdvWVqVkW1w2OwVYUBZ2877IwreSGHevLyVlVCCuiEAk+d48MSl1FT Ifvw== X-Gm-Message-State: AOAM531Ycj9C8gB1mgpR/cjVgwMyWAjZzUG2LvtDYdkRpLy/HgjDWJct UUp5n6r6DjzmhViTNVubUbbuhLq/AOg= X-Google-Smtp-Source: ABdhPJynVFbj7l9tFBplnLU9W06Hzj8764UyQPBLqnquPB33OyA2o7mk1idQQTMT4nn0O1PyggxmUw== X-Received: by 2002:a19:5f58:: with SMTP id a24mr2785650lfj.46.1643289780152; Thu, 27 Jan 2022 05:23:00 -0800 (PST) Received: from elysium.toya.net.pl (staticline-31-183-166-172.toya.net.pl. [31.183.166.172]) by smtp.gmail.com with ESMTPSA id s16sm1306918lfp.197.2022.01.27.05.22.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jan 2022 05:22:59 -0800 (PST) From: Karolina Drobnik To: linux-mm@kvack.org Cc: akpm@linux-foundation.org, mike.rapoport@gmail.com, linux-kernel@vger.kernel.org, Karolina Drobnik Subject: [PATCH 13/16] memblock tests: Add memblock_reserve tests Date: Thu, 27 Jan 2022 14:21:31 +0100 Message-Id: <4603629b76f8caf68b4487b7a040461dc18e9723.1643206612.git.karolinadrobnik@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: References: MIME-Version: 1.0 X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: 85F5D120087 X-Stat-Signature: bub14ckaccfb3ttkn1zsk51k6z9od8mb X-Rspam-User: nil Authentication-Results: imf29.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b="jP/+ihSr"; spf=pass (imf29.hostedemail.com: domain of karolinadrobnik@gmail.com designates 209.85.167.43 as permitted sender) smtp.mailfrom=karolinadrobnik@gmail.com; dmarc=pass (policy=none) header.from=gmail.com X-HE-Tag: 1643289781-151882 X-Bogosity: Ham, tests=bogofilter, spamicity=0.006588, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Add checks for marking a region as reserved in different scenarios: - The region does not overlap with existing entries - The region overlaps with one of the previous entries: from the top (its end address is bigger than the base of the existing region) or from the bottom (its base address is smaller than the end address of one of the regions) - The region is within an already defined region - The same region is marked as reserved twice Signed-off-by: Karolina Drobnik --- tools/testing/memblock/tests/basic_api.c | 213 +++++++++++++++++++++++ 1 file changed, 213 insertions(+) diff --git a/tools/testing/memblock/tests/basic_api.c b/tools/testing/memblock/tests/basic_api.c index 6c047b7b31ab..b055ff262d23 100644 --- a/tools/testing/memblock/tests/basic_api.c +++ b/tools/testing/memblock/tests/basic_api.c @@ -239,9 +239,222 @@ static int memblock_add_checks(void) return 0; } + /* + * A simple test that marks a memory block of a specified base address + * and size as reserved and to the collection of reserved memory regions + * (memblock.reserved). It checks if a new entry was created and if region + * counter and total memory size were correctly updated. + */ +static int memblock_reserve_simple_check(void) +{ + struct memblock_region *rgn; + + rgn = &memblock.reserved.regions[0]; + + struct region r = { + .base = SZ_2G, + .size = SZ_128M + }; + + reset_memblock(); + memblock_reserve(r.base, r.size); + + assert(rgn->base == r.base); + assert(rgn->size == r.size); + + return 0; +} + +/* + * A test that tries to mark two memory blocks that don't overlap as reserved + * and checks if two entries were correctly added to the collection of reserved + * memory regions (memblock.reserved) and if this change was reflected in + * memblock.reserved's total size and region counter. + */ +static int memblock_reserve_disjoint_check(void) +{ + struct memblock_region *rgn1, *rgn2; + + rgn1 = &memblock.reserved.regions[0]; + rgn2 = &memblock.reserved.regions[1]; + + struct region r1 = { + .base = SZ_256M, + .size = SZ_16M + }; + struct region r2 = { + .base = SZ_512M, + .size = SZ_512M + }; + + reset_memblock(); + memblock_reserve(r1.base, r1.size); + memblock_reserve(r2.base, r2.size); + + assert(rgn1->base == r1.base); + assert(rgn1->size == r1.size); + + assert(rgn2->base == r2.base); + assert(rgn2->size == r2.size); + + assert(memblock.reserved.cnt == 2); + assert(memblock.reserved.total_size == r1.size + r2.size); + + return 0; +} + +/* + * A test that tries to mark two memory blocks as reserved, where the second one + * overlaps with the beginning of the first (that is r1.base < r2.base + r2.size). + * It checks if two entries are merged into one region that starts at r2.base + * and has size of two regions minus their intersection. The test also verifies + * that memblock can still see only one entry and has a correct total size of + * the reserved memory. + */ +static int memblock_reserve_overlap_top_check(void) +{ + struct memblock_region *rgn; + phys_addr_t total_size; + + rgn = &memblock.reserved.regions[0]; + + struct region r1 = { + .base = SZ_1G, + .size = SZ_1G + }; + struct region r2 = { + .base = SZ_128M, + .size = SZ_1G + }; + + total_size = (r1.base - r2.base) + r1.size; + + reset_memblock(); + memblock_reserve(r1.base, r1.size); + memblock_reserve(r2.base, r2.size); + + assert(rgn->base == r2.base); + assert(rgn->size == total_size); + + assert(memblock.reserved.cnt == 1); + assert(memblock.reserved.total_size == total_size); + + return 0; +} + +/* + * A test that tries to mark two memory blocks as reserved, where the second + * one overlaps with the end of the first entry (that is r2.base < r1.base + r1.size). + * It checks if two entries are merged into one region that starts at r1.base + * and has size of two regions minus their intersection. It verifies that memblock + * can still see only one entry and has a correct total size of the reserved memory. + */ +static int memblock_reserve_overlap_bottom_check(void) +{ + struct memblock_region *rgn; + phys_addr_t total_size; + + rgn = &memblock.reserved.regions[0]; + + struct region r1 = { + .base = SZ_2K, + .size = SZ_128K + }; + struct region r2 = { + .base = SZ_128K, + .size = SZ_128K + }; + + total_size = (r2.base - r1.base) + r2.size; + + reset_memblock(); + memblock_reserve(r1.base, r1.size); + memblock_reserve(r2.base, r2.size); + + assert(rgn->base == r1.base); + assert(rgn->size == total_size); + + assert(memblock.reserved.cnt == 1); + assert(memblock.reserved.total_size == total_size); + + return 0; +} + +/* + * A test that tries to mark two memory blocks as reserved, where the second one + * is within the range of the first entry (that is (r1.base < r2.base) && + * (r2.base + r2.size < r1.base + r1.size)). It checks if two entries are merged + * into one region that stays the same. The counter and total size of available + * memory are expected to not be updated. + */ +static int memblock_reserve_within_check(void) +{ + struct memblock_region *rgn; + + rgn = &memblock.reserved.regions[0]; + + struct region r1 = { + .base = SZ_1M, + .size = SZ_8M + }; + struct region r2 = { + .base = SZ_2M, + .size = SZ_64K + }; + + reset_memblock(); + memblock_reserve(r1.base, r1.size); + memblock_reserve(r2.base, r2.size); + + assert(rgn->base == r1.base); + assert(rgn->size == r1.size); + + assert(memblock.reserved.cnt == 1); + assert(memblock.reserved.total_size == r1.size); + + return 0; +} + +/* + * A simple test that tries to reserve the same memory block twice. + * The region counter and total size of reserved memory are expected to not + * be updated. + */ +static int memblock_reserve_twice_check(void) +{ + struct region r = { + .base = SZ_16K, + .size = SZ_2M + }; + + reset_memblock(); + + memblock_reserve(r.base, r.size); + memblock_reserve(r.base, r.size); + + assert(memblock.reserved.cnt == 1); + assert(memblock.reserved.total_size == r.size); + + return 0; +} + +static int memblock_reserve_checks(void) +{ + memblock_reserve_simple_check(); + memblock_reserve_disjoint_check(); + memblock_reserve_overlap_top_check(); + memblock_reserve_overlap_bottom_check(); + memblock_reserve_within_check(); + memblock_reserve_twice_check(); + + return 0; +} + int memblock_basic_checks(void) { memblock_initialization_check(); memblock_add_checks(); + memblock_reserve_checks(); + return 0; } From patchwork Thu Jan 27 13:21:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Karolina Drobnik X-Patchwork-Id: 12726804 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 36453C433FE for ; Thu, 27 Jan 2022 13:23:05 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id BA16F6B009A; Thu, 27 Jan 2022 08:23:04 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id B522E6B009B; Thu, 27 Jan 2022 08:23:04 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 957646B009C; Thu, 27 Jan 2022 08:23:04 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0008.hostedemail.com [216.40.44.8]) by kanga.kvack.org (Postfix) with ESMTP id 808746B009A for ; Thu, 27 Jan 2022 08:23:04 -0500 (EST) Received: from smtpin14.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 40C70181CBC11 for ; Thu, 27 Jan 2022 13:23:04 +0000 (UTC) X-FDA: 79076132688.14.063D2A6 Received: from mail-lj1-f173.google.com (mail-lj1-f173.google.com [209.85.208.173]) by imf12.hostedemail.com (Postfix) with ESMTP id 7C2B94000F for ; Thu, 27 Jan 2022 13:23:03 +0000 (UTC) Received: by mail-lj1-f173.google.com with SMTP id q127so4311869ljq.2 for ; Thu, 27 Jan 2022 05:23:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Hy7Dd2f91UDJKml61GqO51OOP6//JtRGeIoiva3Pj4s=; b=eOBmJmDHfkuFeep90OvjOekwFn22R9eJ6NpFaGtjUtD5B8ra+NXr2/L42EZ/tIGqr1 Os+Xfz7s2sqwWFzFFEBHdWgxxVLc3GN8+kFNFiPHzsva5t0Evujp/h19Sk1V2I2/LBAN vp5NtiB9x6RHstR/aDYucdeSTWlQeT+fpPdOMg0iFxa3WEv21kWHzKrEuGAqXn436R/L y7HkgeDFwCiZXOd0iefHLlZ67/zUrVnJEe0FQlhVX7d+X+Nd/4d3D4a9CJun/QYqiRIR qQ1Wl8ZkUAr3ZEOCVSqskAwdz4/i0mFDzUpwBnGf2vCZ1Jd5iRsCdL/OrMR3PohB6ZkM JukQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Hy7Dd2f91UDJKml61GqO51OOP6//JtRGeIoiva3Pj4s=; b=rCqKQlmYQDcmLqS1UmJBF0hhNgMFexttAOemHZTG/d7NPfNHhvEP3Z6ILbLEUie9N1 6GOESFz6pQp5LJylx370FHZlg6mN54NuwPYzg8/AOhIYLNOrYYDn/oEYofNJMMX15t1o 9Edk8LFofwoYda+GUL/yRtxIkIoV0zJm9V1Sagt/pZfR60xdjNz5JZR28FyyUyd9XJaZ SnTshbSr0q4fO5MTE36dvfZNxFler5YHPIYSIC56Q+1o0XRxACl2NVS8xtr/ju0fxsdy 99AOZ978A/kovZB6j6wDZlh35CMLM/iCy4CN7ZyjdWY8CczU2jvw9QfqNJ7ji6JqRuqY GD0w== X-Gm-Message-State: AOAM5323mXeakb/FK3wnDqSv9E1MoL5oMh6t6Rjx0ntqxzGb4vzvbviz a/EFSsBFVBZnVxC4WbVCDleO6FxvNac= X-Google-Smtp-Source: ABdhPJylTzrNTw+ZvMPlNBQsGkLRQ2IxoY6wQKgiAfi4DWnoRMz0SCd4bbx9GZyc/0LHkhu8H9Ociw== X-Received: by 2002:a2e:a41a:: with SMTP id p26mr2927925ljn.176.1643289782157; Thu, 27 Jan 2022 05:23:02 -0800 (PST) Received: from elysium.toya.net.pl (staticline-31-183-166-172.toya.net.pl. [31.183.166.172]) by smtp.gmail.com with ESMTPSA id s16sm1306918lfp.197.2022.01.27.05.23.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jan 2022 05:23:01 -0800 (PST) From: Karolina Drobnik To: linux-mm@kvack.org Cc: akpm@linux-foundation.org, mike.rapoport@gmail.com, linux-kernel@vger.kernel.org, Karolina Drobnik Subject: [PATCH 14/16] memblock tests: Add memblock_remove tests Date: Thu, 27 Jan 2022 14:21:32 +0100 Message-Id: <680e9f43b98cae24f6c6364052be14f2bcefa694.1643206612.git.karolinadrobnik@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: References: MIME-Version: 1.0 X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 7C2B94000F X-Stat-Signature: 5i9pyg68p35nhsdyd9bto7awbh7nxue1 Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=eOBmJmDH; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf12.hostedemail.com: domain of karolinadrobnik@gmail.com designates 209.85.208.173 as permitted sender) smtp.mailfrom=karolinadrobnik@gmail.com X-Rspam-User: nil X-HE-Tag: 1643289783-278821 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000560, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Add checks for removing a region from available memory in different scenarios: - The requested region matches one in the collection of available memory regions - The requested region does not exist in memblock.memory - The region overlaps with one of the entries: from the top (its end address is bigger than the base of the existing region) or from the bottom (its base address is smaller than the end address of one of the regions) - The region is within an already defined region Signed-off-by: Karolina Drobnik --- tools/testing/memblock/tests/basic_api.c | 203 +++++++++++++++++++++++ 1 file changed, 203 insertions(+) diff --git a/tools/testing/memblock/tests/basic_api.c b/tools/testing/memblock/tests/basic_api.c index b055ff262d23..96af80bf9df9 100644 --- a/tools/testing/memblock/tests/basic_api.c +++ b/tools/testing/memblock/tests/basic_api.c @@ -450,11 +450,214 @@ static int memblock_reserve_checks(void) return 0; } + /* + * A simple test that tries to remove the first entry of the array of available + * memory regions. By "removing" a region we mean overwriting it with the next + * region in memblock.memory. To check this is the case, the test adds two memory + * blocks and verifies that the value of the latter was used to erase r1 region. + * It also checks if the region counter and total size were updated to expected + * values. + */ +static int memblock_remove_simple_check(void) +{ + struct memblock_region *rgn; + + rgn = &memblock.memory.regions[0]; + + struct region r1 = { + .base = SZ_2K, + .size = SZ_4K + }; + struct region r2 = { + .base = SZ_128K, + .size = SZ_4M + }; + + reset_memblock(); + memblock_add(r1.base, r1.size); + memblock_add(r2.base, r2.size); + memblock_remove(r1.base, r1.size); + + assert(rgn->base == r2.base); + assert(rgn->size == r2.size); + + assert(memblock.memory.cnt == 1); + assert(memblock.memory.total_size == r2.size); + + return 0; +} + + /* + * A test that tries to remove a region that was not registered as available + * memory (i.e. has no corresponding entry in memblock.memory). It verifies + * that array, regions counter and total size were not modified. + */ +static int memblock_remove_absent_check(void) +{ + struct memblock_region *rgn; + + rgn = &memblock.memory.regions[0]; + + struct region r1 = { + .base = SZ_512K, + .size = SZ_4M + }; + struct region r2 = { + .base = SZ_64M, + .size = SZ_1G + }; + + reset_memblock(); + memblock_add(r1.base, r1.size); + memblock_remove(r2.base, r2.size); + + assert(rgn->base == r1.base); + assert(rgn->size == r1.size); + + assert(memblock.memory.cnt == 1); + assert(memblock.memory.total_size == r1.size); + + return 0; +} + +/* + * A test that tries to remove a region which overlaps with the beginning of + * the already existing entry r1 (that is r1.base < r2.base + r2.size). It + * checks if only the intersection of both regions is removed from the available + * memory pool. The test also checks if the regions counter and total size are + * updated to expected values. + */ +static int memblock_remove_overlap_top_check(void) +{ + struct memblock_region *rgn; + phys_addr_t r1_end, r2_end, total_size; + + rgn = &memblock.memory.regions[0]; + + struct region r1 = { + .base = SZ_32M, + .size = SZ_32M + }; + struct region r2 = { + .base = SZ_16M, + .size = SZ_32M + }; + + r1_end = r1.base + r1.size; + r2_end = r2.base + r2.size; + total_size = r1_end - r2_end; + + reset_memblock(); + memblock_add(r1.base, r1.size); + memblock_remove(r2.base, r2.size); + + assert(rgn->base == r1.base + r2.base); + assert(rgn->size == total_size); + + assert(memblock.memory.cnt == 1); + assert(memblock.memory.total_size == total_size); + + return 0; +} + +/* + * A test that tries to remove a region which overlaps with the end of the + * first entry (that is r2.base < r1.base + r1.size). It checks if only the + * intersection of both regions is removed from the available memory pool. + * The test also checks if the regions counter and total size are updated to + * expected values. + */ +static int memblock_remove_overlap_bottom_check(void) +{ + struct memblock_region *rgn; + phys_addr_t total_size; + + rgn = &memblock.memory.regions[0]; + + struct region r1 = { + .base = SZ_2M, + .size = SZ_64M + }; + struct region r2 = { + .base = SZ_32M, + .size = SZ_256M + }; + + total_size = r2.base - r1.base; + + reset_memblock(); + memblock_add(r1.base, r1.size); + memblock_remove(r2.base, r2.size); + + assert(rgn->base == r1.base); + assert(rgn->size == total_size); + + assert(memblock.memory.cnt == 1); + assert(memblock.memory.total_size == total_size); + return 0; +} + +/* + * A test that tries to remove a region which is within the range of the already + * existing entry (that is (r1.base < r2.base) && (r2.base + r2.size < r1.base + r1.size)). + * It checks if the region is split into two - one that ends at r2.base and second + * that starts at r2.base + size, with appropriate sizes. The test also checks if + * the region counter and total size were updated to expected values. + */ +static int memblock_remove_within_check(void) +{ + struct memblock_region *rgn1, *rgn2; + phys_addr_t r1_size, r2_size, total_size; + + rgn1 = &memblock.memory.regions[0]; + rgn2 = &memblock.memory.regions[1]; + + struct region r1 = { + .base = SZ_1M, + .size = SZ_32M + }; + struct region r2 = { + .base = SZ_16M, + .size = SZ_1M + }; + + r1_size = r2.base - r1.base; + r2_size = (r1.base + r1.size) - (r2.base + r2.size); + total_size = r1_size + r2_size; + + reset_memblock(); + memblock_add(r1.base, r1.size); + memblock_remove(r2.base, r2.size); + + assert(rgn1->base == r1.base); + assert(rgn1->size == r1_size); + + assert(rgn2->base == r2.base + r2.size); + assert(rgn2->size == r2_size); + + assert(memblock.memory.cnt == 2); + assert(memblock.memory.total_size == total_size); + + return 0; +} + +static int memblock_remove_checks(void) +{ + memblock_remove_simple_check(); + memblock_remove_absent_check(); + memblock_remove_overlap_top_check(); + memblock_remove_overlap_bottom_check(); + memblock_remove_within_check(); + + return 0; +} + int memblock_basic_checks(void) { memblock_initialization_check(); memblock_add_checks(); memblock_reserve_checks(); + memblock_remove_checks(); return 0; } From patchwork Thu Jan 27 13:21:33 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Karolina Drobnik X-Patchwork-Id: 12726805 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 324ABC43217 for ; Thu, 27 Jan 2022 13:23:07 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C18886B009C; Thu, 27 Jan 2022 08:23:06 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id B51786B009D; Thu, 27 Jan 2022 08:23:06 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9A65E6B009E; Thu, 27 Jan 2022 08:23:06 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0194.hostedemail.com [216.40.44.194]) by kanga.kvack.org (Postfix) with ESMTP id 827C06B009C for ; Thu, 27 Jan 2022 08:23:06 -0500 (EST) Received: from smtpin30.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 36C4D8249980 for ; Thu, 27 Jan 2022 13:23:06 +0000 (UTC) X-FDA: 79076132772.30.537D3DE Received: from mail-lf1-f50.google.com (mail-lf1-f50.google.com [209.85.167.50]) by imf23.hostedemail.com (Postfix) with ESMTP id 7151814006C for ; Thu, 27 Jan 2022 13:23:05 +0000 (UTC) Received: by mail-lf1-f50.google.com with SMTP id z4so5329404lft.3 for ; Thu, 27 Jan 2022 05:23:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=xsGfx9/8KzrBT+1sl0kUz+F3kyiF2mtw3RnNVnjQqWU=; b=pBfr0ZdgfwSQlmVaKdWWDCyJf7WHwwj4gjom2y9UVzOH0uZsh7NoaiX0bEMbblnVMl gr94plKxbtAXvDdOA9rkxkrRetv50PzGmXOkD5vRZCGk5Nqbb8llb85Nki3tg0S1Li6e 8vIeYW2c+foSRgcTU/m6YlQN2ni/y7sYwKmIyboMFbAKzNoaPPo1N+Bq1IUgFmU5ilMs zURht+DOAqdnVeFHgLw9kqMRLFWkdy06QR8dSs/Imu21u5RSz8XDftKSEepQ4P876Ihk tvc52IkkrOcPqJUEvf8FCSCDcY1y4J3CJhjqwT9SzIzYyme/ClvYcCKlyb5mFHtCbo8n k/Dw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=xsGfx9/8KzrBT+1sl0kUz+F3kyiF2mtw3RnNVnjQqWU=; b=GpWfFYXwDpyEhXdURiZ/y0+jwmU+eu5QBUfR2u5uP9SGC6bys3kBMpjNneGXqUCd2N fH0ZMHOmecqWKFaCKFE9vSX2BkWGiDK5WkDiXdXXovRJ6p/Kg0dGlbWIl4sryUIB3c9n ppVzJsNYoOhxlcTBBL18cPMQRZijhR4lPUKRlyNSHhXMxxBvmbv0g97ALbadB8c6ivst Fx3i0GTOUG0D/5BhQFPUc0swVfPYJ09UnDIU56v4kwGS9MFC3Yc/gp24LJnmjqjaIjA6 z9fbn0lo4BaCpJHEE7/Y8AFH2TSYf0es6yn03SODWblSd0s+W8YtI/9ehphPxj8PqVTt 5dUg== X-Gm-Message-State: AOAM530z3CtwSMt7wz4p6U4gl4PUORy107wep4KPoAdouVx6rkt4djfw zSxryvdi+soebQxwphOo9j7OoMXOzos= X-Google-Smtp-Source: ABdhPJwa2MmtZ0Byc/fh4qu/MTl/En4nmMDVSl4RidluFDaPogFkFEtcbN4TnKkuYismkKC3orMn7Q== X-Received: by 2002:a05:6512:1502:: with SMTP id bq2mr2720757lfb.551.1643289784104; Thu, 27 Jan 2022 05:23:04 -0800 (PST) Received: from elysium.toya.net.pl (staticline-31-183-166-172.toya.net.pl. [31.183.166.172]) by smtp.gmail.com with ESMTPSA id s16sm1306918lfp.197.2022.01.27.05.23.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jan 2022 05:23:03 -0800 (PST) From: Karolina Drobnik To: linux-mm@kvack.org Cc: akpm@linux-foundation.org, mike.rapoport@gmail.com, linux-kernel@vger.kernel.org, Karolina Drobnik Subject: [PATCH 15/16] memblock tests: Add memblock_add_node test Date: Thu, 27 Jan 2022 14:21:33 +0100 Message-Id: X-Mailer: git-send-email 2.30.2 In-Reply-To: References: MIME-Version: 1.0 X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 7151814006C X-Stat-Signature: 9z4fz9i8x9quad3fzejks4zg55espbe5 X-Rspam-User: nil Authentication-Results: imf23.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=pBfr0Zdg; spf=pass (imf23.hostedemail.com: domain of karolinadrobnik@gmail.com designates 209.85.167.50 as permitted sender) smtp.mailfrom=karolinadrobnik@gmail.com; dmarc=pass (policy=none) header.from=gmail.com X-HE-Tag: 1643289785-312308 X-Bogosity: Ham, tests=bogofilter, spamicity=0.002685, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Add a simple test for NUMA-aware variant of memblock_add function. Signed-off-by: Karolina Drobnik --- tools/testing/memblock/tests/basic_api.c | 34 ++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/tools/testing/memblock/tests/basic_api.c b/tools/testing/memblock/tests/basic_api.c index 96af80bf9df9..02eb88358a58 100644 --- a/tools/testing/memblock/tests/basic_api.c +++ b/tools/testing/memblock/tests/basic_api.c @@ -55,6 +55,39 @@ static int memblock_add_simple_check(void) return 0; } +/* + * A simple test that adds a memory block of a specified base address, size + * NUMA node and memory flags to the collection of available memory regions. + * It checks if the new entry, region counter and total memory size have + * expected values. + */ +static int memblock_add_node_simple_check(void) +{ + struct memblock_region *rgn; + + rgn = &memblock.memory.regions[0]; + + struct region r = { + .base = SZ_1M, + .size = SZ_16M + }; + + reset_memblock(); + memblock_add_node(r.base, r.size, 1, MEMBLOCK_HOTPLUG); + + assert(rgn->base == r.base); + assert(rgn->size == r.size); +#ifdef CONFIG_NUMA + assert(rgn->nid == 1); +#endif + assert(rgn->flags == MEMBLOCK_HOTPLUG); + + assert(memblock.memory.cnt == 1); + assert(memblock.memory.total_size == r.size); + + return 0; +} + /* * A test that tries to add two memory blocks that don't overlap with one another. * It checks if two correctly initialized entries were added to the collection @@ -230,6 +263,7 @@ static int memblock_add_twice_check(void) static int memblock_add_checks(void) { memblock_add_simple_check(); + memblock_add_node_simple_check(); memblock_add_disjoint_check(); memblock_add_overlap_top_check(); memblock_add_overlap_bottom_check(); From patchwork Thu Jan 27 13:21:34 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Karolina Drobnik X-Patchwork-Id: 12726806 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 D9F16C433EF for ; Thu, 27 Jan 2022 13:23:08 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E3A0C6B009E; Thu, 27 Jan 2022 08:23:07 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id DEBD06B009F; Thu, 27 Jan 2022 08:23:07 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C89DC6B00A0; Thu, 27 Jan 2022 08:23:07 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0050.hostedemail.com [216.40.44.50]) by kanga.kvack.org (Postfix) with ESMTP id ADD3D6B009E for ; Thu, 27 Jan 2022 08:23:07 -0500 (EST) Received: from smtpin07.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 6F7EC93D6D for ; Thu, 27 Jan 2022 13:23:07 +0000 (UTC) X-FDA: 79076132814.07.DC78E54 Received: from mail-lj1-f177.google.com (mail-lj1-f177.google.com [209.85.208.177]) by imf03.hostedemail.com (Postfix) with ESMTP id 16D502002B for ; Thu, 27 Jan 2022 13:23:06 +0000 (UTC) Received: by mail-lj1-f177.google.com with SMTP id c15so4241725ljf.11 for ; Thu, 27 Jan 2022 05:23:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=fXs9Z9PQYCruMdcrfaMtY0ndpO2Xn6EDlt3MZzXYgdU=; b=oDkwc2cjqtYnHMagaCWEJVr/CeYLDMdA1chFEf6kE7nkifGc77Mt5cEDZltehARWEn j7BaXrgNgOyBzYbSKKk2HzC0yJ/5JAy469XULMHCDqpG5RLCQEQHUab0vk3E8/4+K1Li F1uCKCdxUZ0o57qHw5jM0tV8u89yzygJ4ZKmzAXhuSdsPTVewsMyX691jknDJfHzElxX eI2B58VIW/JmU04rLHF8uedgvN4MAtJrNnzUOkSON0ColNaV6zEh/UyGO0YzV/DEd/fQ eE0L4riN1rQfekOlss9DqJed1nIY04qbPezdvCAsz4gpB6FCyj/r4fm/BHkAeye93CTv twLg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=fXs9Z9PQYCruMdcrfaMtY0ndpO2Xn6EDlt3MZzXYgdU=; b=Fh3DaRv55XAyMy2SuvvLzUjKlXAovtUAx3mOntxU2X7JrWUQkPLmm7XXoori298le0 4zzzLCs4pbtn6a/hnCWTb5v9RLNxZOTXRmzJILPROdZ1t6YFTSAS8oVMmKxL5Xc1FVbz TrtlBXXCl8pXOQnP/UfYnrsvmQ/vCkt2Mq9iiyZYQs4X/CnoS+Wttm2BVHm5xYz1lJwN EUnhmdnrFVlghIDmAFs8J0MBlzKyXYjEdOIwfOP2MFl3d7Qvmn3wmbgxhcpVrJJ2/CD7 xxNtF6fUn0JQajpAq7LD6kEmDD48m62aEtYcsXD0/W4Hm43SRbTLz6oZwGUERrWKiH35 YNsA== X-Gm-Message-State: AOAM531K11G0yxYGCflKMw26Srr3i8Jll9JFu5SdTtVyhXnpoI2AfFWQ KxWX5oOJX5MC7+t8gv0Gw+Vultm6q74= X-Google-Smtp-Source: ABdhPJz8UMyjQwIGDZ8QCO9YdTY8bJGm0PMsj9ZFWONj4sBJqZLF/ujqUdzMv5WSCxRhTIMleLZP8w== X-Received: by 2002:a2e:9003:: with SMTP id h3mr2796586ljg.111.1643289785683; Thu, 27 Jan 2022 05:23:05 -0800 (PST) Received: from elysium.toya.net.pl (staticline-31-183-166-172.toya.net.pl. [31.183.166.172]) by smtp.gmail.com with ESMTPSA id s16sm1306918lfp.197.2022.01.27.05.23.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jan 2022 05:23:05 -0800 (PST) From: Karolina Drobnik To: linux-mm@kvack.org Cc: akpm@linux-foundation.org, mike.rapoport@gmail.com, linux-kernel@vger.kernel.org, Karolina Drobnik Subject: [PATCH 16/16] memblock tests: Add memblock_free tests Date: Thu, 27 Jan 2022 14:21:34 +0100 Message-Id: <586cd930a449bc2192ebee592c3a043cc0c1828f.1643206612.git.karolinadrobnik@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: References: MIME-Version: 1.0 X-Stat-Signature: rq3cy1iqf78nqc7b4jedbbpx78ebin9t X-Rspam-User: nil Authentication-Results: imf03.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=oDkwc2cj; spf=pass (imf03.hostedemail.com: domain of karolinadrobnik@gmail.com designates 209.85.208.177 as permitted sender) smtp.mailfrom=karolinadrobnik@gmail.com; dmarc=pass (policy=none) header.from=gmail.com X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: 16D502002B X-HE-Tag: 1643289786-323670 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000097, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Add checks for removing a region from reserved memory in different scenarios: - The requested region matches one in the collection of reserved memory regions - The requested region does not exist in memblock.reserved - The region overlaps with one of the entries: from the top (its end address is bigger than the base of the existing region) or from the bottom (its base address is smaller than the end address of one of the regions) - The region is within an already defined region Signed-off-by: Karolina Drobnik --- tools/testing/memblock/tests/basic_api.c | 199 +++++++++++++++++++++++ 1 file changed, 199 insertions(+) diff --git a/tools/testing/memblock/tests/basic_api.c b/tools/testing/memblock/tests/basic_api.c index 02eb88358a58..568b05b52883 100644 --- a/tools/testing/memblock/tests/basic_api.c +++ b/tools/testing/memblock/tests/basic_api.c @@ -686,12 +686,211 @@ static int memblock_remove_checks(void) return 0; } +/* + * A simple test that tries to free a memory block that was marked earlier as + * reserved. By "freeing" a region we mean overwriting it with the next entry + * in memblock.reserved. To check this is the case, the test reserves two memory + * regions and verifies that the value of the latter was used to erase r1 region. + * The test also checks if the region counter and total size were updated. + */ +static int memblock_free_simple_check(void) +{ + struct memblock_region *rgn; + + rgn = &memblock.reserved.regions[0]; + + struct region r1 = { + .base = SZ_4M, + .size = SZ_1M + }; + struct region r2 = { + .base = SZ_8M, + .size = SZ_1M + }; + + reset_memblock(); + memblock_reserve(r1.base, r1.size); + memblock_reserve(r2.base, r2.size); + memblock_free((void *)r1.base, r1.size); + + assert(rgn->base == r2.base); + assert(rgn->size == r2.size); + + assert(memblock.reserved.cnt == 1); + assert(memblock.reserved.total_size == r2.size); + + return 0; +} + + /* + * A test that tries to free a region that was not marked as reserved (i.e. has + * no corresponding entry in memblock.reserved). It verifies that array, regions + * counter and total size were not modified. + */ +static int memblock_free_absent_check(void) +{ + struct memblock_region *rgn; + + rgn = &memblock.reserved.regions[0]; + + struct region r1 = { + .base = SZ_2M, + .size = SZ_8K + }; + struct region r2 = { + .base = SZ_16M, + .size = SZ_128M + }; + + reset_memblock(); + memblock_reserve(r1.base, r1.size); + memblock_free((void *)r2.base, r2.size); + + assert(rgn->base == r1.base); + assert(rgn->size == r1.size); + + assert(memblock.reserved.cnt == 1); + assert(memblock.reserved.total_size == r1.size); + + return 0; +} + +/* + * A test that tries to free a region which overlaps with the beginning of + * the already existing entry r1 (that is r1.base < r2.base + r2.size). It + * checks if only the intersection of both regions is freed. The test also + * checks if the regions counter and total size are updated to expected values. + */ +static int memblock_free_overlap_top_check(void) +{ + struct memblock_region *rgn; + phys_addr_t total_size; + + rgn = &memblock.reserved.regions[0]; + + struct region r1 = { + .base = SZ_8M, + .size = SZ_32M + }; + struct region r2 = { + .base = SZ_1M, + .size = SZ_8M + }; + + total_size = (r1.size + r1.base) - (r2.base + r2.size); + + reset_memblock(); + memblock_reserve(r1.base, r1.size); + memblock_free((void *)r2.base, r2.size); + + assert(rgn->base == r2.base + r2.size); + assert(rgn->size == total_size); + + assert(memblock.reserved.cnt == 1); + assert(memblock.reserved.total_size == total_size); + + return 0; +} + +/* + * A test that tries to free a region which overlaps with the end of the + * first entry (that is r2.base < r1.base + r1.size). It checks if only the + * intersection of both regions is freed. The test also checks if the regions + * counter and total size are updated to expected values. + */ +static int memblock_free_overlap_bottom_check(void) +{ + struct memblock_region *rgn; + phys_addr_t total_size; + + rgn = &memblock.reserved.regions[0]; + + struct region r1 = { + .base = SZ_8M, + .size = SZ_32M + }; + struct region r2 = { + .base = SZ_32M, + .size = SZ_32M + }; + + total_size = r2.base - r1.base; + + reset_memblock(); + memblock_reserve(r1.base, r1.size); + memblock_free((void *)r2.base, r2.size); + + assert(rgn->base == r1.base); + assert(rgn->size == total_size); + + assert(memblock.reserved.cnt == 1); + assert(memblock.reserved.total_size == total_size); + + return 0; +} + +/* + * A test that tries to free a region which is within the range of the already + * existing entry (that is (r1.base < r2.base) && (r2.base + r2.size < r1.base + r1.size)). + * It checks if the region is split into two - one that ends at r2.base and second + * that starts at r2.base + size, with appropriate sizes. It is expected that + * the region counter and total size fields were updated t reflect that change. + */ +static int memblock_free_within_check(void) +{ + struct memblock_region *rgn1, *rgn2; + phys_addr_t r1_size, r2_size, total_size; + + rgn1 = &memblock.reserved.regions[0]; + rgn2 = &memblock.reserved.regions[1]; + + struct region r1 = { + .base = SZ_1M, + .size = SZ_8M + }; + struct region r2 = { + .base = SZ_4M, + .size = SZ_1M + }; + + r1_size = r2.base - r1.base; + r2_size = (r1.base + r1.size) - (r2.base + r2.size); + total_size = r1_size + r2_size; + + reset_memblock(); + memblock_reserve(r1.base, r1.size); + memblock_free((void *)r2.base, r2.size); + + assert(rgn1->base == r1.base); + assert(rgn1->size == r1_size); + + assert(rgn2->base == r2.base + r2.size); + assert(rgn2->size == r2_size); + + assert(memblock.reserved.cnt == 2); + assert(memblock.reserved.total_size == total_size); + + return 0; +} + +static int memblock_free_checks(void) +{ + memblock_free_simple_check(); + memblock_free_absent_check(); + memblock_free_overlap_top_check(); + memblock_free_overlap_bottom_check(); + memblock_free_within_check(); + + return 0; +} + int memblock_basic_checks(void) { memblock_initialization_check(); memblock_add_checks(); memblock_reserve_checks(); memblock_remove_checks(); + memblock_free_checks(); return 0; }