From patchwork Mon Aug 29 06:38:41 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Song Chen X-Patchwork-Id: 12957466 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 36B48ECAAD2 for ; Mon, 29 Aug 2022 06:35:21 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id ABF05940009; Mon, 29 Aug 2022 02:35:20 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A6EBD940007; Mon, 29 Aug 2022 02:35:20 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 95D5B940009; Mon, 29 Aug 2022 02:35:20 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 875A2940007 for ; Mon, 29 Aug 2022 02:35:20 -0400 (EDT) Received: from smtpin24.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 593FE40AD5 for ; Mon, 29 Aug 2022 06:35:20 +0000 (UTC) X-FDA: 79851668400.24.64FFD75 Received: from 189.cn (ptr.189.cn [183.61.185.102]) by imf17.hostedemail.com (Postfix) with ESMTP id 4C6F240002 for ; Mon, 29 Aug 2022 06:35:18 +0000 (UTC) HMM_SOURCE_IP: 10.64.8.41:33464.1972940701 HMM_ATTACHE_NUM: 0000 HMM_SOURCE_TYPE: SMTP Received: from clientip-123.150.8.42 (unknown [10.64.8.41]) by 189.cn (HERMES) with SMTP id 440CB1002B3; Mon, 29 Aug 2022 14:35:11 +0800 (CST) Received: from ([123.150.8.42]) by gateway-153622-dep-84fc4d489d-ngzxf with ESMTP id f15f6262ff3f481d8b2da43890107d73 for karolinadrobnik@gmail.com; Mon, 29 Aug 2022 14:35:12 CST X-Transaction-ID: f15f6262ff3f481d8b2da43890107d73 X-Real-From: chensong_2000@189.cn X-Receive-IP: 123.150.8.42 X-MEDUSA-Status: 0 From: Song Chen To: karolinadrobnik@gmail.com, rppt@kernel.org Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, Song Chen Subject: [PATCH 1/2] tools/libs/slab.c: fix compiling mistakes of uatomic_inc/uatomic_dec Date: Mon, 29 Aug 2022 14:38:41 +0800 Message-Id: <1661755121-3286-1-git-send-email-chensong_2000@189.cn> X-Mailer: git-send-email 2.7.4 ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1661754920; a=rsa-sha256; cv=none; b=Lkb8RcagEDgd1RI/IkUmr3ZBLlHrjQRy/mm8Nqwh9O37TXQcsLcIFkTYn0QbRGx4dgEgmm jOCpJ+/KcoKjkqIcn4+FQSucGBrdQi5KaVcarrdlYXdWUBKQSluTfUZl2XFjSnkEZ184ra 52MDpxFtlGe+bA6OOD+hf7zqKY8k9ng= ARC-Authentication-Results: i=1; imf17.hostedemail.com; dkim=none; dmarc=none; spf=pass (imf17.hostedemail.com: domain of chensong_2000@189.cn designates 183.61.185.102 as permitted sender) smtp.mailfrom=chensong_2000@189.cn ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1661754920; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=B0m2NhmRXHXfR/tgEQ6yWwqwqu6oq/e6DEw0n6blq84=; b=bSZgzUhkChTePalT26bCCOOPHid1ZhNr4KOIa24GV349RTZe5e8vqvcqJMfOUfBgJOImUQ U68FtGZylNzbM7SXDgtYEo48rLpRbNa/a3uyBiM3EruSz2jDk15MkPd1V9+0f6KU3YQtB0 DyeObIBM784imt8Zlm8if5kNtq+NhOk= Authentication-Results: imf17.hostedemail.com; dkim=none; dmarc=none; spf=pass (imf17.hostedemail.com: domain of chensong_2000@189.cn designates 183.61.185.102 as permitted sender) smtp.mailfrom=chensong_2000@189.cn X-Rspam-User: X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: 4C6F240002 X-Stat-Signature: ammrobcjussx4yiafd8pyx73tcy35br6 X-HE-Tag: 1661754918-599603 X-Bogosity: Ham, tests=bogofilter, spamicity=0.001147, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: I tried to build tools/test/memblock and got such message: /usr/bin/ld: slab.o: in function `kmalloc': slab.c:(.text+0x2b): undefined reference to `uatomic_inc' /usr/bin/ld: slab.o: in function `kfree': slab.c:(.text+0x97): undefined reference to `uatomic_dec' collect2: error: ld returned 1 exit status I could find any definition or inplememtation of uatomic_inc/uatomic_dec in anywhere of the code base. So I use atomic_inc/atomic_dec_and_test to replace like other tests underneath tools/test, it works. Signed-off-by: Song Chen --- tools/lib/slab.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/lib/slab.c b/tools/lib/slab.c index 959997fb0652..8a5a8d536e35 100644 --- a/tools/lib/slab.c +++ b/tools/lib/slab.c @@ -3,7 +3,7 @@ #include #include -#include +#include #include #include #include @@ -19,7 +19,7 @@ void *kmalloc(size_t size, gfp_t gfp) return NULL; ret = malloc(size); - uatomic_inc(&kmalloc_nr_allocated); + atomic_inc(&kmalloc_nr_allocated); if (kmalloc_verbose) printf("Allocating %p from malloc\n", ret); if (gfp & __GFP_ZERO) @@ -31,7 +31,7 @@ void kfree(void *p) { if (!p) return; - uatomic_dec(&kmalloc_nr_allocated); + atomic_dec_and_test(&kmalloc_nr_allocated); if (kmalloc_verbose) printf("Freeing %p to malloc\n", p); free(p); From patchwork Mon Aug 29 06:39:00 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Song Chen X-Patchwork-Id: 12957467 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 D8037ECAAD2 for ; Mon, 29 Aug 2022 06:35:34 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 73D5294000A; Mon, 29 Aug 2022 02:35:34 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 6EC4C940007; Mon, 29 Aug 2022 02:35:34 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5DC3394000A; Mon, 29 Aug 2022 02:35:34 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 4BCE0940007 for ; Mon, 29 Aug 2022 02:35:34 -0400 (EDT) Received: from smtpin09.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 343C414076D for ; Mon, 29 Aug 2022 06:35:34 +0000 (UTC) X-FDA: 79851668988.09.EC150AE Received: from 189.cn (ptr.189.cn [183.61.185.104]) by imf08.hostedemail.com (Postfix) with ESMTP id A1141160026 for ; Mon, 29 Aug 2022 06:35:33 +0000 (UTC) HMM_SOURCE_IP: 10.64.8.43:58254.465013519 HMM_ATTACHE_NUM: 0000 HMM_SOURCE_TYPE: SMTP Received: from clientip-123.150.8.42 (unknown [10.64.8.43]) by 189.cn (HERMES) with SMTP id 47BFB1002C5; Mon, 29 Aug 2022 14:35:30 +0800 (CST) Received: from ([123.150.8.42]) by gateway-153622-dep-84fc4d489d-2xtjd with ESMTP id d5b1e1b832374690908240b4c2875a1c for karolinadrobnik@gmail.com; Mon, 29 Aug 2022 14:35:31 CST X-Transaction-ID: d5b1e1b832374690908240b4c2875a1c X-Real-From: chensong_2000@189.cn X-Receive-IP: 123.150.8.42 X-MEDUSA-Status: 0 From: Song Chen To: karolinadrobnik@gmail.com, rppt@kernel.org Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, Song Chen Subject: [PATCH 2/2] tools/testing/memblock: define pr_warn_ratelimited Date: Mon, 29 Aug 2022 14:39:00 +0800 Message-Id: <1661755140-3331-1-git-send-email-chensong_2000@189.cn> X-Mailer: git-send-email 2.7.4 ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1661754933; a=rsa-sha256; cv=none; b=ucofVglvOqir9/L9j1eTfGwc2nFfAsF2iIhTHE5KT7vrmr2TAjISnLkPTb8bKb2qgPyFbZ In+2JCclv0/aP844N10QRpHY8df1814WXyUOkkdXf5v/9dKLCvTEl043pU13xUloNtIDOx k3/tIlWr2UQw99A/ur28JnI2+QoKC1w= ARC-Authentication-Results: i=1; imf08.hostedemail.com; dkim=none; dmarc=none; spf=pass (imf08.hostedemail.com: domain of chensong_2000@189.cn designates 183.61.185.104 as permitted sender) smtp.mailfrom=chensong_2000@189.cn ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1661754933; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=xyUXf98guNZw+34LmVPdG1obPIw5Amfl6VWDFzoM5/0=; b=th44Bo3ouIjdS2p1GZDNfvgaiSY7qmlGP24qhTetERmONIgzx+xVdWPmwA1+z4AE5lZM4v qLVqQDnc4CFHaZ1KP8fere3VYGmki3YDyOIblQCaoMUz9ZIUB6yVoGFajGJtxqFauUVxlI 5977Xg7SyWYW24WJ0NfD2LYfIGNjJwo= X-Rspam-User: X-Rspamd-Queue-Id: A1141160026 Authentication-Results: imf08.hostedemail.com; dkim=none; dmarc=none; spf=pass (imf08.hostedemail.com: domain of chensong_2000@189.cn designates 183.61.185.104 as permitted sender) smtp.mailfrom=chensong_2000@189.cn X-Stat-Signature: odqps17s77pp4c43z43bohfnpcjo37fd X-Rspamd-Server: rspam07 X-HE-Tag: 1661754933-811169 X-Bogosity: Ham, tests=bogofilter, spamicity=0.095014, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Commit 14d9a675fd0d("mm: Ratelimited mirrored memory related warning messages") introduced pr_warn_ratelimited in memblock.c, which breaks tools/test/memblock, below is the message: /usr/bin/ld: memblock.o: in function `memblock_find_in_range.constprop.0': memblock.c:(.text+0x4603): undefined reference to `pr_warn_ratelimited' /usr/bin/ld: memblock.o: in function `memblock_alloc_range_nid': memblock.c:(.text+0x786a): undefined reference to `pr_warn_ratelimited' collect2: error: ld returned 1 exit status A fake pr_warn_ratelimited needs to be defined in printk.h like other prink functions. Signed-off-by: Song Chen --- tools/testing/memblock/linux/printk.h | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/testing/memblock/linux/printk.h b/tools/testing/memblock/linux/printk.h index 61af424d8c6c..bdca5eedbe4c 100644 --- a/tools/testing/memblock/linux/printk.h +++ b/tools/testing/memblock/linux/printk.h @@ -21,5 +21,6 @@ #define pr_cont printk #define pr_err printk #define pr_warn printk +#define pr_warn_ratelimited printf #endif