Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp3695546imm; Mon, 18 Jun 2018 02:28:21 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJ00Ki/DJ/hNm8si6McjoxmVW2h8SasTiVXOgPM7k/WlIewIVqQ+ofc1S30V38vcmHYUdwH X-Received: by 2002:a17:902:246a:: with SMTP id m39-v6mr13248545plg.141.1529314100983; Mon, 18 Jun 2018 02:28:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529314100; cv=none; d=google.com; s=arc-20160816; b=mWE4EvMmueOEE1fhnoarI2s9AsXf0K4EUELfU4VXBePNmGxSu/EfnHTPRVJAbvVdX1 LB65dDUjXU4F+gxwZxxrFYF/+LzyGFeIuA3mlv5ZEFVtcVJUp495hMQrsETkuvda9Hv6 ILDHQ6k3M4fXNiOiZ1RvBmaAenJdcOcMeNECLeqgRciNtg794gKKW5rdaDQ55pbSsai4 gTL1TBokfkSCAOzGNNjlNDQoi/3E+Jm8klmSIV599M9i4+otC0LFgPjnr5U4MP+Qem+w gDreMsGPrqncrU7ilNon4rk69fSoGLPMOe9EjNZNYnEx6KCGNMwnHweaidQh3MgF+7fJ ZaEA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=vEjg0vU0T7zq/dhvxPJTmedAfCgOErdXITB4LP5dsI8=; b=VQdR2Glyy90uzq+eH2ZHSETL4R5koxxWSgYFIOIQn/QiTU4/xfuqnnt12zlQh3RLYo 4k2TJsiacnNF4zn+ert2lYGVpAb3lJMOAuIcpIx9PnsOMLcWxr8pzMux9iqkMbZXsr0v BTeH4RUV1ZQVXGKDlpr1hc+XoQo+F7wNoOigE/CUEh0hAXzNkL57QED2U18zNpgvY4Qs ccxuouN8OAlJP4QvuPqwBvniwIZZxQML2uTKeKl+l0+Kmsw8UirijY2TzVcL8Z9CrF7y VVqtHa/ehOjE0BijdjI76t5lcxtYfQdndrXaRDVIu/6OC0KLpGRm/Y3z1w9yaY7szzst RJdQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d31-v6si15066316pld.23.2018.06.18.02.28.07; Mon, 18 Jun 2018 02:28:20 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965952AbeFRIZ6 (ORCPT + 99 others); Mon, 18 Jun 2018 04:25:58 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:57062 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932851AbeFRIZz (ORCPT ); Mon, 18 Jun 2018 04:25:55 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 8FCD3C8D; Mon, 18 Jun 2018 08:25:54 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Yury Norov , Andrew Morton , Fengguang Wu , Linus Torvalds , Sasha Levin Subject: [PATCH 4.16 227/279] lib/find_bit_benchmark.c: avoid soft lockup in test_find_first_bit() Date: Mon, 18 Jun 2018 10:13:32 +0200 Message-Id: <20180618080618.216781441@linuxfoundation.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180618080608.851973560@linuxfoundation.org> References: <20180618080608.851973560@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.16-stable review patch. If anyone has any objections, please let me know. ------------------ From: Yury Norov [ Upstream commit 4ba281d5bd9907355e6b79fb72049c9ed50cc670 ] test_find_first_bit() is intentionally sub-optimal, and may cause soft lockup due to long time of run on some systems. So decrease length of bitmap to traverse to avoid lockup. With the change below, time of test execution doesn't exceed 0.2 seconds on my testing system. Link: http://lkml.kernel.org/r/20180420171949.15710-1-ynorov@caviumnetworks.com Fixes: 4441fca0a27f5 ("lib: test module for find_*_bit() functions") Signed-off-by: Yury Norov Reviewed-by: Andrew Morton Reported-by: Fengguang Wu Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- lib/find_bit_benchmark.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) --- a/lib/find_bit_benchmark.c +++ b/lib/find_bit_benchmark.c @@ -132,7 +132,12 @@ static int __init find_bit_test(void) test_find_next_bit(bitmap, BITMAP_LEN); test_find_next_zero_bit(bitmap, BITMAP_LEN); test_find_last_bit(bitmap, BITMAP_LEN); - test_find_first_bit(bitmap, BITMAP_LEN); + + /* + * test_find_first_bit() may take some time, so + * traverse only part of bitmap to avoid soft lockup. + */ + test_find_first_bit(bitmap, BITMAP_LEN / 10); test_find_next_and_bit(bitmap, bitmap2, BITMAP_LEN); pr_err("\nStart testing find_bit() with sparse bitmap\n");