Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp5454705imm; Tue, 16 Oct 2018 10:28:12 -0700 (PDT) X-Google-Smtp-Source: ACcGV61UMJYL3eM0ReZ3IouADikFJt6z12tmn7ciWoitDLT56Gl6wI+0AOh3RT3jZtkOrTrwlmDo X-Received: by 2002:a63:844:: with SMTP id 65-v6mr20572154pgi.144.1539710892931; Tue, 16 Oct 2018 10:28:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539710892; cv=none; d=google.com; s=arc-20160816; b=JLjb4t31sj/rVu9uWa2x3UBz9FK//PZK3ie/YSNyP5T4LcXIQ5MkQh8W0LuIkzouT9 M5cf4rQxYuqUHGvqKM8TEwWOwNaQvFLR/rfg0qt7otINXnAp+C6f+aT6mpy29GHD2OYc HU1PXfHWGsyFGGmQ7MF7TvRM74FmixjsUEl4RmUnPpZTtpgp9kXAlWtnX0tApqMEFemq 25dFq5eNed8aydbrpMfX4fHNIoqoZSv1LJw0k3ghjoEejNCrMAGnMxRIJz+4ZdAwJRIZ xe4QoFtVCvx0lkVnnnXX5/PT6c2YZ0jVvjSFzXBPYjg4qF0hCvas9udo/7jRcksReKj0 SdcA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=jSRUjRXCs7eGhoPoZn1enO8MsPcnaIk92XkR0r2bBa4=; b=c1JpSnoVIyCuqFWmnXcJezCfTvo5qCxzJtimmQISYnXIX1vWtjO+utAH/5q4hDXvmu GXwoENN+sqXQFaNM/I1svVPptJ2p4QJAorKbM/NJLDkPnUpqNSApGNJlscKlA8cM9DKt fr15wjKOnSZNcak9ToQ/UK05qGGWLKgm+Ro4jj8YaeLvBaq2irUtFMV83ZauUtfePx+3 O+kjHiUAGtZ66UAMXPZuX4BZyvoROEm4FJt7uaL/sPlO5wFlz/JaHHwM09tcsjpbPZ1t BlBswUXz3uB2Nn6vTIIVxDet6rJQLH84wIwNq7X4E6H9DiaR3mVkomNyMkGInAUkaYAR 9lqw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="r8fGEx/q"; 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 u18-v6si14552266pgl.59.2018.10.16.10.27.56; Tue, 16 Oct 2018 10:28:12 -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; dkim=pass header.i=@kernel.org header.s=default header.b="r8fGEx/q"; 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 S1732083AbeJQBRJ (ORCPT + 99 others); Tue, 16 Oct 2018 21:17:09 -0400 Received: from mail.kernel.org ([198.145.29.99]:35922 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730396AbeJQBRJ (ORCPT ); Tue, 16 Oct 2018 21:17:09 -0400 Received: from localhost (ip-213-127-77-176.ip.prioritytelecom.net [213.127.77.176]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 5014A204EC; Tue, 16 Oct 2018 17:25:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1539710742; bh=4lWIhtWpEzUXRt+xVM4G+xBS910Um42bnZ49szdbDuk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=r8fGEx/q2yA84692aUMJnLWfSpS7j41hF6xI97PYcuL77ex6E2BL/azSCs5PqK2rn 97OXghgAbZZmKBsjD9aofaIB/n476M3vrdDYtSZ4PaYn30V8ACorKu0N1K6TPz2/DY 5cFCOlm/AkIKaHEllqqsOpvkAxrNBHWjG9PLCvIM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org, netdev@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Eric Dumazet , Herbert Xu , "David S. Miller" Subject: [PATCH 4.9 49/71] rhashtable: add schedule points Date: Tue, 16 Oct 2018 19:09:46 +0200 Message-Id: <20181016170541.823906038@linuxfoundation.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181016170539.315587743@linuxfoundation.org> References: <20181016170539.315587743@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.9-stable review patch. If anyone has any objections, please let me know. ------------------ From: Eric Dumazet Rehashing and destroying large hash table takes a lot of time, and happens in process context. It is safe to add cond_resched() in rhashtable_rehash_table() and rhashtable_free_and_destroy() Signed-off-by: Eric Dumazet Acked-by: Herbert Xu Signed-off-by: David S. Miller (cherry picked from commit ae6da1f503abb5a5081f9f6c4a6881de97830f3e) Signed-off-by: Greg Kroah-Hartman --- lib/rhashtable.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) --- a/lib/rhashtable.c +++ b/lib/rhashtable.c @@ -251,8 +251,10 @@ static int rhashtable_rehash_table(struc if (!new_tbl) return 0; - for (old_hash = 0; old_hash < old_tbl->size; old_hash++) + for (old_hash = 0; old_hash < old_tbl->size; old_hash++) { rhashtable_rehash_chain(ht, old_hash); + cond_resched(); + } /* Publish the new table pointer. */ rcu_assign_pointer(ht->tbl, new_tbl); @@ -993,6 +995,7 @@ void rhashtable_free_and_destroy(struct for (i = 0; i < tbl->size; i++) { struct rhash_head *pos, *next; + cond_resched(); for (pos = rht_dereference(tbl->buckets[i], ht), next = !rht_is_a_nulls(pos) ? rht_dereference(pos->next, ht) : NULL;