From patchwork Fri Jul 17 08:07:46 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Graf X-Patchwork-Id: 497028 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 46299140774 for ; Fri, 17 Jul 2015 18:08:01 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756585AbbGQIHy (ORCPT ); Fri, 17 Jul 2015 04:07:54 -0400 Received: from casper.infradead.org ([85.118.1.10]:47817 "EHLO casper.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753284AbbGQIHv (ORCPT ); Fri, 17 Jul 2015 04:07:51 -0400 Received: from 77-56-195-25.dclient.hispeed.ch ([77.56.195.25] helo=lsx.localdomain) by casper.infradead.org with esmtpsa (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZG0gO-0004wp-KN; Fri, 17 Jul 2015 08:07:48 +0000 From: Thomas Graf To: davem@davemloft.net Cc: netdev@vger.kernel.org, mroos@linux.ee, herbert@gondor.apana.org.au Subject: [PATCH net-next] rhashtable: Allow other tasks to be scheduled in large lookup loops Date: Fri, 17 Jul 2015 10:07:46 +0200 Message-Id: <2dcec22264c46d248e4f56ac5dfd6a8d321b162f.1437120351.git.tgraf@suug.ch> X-Mailer: git-send-email 2.4.3 X-SRS-Rewrite: SMTP reverse-path rewritten from by casper.infradead.org See http://www.infradead.org/rpr.html Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Depending on system speed, the large lookup loop can take a considerable amount of time to complete causing watchdog warnings to appear. Allow other tasks to be scheduled after every batch of 1000 lookups. Reported-by: Meelis Roos Signed-off-by: Thomas Graf --- lib/test_rhashtable.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/test_rhashtable.c b/lib/test_rhashtable.c index c90777e..5ed6211 100644 --- a/lib/test_rhashtable.c +++ b/lib/test_rhashtable.c @@ -20,8 +20,10 @@ #include #include #include +#include #define MAX_ENTRIES 1000000 +#define RELAX_CPU_AFTER 1000 #define TEST_INSERT_FAIL INT_MAX static int entries = 50000; @@ -61,7 +63,7 @@ static struct rhashtable_params test_rht_params = { static int __init test_rht_lookup(struct rhashtable *ht) { - unsigned int i; + unsigned int i, relax_cnt = RELAX_CPU_AFTER; for (i = 0; i < entries * 2; i++) { struct test_obj *obj; @@ -87,6 +89,11 @@ static int __init test_rht_lookup(struct rhashtable *ht) return -EINVAL; } } + + if (!relax_cnt--) { + schedule(); + relax_cnt = RELAX_CPU_AFTER; + } } return 0;