Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp1277238iof; Tue, 7 Jun 2022 02:17:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzdyveYOD6w2Gn4G5BlcM02WjJFNNhyjDR/yJCsRFMTYgx1D03fUd9Lk3v76a1wx8mGK69f X-Received: by 2002:aa7:854e:0:b0:51c:e1f:3da9 with SMTP id y14-20020aa7854e000000b0051c0e1f3da9mr11809557pfn.61.1654593455482; Tue, 07 Jun 2022 02:17:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654593455; cv=none; d=google.com; s=arc-20160816; b=Hxt0Of/HjQN+7gL+8e+dLauvEBPWLq6MF+ZOWWMWQfo0p7sG8KJ9iyYxCsv8OdcDse 592si4bIWXK8ECT1wQBXJxwLPRPrdFHejkkebEUdaYLBY/2tgcfqP0BTl5f9Te7lShow 6+zBFohxxNK/TqmO9HfuqLImbM8k/8MdYPA+YOItJQEAjUqWQ1zuQMzUfPphyPQgU5Bv 4ZBCShARiMADJbuyjBQ9toS3r65vPAVt9Q9PaIN4zqE1B0/czxrBAXW36PZTp1sprZSD DhRY2xv9IHFfGRIVo5WDahbCn3WI6keNWnHZmGmssxr5ur0svoUlBNPRDlTjGcKjRfmV 9+3A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=8IU+TSpoyQ3EBsEzc87QXqFIO9Dd/n4Kys9xA1IO4jk=; b=GUb//6xJ+jFoXM71T58yNIGvf1++pc00nOTceTaZcaVjZdy/peZsRlaYJE8snJMo0q 43Pz5mOhoIQnwWGmHk571ZGWxD27tBLvZUK8kTM02JNqqO15UY2mIViVT6VqSVb2u3yr v4m6S92ytqQzLU10ORxADMy1gKXgeFjkmVMCPFGRbRPq9YXnry4+6ww0eoisxHPG9b+J Bv5VqEQjljXhAXgRUgBCr9Tflpo0z+NUsP3Uj3DRqb5nE/CLeJi631v0fofZt3qBdE0q dz7Bs3SqM4H05QOf6qJKCkq3YvkvvUyBrrssBDg4hj2dnCHOvLklNbeAiwp9bMYrmTjn 67Hg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bytedance-com.20210112.gappssmtp.com header.s=20210112 header.b=8PkRrPQh; 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=fail (p=NONE sp=NONE dis=NONE) header.from=bytedance.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f65-20020a17090a704700b001e33517868dsi22228978pjk.150.2022.06.07.02.17.21; Tue, 07 Jun 2022 02:17: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=@bytedance-com.20210112.gappssmtp.com header.s=20210112 header.b=8PkRrPQh; 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=fail (p=NONE sp=NONE dis=NONE) header.from=bytedance.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229591AbiFGEQM (ORCPT + 99 others); Tue, 7 Jun 2022 00:16:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33268 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229638AbiFGEQK (ORCPT ); Tue, 7 Jun 2022 00:16:10 -0400 Received: from mail-yb1-xb2f.google.com (mail-yb1-xb2f.google.com [IPv6:2607:f8b0:4864:20::b2f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7D4AECFE08 for ; Mon, 6 Jun 2022 21:16:07 -0700 (PDT) Received: by mail-yb1-xb2f.google.com with SMTP id i39so1079853ybj.9 for ; Mon, 06 Jun 2022 21:16:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance-com.20210112.gappssmtp.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=8IU+TSpoyQ3EBsEzc87QXqFIO9Dd/n4Kys9xA1IO4jk=; b=8PkRrPQhB9xIYk5RJjIpA4Uhr1hZn7VgrHki7DCZSOuswsqCw8f0RCcLzz1Essg22w 5MSL84HZrHNOloEnxl4PRl1GiblSpkXuxcsXYKsCiGxPtK1NsFXHvQeCNz1PWPi604da OWsOpf9m4vKmWV2sOxM7LjE8QDEMmbGyZ4sN5FDVsXsVKZQdc9y2f4s53vrEi5nnSFKt E81ApnerFUd/wkThchi69JUHjx/exIa5DTTNSeMr/HRjmwQ8Bx0GI//RmUdACcF/fm8a B7CEVl/W0Bnilj1bW284ojwJ4qt6XhvtaE0myff0NumoIqk5XjhRBH3uBTs+U+jYPJcQ igVQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=8IU+TSpoyQ3EBsEzc87QXqFIO9Dd/n4Kys9xA1IO4jk=; b=ZEVarJcubGoMQrMVskhcdlFKhh+HpIzwo8D7Uo/VT6UJcJvScp+4HV6e80ZuDa/V9L hFSb1y/v6c3tZlEypKswqrooMeLHXXb7er3O53yceFtxWuzOdR82QjhcmyAPKd1MPGgn EKpnftfKxV2/tnSy8r/RL0ufUuH7IoTpsSrlIFXqcGP0jOudWs8fIENS3BC+uMlDfwrU nan3mNeflaO2N+lcigabw2WKNA330p9Co90SXSK2hxRsx6nq3yQK3am59dR2p2iMmnK5 czjLDFUa1dYmmDpvVACwAx54lxyEjJ/ojRFIl1Lbh5dPSTL/ZXiN7qsVwUj2CbxFlJBJ O+2g== X-Gm-Message-State: AOAM531+rya+LkpSSBhQtffTmU18TKTtGNzbPMmJf8sI5oGPy295xdQw Y2+PhnNkYrsZHvcUXIUHKEmAM6baHjZgZEqi6vuX/w== X-Received: by 2002:a05:6902:c9:b0:641:1998:9764 with SMTP id i9-20020a05690200c900b0064119989764mr27854106ybs.427.1654575366739; Mon, 06 Jun 2022 21:16:06 -0700 (PDT) MIME-Version: 1.0 References: <20220606070804.40268-1-songmuchun@bytedance.com> In-Reply-To: From: Muchun Song Date: Tue, 7 Jun 2022 12:15:29 +0800 Message-ID: Subject: Re: [PATCH] tcp: use kvmalloc_array() to allocate table_perturb To: Eric Dumazet Cc: David Miller , Hideaki YOSHIFUJI , David Ahern , Jakub Kicinski , Paolo Abeni , netdev , LKML Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,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 On Tue, Jun 7, 2022 at 12:03 PM Eric Dumazet wrote: > > On Mon, Jun 6, 2022 at 8:56 PM Muchun Song wrote: > > > > On Tue, Jun 7, 2022 at 12:13 AM Eric Dumazet wrote: > > > > > > On Mon, Jun 6, 2022 at 9:05 AM Eric Dumazet wrote: > > > > > > > > On Mon, Jun 6, 2022 at 12:08 AM Muchun Song wrote: > > > > > > > > > > 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 > > > > > kvmalloc_array() to allocate table_perturb. > > > > > > > > > > Signed-off-by: Muchun Song > > > > > > > > Please add a Fixes: tag and CC original author ? > > > > > > > > Will do. > > > > > > Thanks. > > > > > > Also using alloc_large_system_hash() might be a better option anyway, > > > spreading pages on multiple nodes on NUMA hosts. > > > > Using alloc_large_system_hash() LGTM, but > > I didn't see where the memory is allocated on multi-node > > in alloc_large_system_hash() or vmalloc_huge(), what I > > missed here? > > This is done by default. You do not have to do anything special. Just > call alloc_large_system_hash(). > > For instance, on two socket system: > > # grep alloc_large_system_hash /proc/vmallocinfo > 0x000000005536618c-0x00000000a4ae0198 12288 > alloc_large_system_hash+0x1df/0x2f0 pages=2 vmalloc N0=1 N1=1 > 0x000000003beddc38-0x0000000092b61b54 12288 > alloc_large_system_hash+0x1df/0x2f0 pages=2 vmalloc N0=1 N1=1 > 0x0000000092b61b54-0x000000005c33d7fb 12288 > alloc_large_system_hash+0x1df/0x2f0 pages=2 vmalloc N0=1 N1=1 > 0x000000004c0588af-0x0000000012cf548f 12288 > alloc_large_system_hash+0x1df/0x2f0 pages=2 vmalloc N0=1 N1=1 > 0x000000008d50035e-0x00000000f434e297 266240 > alloc_large_system_hash+0x1df/0x2f0 pages=64 vmalloc N0=32 N1=32 > 0x00000000fe631da3-0x00000000b60e95b8 268439552 > alloc_large_system_hash+0x1df/0x2f0 pages=65536 vmalloc vpages > N0=32768 N1=32768 > 0x00000000b60e95b8-0x0000000062eb7a11 528384 > alloc_large_system_hash+0x1df/0x2f0 pages=128 vmalloc N0=64 N1=64 > 0x0000000062eb7a11-0x000000005408af10 134221824 > alloc_large_system_hash+0x1df/0x2f0 pages=32768 vmalloc vpages > N0=16384 N1=16384 > 0x000000005408af10-0x0000000054fb99eb 4198400 > alloc_large_system_hash+0x1df/0x2f0 pages=1024 vmalloc vpages N0=512 > N1=512 > 0x0000000054fb99eb-0x00000000a130e604 4198400 > alloc_large_system_hash+0x1df/0x2f0 pages=1024 vmalloc vpages N0=512 > N1=512 > 0x00000000a130e604-0x00000000e6e62c85 4198400 > alloc_large_system_hash+0x1df/0x2f0 pages=1024 vmalloc vpages N0=512 > N1=512 > 0x00000000e6e62c85-0x000000005ca0ef7c 2101248 > alloc_large_system_hash+0x1df/0x2f0 pages=512 vmalloc N0=256 N1=256 > 0x000000005ca0ef7c-0x000000003bfe757f 1052672 > alloc_large_system_hash+0x1df/0x2f0 pages=256 vmalloc N0=128 N1=128 > 0x000000003bfe757f-0x00000000bf49fcbd 4198400 > alloc_large_system_hash+0x1df/0x2f0 pages=1024 vmalloc vpages N0=512 > N1=512 > 0x00000000bf49fcbd-0x00000000902de200 1052672 > alloc_large_system_hash+0x1df/0x2f0 pages=256 vmalloc N0=128 N1=128 > 0x00000000902de200-0x00000000c3d2821a 2101248 > alloc_large_system_hash+0x1df/0x2f0 pages=512 vmalloc N0=256 N1=256 > 0x00000000c3d2821a-0x000000002ddc68f6 2101248 > alloc_large_system_hash+0x1df/0x2f0 pages=512 vmalloc N0=256 N1=256 > > You can see N0=X and N1=X meaning pages are evenly spread among the two nodes. Thanks a lot. Really helpful information.