From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9B215C433EF for ; Mon, 27 Jun 2022 18:59:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239147AbiF0S7c (ORCPT ); Mon, 27 Jun 2022 14:59:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49450 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237262AbiF0S7b (ORCPT ); Mon, 27 Jun 2022 14:59:31 -0400 Received: from smtp-fw-33001.amazon.com (smtp-fw-33001.amazon.com [207.171.190.10]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 244DB10DE for ; Mon, 27 Jun 2022 11:59:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazon201209; t=1656356370; x=1687892370; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=lvNw/P7qM5QCfdssWxmMogElVd1RUtk20y5SfXAxbvc=; b=rf+BSBBqsfTYK6L1HYuTnG6Fo4VfZNlcJGYzPp8H/8DjkvIhKDJWLYyd KW8oFRMF+ZQwrEw0cUn8plmIJlgrfOExR8ESctsPQJqlTnIIX/KdfuoxT jBqiJmOB5MR7oXPCbLWEbltobkw7iRpAlsPqMh5ZVL1MI2SuAnlfp1pac E=; X-IronPort-AV: E=Sophos;i="5.92,227,1650931200"; d="scan'208";a="205524144" Received: from iad12-co-svc-p1-lb1-vlan2.amazon.com (HELO email-inbound-relay-pdx-2c-d9fba5dd.us-west-2.amazon.com) ([10.43.8.2]) by smtp-border-fw-33001.sea14.amazon.com with ESMTP; 27 Jun 2022 18:59:09 +0000 Received: from EX13MTAUWB001.ant.amazon.com (pdx1-ws-svc-p6-lb9-vlan2.pdx.amazon.com [10.236.137.194]) by email-inbound-relay-pdx-2c-d9fba5dd.us-west-2.amazon.com (Postfix) with ESMTPS id AE65E434F0; Mon, 27 Jun 2022 18:59:08 +0000 (UTC) Received: from EX13D04ANC001.ant.amazon.com (10.43.157.89) by EX13MTAUWB001.ant.amazon.com (10.43.161.207) with Microsoft SMTP Server (TLS) id 15.0.1497.36; Mon, 27 Jun 2022 18:59:08 +0000 Received: from 88665a182662.ant.amazon.com (10.43.160.124) by EX13D04ANC001.ant.amazon.com (10.43.157.89) with Microsoft SMTP Server (TLS) id 15.0.1497.36; Mon, 27 Jun 2022 18:59:05 +0000 From: Kuniyuki Iwashima To: CC: , , , , , , , , Subject: Re: [PATCH v2 net] af_unix: Do not call kmemdup() for init_net's sysctl table. Date: Mon, 27 Jun 2022 11:58:57 -0700 Message-ID: <20220627185857.1272-1-kuniyu@amazon.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.43.160.124] X-ClientProxiedBy: EX13D23UWA001.ant.amazon.com (10.43.160.68) To EX13D04ANC001.ant.amazon.com (10.43.157.89) Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Eric Dumazet Date: Mon, 27 Jun 2022 20:40:24 +0200 > On Mon, Jun 27, 2022 at 8:30 PM Kuniyuki Iwashima wrote: > > > > From: Jakub Kicinski > > Date: Mon, 27 Jun 2022 10:58:59 -0700 > > > On Sun, 26 Jun 2022 11:43:27 -0500 Eric W. Biederman wrote: > > > > Kuniyuki Iwashima writes: > > > > > > > > > While setting up init_net's sysctl table, we need not duplicate the global > > > > > table and can use it directly. > > > > > > > > Acked-by: "Eric W. Biederman" > > > > > > > > I am not quite certain the savings of a single entry table justivies > > > > the complexity. But the looks correct. > > > > > > Yeah, the commit message is a little sparse. The "why" is not addressed. > > > Could you add more details to explain the motivation? > > > > I was working on a series which converts UDP/TCP hash tables into per-netns > > ones like AF_UNIX to speed up looking up sockets. It will consume much > > memory on a host with thousands of netns, but it can be waste if we do not > > have its protocol family's sockets. > > For the record, I doubt we will accept such a patch (per net-ns > TCP/UDP hash tables) Is it because it's risky? IIRC, you said we need per netns table for TCP in the future. > > So, I'm now working on a follow-up series for AF_UNIX per-netns hash table > > so that we can change the size for a child netns by a sysctl knob: > > > > # sysctl -w net.unix.child_hash_entries=128 > > # ip net add test # created with the hash table size 128 > > # ip net exec test sh > > # sysctl net.unix.hash_entries # read-only > > 128 > > > > (The size for init_net can be changed via a new boot parameter > > xhash_entries like uhash_entries/thash_entries.) > > > > While implementing that, I found that kmemdup() is called for init_net but > > TCP/UDP does not (See: ipv4_sysctl_init_net()). Unlike IPv4, AF_UNIX does > > not have a huge sysctl table, so it cannot be a problem though, this patch > > is for consuming less memory and kind of consistency. The reason I submit > > this seperately is that it might be better to have a Fixes tag. > > I think that af_unix module can be unloaded. > > Your patch will break the module unload operation. Thank you! I had to take of kfree() in unix_sysctl_unregister().