Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp582342iog; Mon, 13 Jun 2022 08:33:35 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uJT7BIBPpxmtnq5Vs3GFAs8zIjULdOoqmQNxcXRLXlR7ZYbpkYSFQbBMfGntOYInNCJfNa X-Received: by 2002:a17:907:6294:b0:6e1:ea4:74a3 with SMTP id nd20-20020a170907629400b006e10ea474a3mr395468ejc.168.1655134415335; Mon, 13 Jun 2022 08:33:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655134415; cv=none; d=google.com; s=arc-20160816; b=sjZquDrNzqliqVYm580pWh9gAAcft9EpnmQbMy8mm/Odgg3r8Fpsc/uqM0OwpLmeCy SU46f7wZGURE8++FBS5p3nUhjVzQAiSGivXKV6wQtMb/VRAR6ilMhPxVYhMUqlKGxLK0 Tpu9PlR4kr1Yh83BSyL2kITo+JIPxgLwjjbvAzHZlkp1WDe1mRT8VWfaduznph1DqHL3 mrlWLxW0YJO5kl0IWgu8VWx9OPKrfonvD8aAX0UU8kj3nUP3sO7CcWUn5ui/HzruzkRV ntC4hIajqGEUiNdSZTluIlar7utzifL7zLGdxrfWneY5nUFHl5VJfggg/1UVyhOxlXMh pxIQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=W0koM4D4q6Bc2s0+7zdUkP/sVMGG/MTJGQzeBFc5JTU=; b=p/msXr9msoQmWPaQZrCSEMZTA/3/LHonmmkU4ybLAXRBpnSp7jBWwry8KX2XCJnZ+e x4jdureEnvEEQPx8z8POIseCZ60Wv7BjLMDaOsdEkGbV9NqZ6h4t7rE27eY3QepTKPNY 6mOWOu6l9LxWUquKRmHdJbUyoeuLl2PR6n7KfTZ27mqGgB50sj7sC6yI//XzoIFLLuc3 yUVl2qYld8F2UJF8Fl0zQOOEKv8m6623NhXXV1S7wnlFw6Y3fnTrvkbjRiAjULEztL/p 3fDb1k/dXyU6cOuqoxybHOqJb5iDEqe8XhwbRLhpsi/yz+h2G1d95snfZaJTeI/VAUbC 87hw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=eSZkHn7w; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hp32-20020a1709073e2000b00711f0dfb8fesi8997265ejc.599.2022.06.13.08.33.08; Mon, 13 Jun 2022 08:33:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=eSZkHn7w; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239855AbiFMNPS (ORCPT + 99 others); Mon, 13 Jun 2022 09:15:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38602 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1359138AbiFMNJb (ORCPT ); Mon, 13 Jun 2022 09:09:31 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6D7A438BE8; Mon, 13 Jun 2022 04:19:21 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id C1BD8CE1174; Mon, 13 Jun 2022 11:19:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C243CC34114; Mon, 13 Jun 2022 11:19:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655119158; bh=rhAYimTtxz80OEZFM8rXb6yoxjM11WKvOvsRYWx+t6w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eSZkHn7w9A9YYNeCQmc9GCeS+1StK5YkkpUJvlCgDjRLXmg34AsJf8zaln6fJTNrm 14fXlL9dtOLyp1fZVoK7Rs+bL9m6aCjC/ee76qaZX1dg21peikeK6orRIlw54HwxBM /0EoM6Gp+GzwNKNiQKr4hDb291OIi5kUKrWWKnGg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Muchun Song , Eric Dumazet , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.15 161/247] tcp: use alloc_large_system_hash() to allocate table_perturb Date: Mon, 13 Jun 2022 12:11:03 +0200 Message-Id: <20220613094927.838678012@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220613094922.843438024@linuxfoundation.org> References: <20220613094922.843438024@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-8.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Muchun Song [ Upstream commit e67b72b90b7e19a4be4d9c29f3feea6f58ab43f8 ] In our server, there may be no high order (>= 6) memory since we reserve lots of HugeTLB pages when booting. Then the system panic. So use alloc_large_system_hash() to allocate table_perturb. Fixes: e9261476184b ("tcp: dynamically allocate the perturb table used by source ports") Signed-off-by: Muchun Song Reviewed-by: Eric Dumazet Link: https://lore.kernel.org/r/20220607070214.94443-1-songmuchun@bytedance.com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- net/ipv4/inet_hashtables.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/net/ipv4/inet_hashtables.c b/net/ipv4/inet_hashtables.c index ee9c587031b4..342f3df77835 100644 --- a/net/ipv4/inet_hashtables.c +++ b/net/ipv4/inet_hashtables.c @@ -917,10 +917,12 @@ void __init inet_hashinfo2_init(struct inet_hashinfo *h, const char *name, init_hashinfo_lhash2(h); /* this one is used for source ports of outgoing connections */ - table_perturb = kmalloc_array(INET_TABLE_PERTURB_SIZE, - sizeof(*table_perturb), GFP_KERNEL); - if (!table_perturb) - panic("TCP: failed to alloc table_perturb"); + table_perturb = alloc_large_system_hash("Table-perturb", + sizeof(*table_perturb), + INET_TABLE_PERTURB_SIZE, + 0, 0, NULL, NULL, + INET_TABLE_PERTURB_SIZE, + INET_TABLE_PERTURB_SIZE); } int inet_hashinfo2_init_mod(struct inet_hashinfo *h) -- 2.35.1