Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp1428749pxb; Tue, 26 Oct 2021 08:51:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxrvaVbD7fHEd5Cn2HWE4kOcgWIJSscwh+rwmxv8qb4xn9Li8pXnllLe7hWf7pnIWnRiseq X-Received: by 2002:a05:6a00:1686:b0:44d:50e:de9e with SMTP id k6-20020a056a00168600b0044d050ede9emr26789623pfc.4.1635263371889; Tue, 26 Oct 2021 08:49:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635263371; cv=none; d=google.com; s=arc-20160816; b=wIbe/Eq1OTWBpDFoDrybzKpX2ZEf+/2OV7Y8W84pbLFFdcTtpAELGOJSVcerlxl+I4 ichkQrUKZMrnJPsI37FuXuCsnVsgg9xf8AB5S1g2WnOyUXKOdXvfUzILgS2ruQQB7pOo hIMtuA/ozX3IFVFSBecvBrvXQ9H7LToibXKBIA4KDLc13gCJ7UzTNRyX0QmX3sifiouz QTR4UdZNk+kBdzZ3/m7eBcIc9exssAKMed49R+yLqHwMdhsRBZPXaPcRTic1fJyqClNq OQVhvWDAS75fVZRZspk6SUtKVrYA7ZI/GzmfwT3OSO+5/HqUCm6snnizU0r9bt1Kaf9V 3asg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:dkim-signature:dkim-signature:date; bh=eZ4neUNOghjf5S1JjI+gn7geqrIVxjnymAdwbN+Ka6Q=; b=LvC991ZrhIcAnc7v54KMjawf9ubqyjEzAVTe30UKLprlUoKKu868DV9ikGZU/umv2i XX82uN6rgCf45vZ5yiCoFNO1RymTyot5k18uuDAy1rztnMkxif0nMiKp4XYdbL4rP7g/ wJhNioQM3z+JEg72gPUuON29Exxx0V6Mdcxkhz9MPufOzZXlgLnRfvRoIga5Ia1GkKJq cZ3siW9+y6NH1CMvd7puO8uNeP6pOSs281ZqiuRIhzOPWimqjgb5RjdiMVhovoEPl6yt 5ktNbaX+fYjFnDCta4HG6iqIb2rKnp6uKSlOzPthx5DYqg2itzyT+QL6O1dQ/xkEA4lI w4xw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=Vv3MANl9; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=FgUEv64Z; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id lx12si1502604pjb.164.2021.10.26.08.49.01; Tue, 26 Oct 2021 08:49:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=Vv3MANl9; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=FgUEv64Z; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235547AbhJZLqU (ORCPT + 99 others); Tue, 26 Oct 2021 07:46:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45852 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233543AbhJZLqT (ORCPT ); Tue, 26 Oct 2021 07:46:19 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7A8D1C061745; Tue, 26 Oct 2021 04:43:55 -0700 (PDT) Date: Tue, 26 Oct 2021 13:43:51 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1635248632; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=eZ4neUNOghjf5S1JjI+gn7geqrIVxjnymAdwbN+Ka6Q=; b=Vv3MANl93vmVT+PzjlUy9IAiN9eKvoX68WnqLW71WE8b0BJ3XZJfgPJwb0BGI8l2gDk6TZ nENdV+Lg0/GOd5s6xk6Rw4OdU2ONT0B1zLtcqycvmbUo7lkLbiQO3BIxMVfNxjXxNMevAi +ufx6mjfKntjwHy+ACeTYNI4OFLX4i73WT9KXjW6G70iXuNpBcnrDca5aLJQXAnPTDYloo VRV3sVXvJGh6zii+0MYL+iZhQUdrsKlWlI2TdwtxFR4vMahAl6nw1sEAqu2Md0X5w6/WKQ Fri219z+Vo4cs5zeUY6DyO7DlfEqVzsQccMb+mMSsUZrrei9oaF8cFRe6uPS7A== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1635248632; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=eZ4neUNOghjf5S1JjI+gn7geqrIVxjnymAdwbN+Ka6Q=; b=FgUEv64Zmy/r7unL5ZMoMgqlnWZ4zbAa/Wg3P+hi61SIGHjQ0KezBbUujwbpNsUwnPEk2o GHXm6gPoHKb7CaDA== From: Sebastian Andrzej Siewior To: Denis Kirjanov Cc: Arnd Bergmann , Jamal Hadi Salim , Cong Wang , Jiri Pirko , "David S. Miller" , Jakub Kicinski , "Ahmed S. Darwish" , Arnd Bergmann , Zheng Yongjun , Eric Dumazet , Randy Dunlap , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Thomas Gleixner Subject: Re: [PATCH net-next v3] net: sched: gred: dynamically allocate tc_gred_qopt_offload Message-ID: <20211026114351.sq2qlpbfptd7hyxm@linutronix.de> References: <20211026100711.nalhttf6mbe6sudx@linutronix.de> <3bf1e148-14fc-98f6-5319-78046a7b9565@suse.de> <20211026105104.vhfxrwisqcbvsxiq@linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2021-10-26 14:16:16 [+0300], Denis Kirjanov wrote: > 10/26/21 1:51 PM, Sebastian Andrzej Siewior =D0=BF=D0=B8=D1=88=D0=B5=D1= =82: > > On 2021-10-26 13:42:24 [+0300], Denis Kirjanov wrote: > > > > diff --git a/net/sched/sch_gred.c b/net/sched/sch_gred.c > > > > index 72de08ef8335e..1073c76d05c45 100644 > > > > --- a/net/sched/sch_gred.c > > > > +++ b/net/sched/sch_gred.c > > > > @@ -311,42 +312,43 @@ static void gred_offload(struct Qdisc *sch, e= num tc_gred_command command) > > > > { > > > > struct gred_sched *table =3D qdisc_priv(sch); > > > > struct net_device *dev =3D qdisc_dev(sch); > > > > - struct tc_gred_qopt_offload opt =3D { > > > > - .command =3D command, > > > > - .handle =3D sch->handle, > > > > - .parent =3D sch->parent, > > > > - }; > > > > + struct tc_gred_qopt_offload *opt =3D table->opt; > > > > if (!tc_can_offload(dev) || !dev->netdev_ops->ndo_setup_tc) > > > > return; > > > > + memset(opt, 0, sizeof(*opt)); > > >=20 > > > It's zeroed in kzalloc() > >=20 > > but it is not limited to a single invocation? >=20 > I meant that all fields are set in the function as it was with the stack > storage. What about? | for (i =3D 0; i < table->DPs; i++) { | struct gred_sched_data *q =3D table->tab[i]; |=20 | if (!q) | continue; The stack storage version has an implicit memset(). Sebastian