Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S940135AbcKPWYQ (ORCPT ); Wed, 16 Nov 2016 17:24:16 -0500 Received: from p3plsmtps2ded01.prod.phx3.secureserver.net ([208.109.80.58]:48054 "EHLO p3plsmtps2ded01.prod.phx3.secureserver.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933799AbcKPWYE (ORCPT ); Wed, 16 Nov 2016 17:24:04 -0500 x-originating-ip: 72.167.245.219 From: Matthew Wilcox To: linux-kernel@vger.kernel.org, Andrew Morton , Konstantin Khlebnikov , Ross Zwisler Cc: linux-fsdevel@vger.kernel.org, Matthew Wilcox , linux-mm@kvack.org, "Kirill A . Shutemov" Subject: [PATCH 01/29] tools: Add WARN_ON_ONCE Date: Wed, 16 Nov 2016 16:16:26 -0800 Message-Id: <1479341856-30320-2-git-send-email-mawilcox@linuxonhyperv.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1479341856-30320-1-git-send-email-mawilcox@linuxonhyperv.com> References: <1479341856-30320-1-git-send-email-mawilcox@linuxonhyperv.com> X-CMAE-Envelope: MS4wfORY5Ckwex1IrRHAT1Fj4dPcveEmfsB0oJctEkdVEhI6ybQNyBwvXHGBvO9uUhpEBgaJI9HkcCWywW6wDkv9HY0YJthmyQw+NoHZ3+6Le/V7IPhC3QKn yUGWGe2kpdS16BxeIJVzpcvMgQd2UvwH/CyOoKTy4+/0NyAAiuCHOMSV1lIdyestg400rCQtwpsgK8d4uHfEMeMePuE2lZ0kjwkoiyexFp5wRVJD+vVIejmT Cv9XaSiOtcWONq2Jh9Db5mdL2Yz2XIdhVjF6npUMS10fDWM9nDUmwrbcEOPObKx/728m1K2rD7gbNg5rixcGoVEWvVW1l+4LaoWIrRLRjDyZlnJeUgkD5gN2 TZ6XAnlb9sPckTatPeaiFKbwHoEMBW52lv28Z5lnDh7a4QjBldBffHQfDi5hjze/GmQsxgjs6UyrgpBLHx6Ts3wXws//5fyt2wZ4uiyilx1c4/KYSRY= Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2162 Lines: 68 From: Matthew Wilcox The radix tree uses its own buggy WARN_ON_ONCE. Replace it with the definition from asm-generic/bug.h Signed-off-by: Matthew Wilcox --- tools/include/asm/bug.h | 11 +++++++++++ tools/testing/radix-tree/Makefile | 2 +- tools/testing/radix-tree/linux/bug.h | 2 +- tools/testing/radix-tree/linux/types.h | 2 -- 4 files changed, 13 insertions(+), 4 deletions(-) diff --git a/tools/include/asm/bug.h b/tools/include/asm/bug.h index 9e5f484..beda1a8 100644 --- a/tools/include/asm/bug.h +++ b/tools/include/asm/bug.h @@ -12,6 +12,17 @@ unlikely(__ret_warn_on); \ }) +#define WARN_ON_ONCE(condition) ({ \ + static int __warned; \ + int __ret_warn_once = !!(condition); \ + \ + if (unlikely(__ret_warn_once && !__warned)) { \ + __warned = true; \ + WARN_ON(1); \ + } \ + unlikely(__ret_warn_once); \ +}) + #define WARN_ONCE(condition, format...) ({ \ static int __warned; \ int __ret_warn_once = !!(condition); \ diff --git a/tools/testing/radix-tree/Makefile b/tools/testing/radix-tree/Makefile index f2e07f2..3c338dc 100644 --- a/tools/testing/radix-tree/Makefile +++ b/tools/testing/radix-tree/Makefile @@ -1,5 +1,5 @@ -CFLAGS += -I. -g -O2 -Wall -D_LGPL_SOURCE +CFLAGS += -I. -I../../include -g -O2 -Wall -D_LGPL_SOURCE LDFLAGS += -lpthread -lurcu TARGETS = main OFILES = main.o radix-tree.o linux.o test.o tag_check.o find_next_bit.o \ diff --git a/tools/testing/radix-tree/linux/bug.h b/tools/testing/radix-tree/linux/bug.h index ccbe444..23b8ed5 100644 --- a/tools/testing/radix-tree/linux/bug.h +++ b/tools/testing/radix-tree/linux/bug.h @@ -1 +1 @@ -#define WARN_ON_ONCE(x) assert(x) +#include "asm/bug.h" diff --git a/tools/testing/radix-tree/linux/types.h b/tools/testing/radix-tree/linux/types.h index faa0b6f..8491d89 100644 --- a/tools/testing/radix-tree/linux/types.h +++ b/tools/testing/radix-tree/linux/types.h @@ -6,8 +6,6 @@ #define __rcu #define __read_mostly -#define BITS_PER_LONG (sizeof(long) * 8) - static inline void INIT_LIST_HEAD(struct list_head *list) { list->next = list; -- 2.10.2