* [PATCH net-next] net: dpaa: remove init which already done in per-cpu allocation
@ 2017-10-29 1:48 yuan linyu
2017-10-30 5:08 ` Madalin-cristian Bucur
2017-11-01 3:09 ` David Miller
0 siblings, 2 replies; 10+ messages in thread
From: yuan linyu @ 2017-10-29 1:48 UTC (permalink / raw)
To: netdev; +Cc: David S . Miller, yuan linyu
From: yuan linyu <Linyu.Yuan@alcatel-sbell.com.cn>
Signed-off-by: yuan linyu <Linyu.Yuan@alcatel-sbell.com.cn>
---
drivers/net/ethernet/freescale/dpaa/dpaa_eth.c | 4 ----
1 file changed, 4 deletions(-)
diff --git a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
index a8d0be8..1ccc316 100644
--- a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
+++ b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
@@ -2814,10 +2814,6 @@ static int dpaa_eth_probe(struct platform_device *pdev)
err = -ENOMEM;
goto free_dpaa_fqs;
}
- for_each_possible_cpu(i) {
- percpu_priv = per_cpu_ptr(priv->percpu_priv, i);
- memset(percpu_priv, 0, sizeof(*percpu_priv));
- }
priv->num_tc = 1;
netif_set_real_num_tx_queues(net_dev, priv->num_tc * DPAA_TC_TXQ_NUM);
--
2.7.4
^ permalink raw reply related [flat|nested] 10+ messages in thread
* RE: [PATCH net-next] net: dpaa: remove init which already done in per-cpu allocation
2017-10-29 1:48 [PATCH net-next] net: dpaa: remove init which already done in per-cpu allocation yuan linyu
@ 2017-10-30 5:08 ` Madalin-cristian Bucur
2017-10-30 5:12 ` Yuan, Linyu (NSB - CN/Shanghai)
2017-11-01 3:09 ` David Miller
1 sibling, 1 reply; 10+ messages in thread
From: Madalin-cristian Bucur @ 2017-10-30 5:08 UTC (permalink / raw)
To: yuan linyu, netdev; +Cc: David S . Miller, yuan linyu
Hi Yuan,
Can you please give more details about this change you are proposing?
Regards,
Madalin
> -----Original Message-----
> From: netdev-owner@vger.kernel.org [mailto:netdev-owner@vger.kernel.org]
> On Behalf Of yuan linyu
> Sent: Sunday, October 29, 2017 3:49 AM
> To: netdev@vger.kernel.org
> Cc: David S . Miller <davem@davemloft.net>; yuan linyu
> <Linyu.Yuan@alcatel-sbell.com.cn>
> Subject: [PATCH net-next] net: dpaa: remove init which already done in
> per-cpu allocation
>
> From: yuan linyu <Linyu.Yuan@alcatel-sbell.com.cn>
>
> Signed-off-by: yuan linyu <Linyu.Yuan@alcatel-sbell.com.cn>
> ---
> drivers/net/ethernet/freescale/dpaa/dpaa_eth.c | 4 ----
> 1 file changed, 4 deletions(-)
>
> diff --git a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
> b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
> index a8d0be8..1ccc316 100644
> --- a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
> +++ b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
> @@ -2814,10 +2814,6 @@ static int dpaa_eth_probe(struct platform_device
> *pdev)
> err = -ENOMEM;
> goto free_dpaa_fqs;
> }
> - for_each_possible_cpu(i) {
> - percpu_priv = per_cpu_ptr(priv->percpu_priv, i);
> - memset(percpu_priv, 0, sizeof(*percpu_priv));
> - }
>
> priv->num_tc = 1;
> netif_set_real_num_tx_queues(net_dev, priv->num_tc *
> DPAA_TC_TXQ_NUM);
> --
> 2.7.4
>
^ permalink raw reply [flat|nested] 10+ messages in thread
* RE: [PATCH net-next] net: dpaa: remove init which already done in per-cpu allocation
2017-10-30 5:08 ` Madalin-cristian Bucur
@ 2017-10-30 5:12 ` Yuan, Linyu (NSB - CN/Shanghai)
2017-10-30 5:15 ` Madalin-cristian Bucur
0 siblings, 1 reply; 10+ messages in thread
From: Yuan, Linyu (NSB - CN/Shanghai) @ 2017-10-30 5:12 UTC (permalink / raw)
To: Madalin-cristian Bucur, yuan linyu, netdev; +Cc: David S . Miller
Hi,
devm_alloc_percpu() will allocate per-cpu memory and memset allocated block content to 0.
> -----Original Message-----
> From: Madalin-cristian Bucur [mailto:madalin.bucur@nxp.com]
> Sent: Monday, October 30, 2017 1:08 PM
> To: yuan linyu; netdev@vger.kernel.org
> Cc: David S . Miller; Yuan, Linyu (NSB - CN/Shanghai)
> Subject: RE: [PATCH net-next] net: dpaa: remove init which already done in
> per-cpu allocation
>
> Hi Yuan,
>
> Can you please give more details about this change you are proposing?
>
> Regards,
> Madalin
>
> > -----Original Message-----
> > From: netdev-owner@vger.kernel.org
> [mailto:netdev-owner@vger.kernel.org]
> > On Behalf Of yuan linyu
> > Sent: Sunday, October 29, 2017 3:49 AM
> > To: netdev@vger.kernel.org
> > Cc: David S . Miller <davem@davemloft.net>; yuan linyu
> > <Linyu.Yuan@alcatel-sbell.com.cn>
> > Subject: [PATCH net-next] net: dpaa: remove init which already done in
> > per-cpu allocation
> >
> > From: yuan linyu <Linyu.Yuan@alcatel-sbell.com.cn>
> >
> > Signed-off-by: yuan linyu <Linyu.Yuan@alcatel-sbell.com.cn>
> > ---
> > drivers/net/ethernet/freescale/dpaa/dpaa_eth.c | 4 ----
> > 1 file changed, 4 deletions(-)
> >
> > diff --git a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
> > b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
> > index a8d0be8..1ccc316 100644
> > --- a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
> > +++ b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
> > @@ -2814,10 +2814,6 @@ static int dpaa_eth_probe(struct
> platform_device
> > *pdev)
> > err = -ENOMEM;
> > goto free_dpaa_fqs;
> > }
> > - for_each_possible_cpu(i) {
> > - percpu_priv = per_cpu_ptr(priv->percpu_priv, i);
> > - memset(percpu_priv, 0, sizeof(*percpu_priv));
> > - }
> >
> > priv->num_tc = 1;
> > netif_set_real_num_tx_queues(net_dev, priv->num_tc *
> > DPAA_TC_TXQ_NUM);
> > --
> > 2.7.4
> >
^ permalink raw reply [flat|nested] 10+ messages in thread
* RE: [PATCH net-next] net: dpaa: remove init which already done in per-cpu allocation
2017-10-30 5:12 ` Yuan, Linyu (NSB - CN/Shanghai)
@ 2017-10-30 5:15 ` Madalin-cristian Bucur
2017-10-30 5:20 ` Yuan, Linyu (NSB - CN/Shanghai)
0 siblings, 1 reply; 10+ messages in thread
From: Madalin-cristian Bucur @ 2017-10-30 5:15 UTC (permalink / raw)
To: Yuan, Linyu (NSB - CN/Shanghai), yuan linyu, netdev; +Cc: David S . Miller
Is the memset part documented?
Can you point to the specific comment & code that does it?
Thanks
> -----Original Message-----
> From: Yuan, Linyu (NSB - CN/Shanghai) [mailto:linyu.yuan@nokia-sbell.com]
> Sent: Monday, October 30, 2017 7:12 AM
> To: Madalin-cristian Bucur <madalin.bucur@nxp.com>; yuan linyu
> <cugyly@163.com>; netdev@vger.kernel.org
> Cc: David S . Miller <davem@davemloft.net>
> Subject: RE: [PATCH net-next] net: dpaa: remove init which already done in
> per-cpu allocation
>
> Hi,
>
> devm_alloc_percpu() will allocate per-cpu memory and memset allocated
> block content to 0.
>
> > -----Original Message-----
> > From: Madalin-cristian Bucur [mailto:madalin.bucur@nxp.com]
> > Sent: Monday, October 30, 2017 1:08 PM
> > To: yuan linyu; netdev@vger.kernel.org
> > Cc: David S . Miller; Yuan, Linyu (NSB - CN/Shanghai)
> > Subject: RE: [PATCH net-next] net: dpaa: remove init which already done
> in
> > per-cpu allocation
> >
> > Hi Yuan,
> >
> > Can you please give more details about this change you are proposing?
> >
> > Regards,
> > Madalin
> >
> > > -----Original Message-----
> > > From: netdev-owner@vger.kernel.org
> > [mailto:netdev-owner@vger.kernel.org]
> > > On Behalf Of yuan linyu
> > > Sent: Sunday, October 29, 2017 3:49 AM
> > > To: netdev@vger.kernel.org
> > > Cc: David S . Miller <davem@davemloft.net>; yuan linyu
> > > <Linyu.Yuan@alcatel-sbell.com.cn>
> > > Subject: [PATCH net-next] net: dpaa: remove init which already done in
> > > per-cpu allocation
> > >
> > > From: yuan linyu <Linyu.Yuan@alcatel-sbell.com.cn>
> > >
> > > Signed-off-by: yuan linyu <Linyu.Yuan@alcatel-sbell.com.cn>
> > > ---
> > > drivers/net/ethernet/freescale/dpaa/dpaa_eth.c | 4 ----
> > > 1 file changed, 4 deletions(-)
> > >
> > > diff --git a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
> > > b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
> > > index a8d0be8..1ccc316 100644
> > > --- a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
> > > +++ b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
> > > @@ -2814,10 +2814,6 @@ static int dpaa_eth_probe(struct
> > platform_device
> > > *pdev)
> > > err = -ENOMEM;
> > > goto free_dpaa_fqs;
> > > }
> > > - for_each_possible_cpu(i) {
> > > - percpu_priv = per_cpu_ptr(priv->percpu_priv, i);
> > > - memset(percpu_priv, 0, sizeof(*percpu_priv));
> > > - }
> > >
> > > priv->num_tc = 1;
> > > netif_set_real_num_tx_queues(net_dev, priv->num_tc *
> > > DPAA_TC_TXQ_NUM);
> > > --
> > > 2.7.4
> > >
^ permalink raw reply [flat|nested] 10+ messages in thread
* RE: [PATCH net-next] net: dpaa: remove init which already done in per-cpu allocation
2017-10-30 5:15 ` Madalin-cristian Bucur
@ 2017-10-30 5:20 ` Yuan, Linyu (NSB - CN/Shanghai)
2017-10-30 5:56 ` Madalin-cristian Bucur
0 siblings, 1 reply; 10+ messages in thread
From: Yuan, Linyu (NSB - CN/Shanghai) @ 2017-10-30 5:20 UTC (permalink / raw)
To: Madalin-cristian Bucur, yuan linyu, netdev; +Cc: David S . Miller
http://elixir.free-electrons.com/linux/latest/source/mm/percpu.c#L1018
> -----Original Message-----
> From: Madalin-cristian Bucur [mailto:madalin.bucur@nxp.com]
> Sent: Monday, October 30, 2017 1:15 PM
> To: Yuan, Linyu (NSB - CN/Shanghai); yuan linyu; netdev@vger.kernel.org
> Cc: David S . Miller
> Subject: RE: [PATCH net-next] net: dpaa: remove init which already done in
> per-cpu allocation
>
> Is the memset part documented?
> Can you point to the specific comment & code that does it?
>
> Thanks
>
> > -----Original Message-----
> > From: Yuan, Linyu (NSB - CN/Shanghai) [mailto:linyu.yuan@nokia-sbell.com]
> > Sent: Monday, October 30, 2017 7:12 AM
> > To: Madalin-cristian Bucur <madalin.bucur@nxp.com>; yuan linyu
> > <cugyly@163.com>; netdev@vger.kernel.org
> > Cc: David S . Miller <davem@davemloft.net>
> > Subject: RE: [PATCH net-next] net: dpaa: remove init which already done in
> > per-cpu allocation
> >
> > Hi,
> >
> > devm_alloc_percpu() will allocate per-cpu memory and memset allocated
> > block content to 0.
> >
> > > -----Original Message-----
> > > From: Madalin-cristian Bucur [mailto:madalin.bucur@nxp.com]
> > > Sent: Monday, October 30, 2017 1:08 PM
> > > To: yuan linyu; netdev@vger.kernel.org
> > > Cc: David S . Miller; Yuan, Linyu (NSB - CN/Shanghai)
> > > Subject: RE: [PATCH net-next] net: dpaa: remove init which already done
> > in
> > > per-cpu allocation
> > >
> > > Hi Yuan,
> > >
> > > Can you please give more details about this change you are proposing?
> > >
> > > Regards,
> > > Madalin
> > >
> > > > -----Original Message-----
> > > > From: netdev-owner@vger.kernel.org
> > > [mailto:netdev-owner@vger.kernel.org]
> > > > On Behalf Of yuan linyu
> > > > Sent: Sunday, October 29, 2017 3:49 AM
> > > > To: netdev@vger.kernel.org
> > > > Cc: David S . Miller <davem@davemloft.net>; yuan linyu
> > > > <Linyu.Yuan@alcatel-sbell.com.cn>
> > > > Subject: [PATCH net-next] net: dpaa: remove init which already done in
> > > > per-cpu allocation
> > > >
> > > > From: yuan linyu <Linyu.Yuan@alcatel-sbell.com.cn>
> > > >
> > > > Signed-off-by: yuan linyu <Linyu.Yuan@alcatel-sbell.com.cn>
> > > > ---
> > > > drivers/net/ethernet/freescale/dpaa/dpaa_eth.c | 4 ----
> > > > 1 file changed, 4 deletions(-)
> > > >
> > > > diff --git a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
> > > > b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
> > > > index a8d0be8..1ccc316 100644
> > > > --- a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
> > > > +++ b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
> > > > @@ -2814,10 +2814,6 @@ static int dpaa_eth_probe(struct
> > > platform_device
> > > > *pdev)
> > > > err = -ENOMEM;
> > > > goto free_dpaa_fqs;
> > > > }
> > > > - for_each_possible_cpu(i) {
> > > > - percpu_priv = per_cpu_ptr(priv->percpu_priv, i);
> > > > - memset(percpu_priv, 0, sizeof(*percpu_priv));
> > > > - }
> > > >
> > > > priv->num_tc = 1;
> > > > netif_set_real_num_tx_queues(net_dev, priv->num_tc *
> > > > DPAA_TC_TXQ_NUM);
> > > > --
> > > > 2.7.4
> > > >
^ permalink raw reply [flat|nested] 10+ messages in thread
* RE: [PATCH net-next] net: dpaa: remove init which already done in per-cpu allocation
2017-10-30 5:20 ` Yuan, Linyu (NSB - CN/Shanghai)
@ 2017-10-30 5:56 ` Madalin-cristian Bucur
2017-10-30 6:15 ` Yuan, Linyu (NSB - CN/Shanghai)
0 siblings, 1 reply; 10+ messages in thread
From: Madalin-cristian Bucur @ 2017-10-30 5:56 UTC (permalink / raw)
To: Yuan, Linyu (NSB - CN/Shanghai), yuan linyu, netdev, gregkh
Cc: David S . Miller
Also here:
http://elixir.free-electrons.com/linux/latest/source/mm/percpu.c#L717
Should the fact that the memory is zeroed be included in the function description?
/**
* pcpu_alloc - the percpu allocator
* @size: size of area to allocate in bytes
* @align: alignment of area (max PAGE_SIZE)
* @reserved: allocate from the reserved chunk if available
* @gfp: allocation flags
*
* Allocate percpu area of @size bytes aligned at @align. If @gfp doesn't
* contain %GFP_KERNEL, the allocation is atomic.
*
* RETURNS:
* Percpu pointer to the allocated area on success, NULL on failure.
*/
Now it seems to be an implementation detail rather than a guarantee.
Looking at Documentation/driver-model/devres.txt, the memset is not mentioned there either.
> -----Original Message-----
> From: Yuan, Linyu (NSB - CN/Shanghai) [mailto:linyu.yuan@nokia-sbell.com]
> Sent: Monday, October 30, 2017 7:21 AM
> To: Madalin-cristian Bucur <madalin.bucur@nxp.com>; yuan linyu
> <cugyly@163.com>; netdev@vger.kernel.org
> Cc: David S . Miller <davem@davemloft.net>
> Subject: RE: [PATCH net-next] net: dpaa: remove init which already done in
> per-cpu allocation
>
> http://elixir.free-electrons.com/linux/latest/source/mm/percpu.c#L1018
>
> > -----Original Message-----
> > From: Madalin-cristian Bucur [mailto:madalin.bucur@nxp.com]
> > Sent: Monday, October 30, 2017 1:15 PM
> > To: Yuan, Linyu (NSB - CN/Shanghai); yuan linyu; netdev@vger.kernel.org
> > Cc: David S . Miller
> > Subject: RE: [PATCH net-next] net: dpaa: remove init which already done
> in
> > per-cpu allocation
> >
> > Is the memset part documented?
> > Can you point to the specific comment & code that does it?
> >
> > Thanks
> >
> > > -----Original Message-----
> > > From: Yuan, Linyu (NSB - CN/Shanghai) [mailto:linyu.yuan@nokia-
> sbell.com]
> > > Sent: Monday, October 30, 2017 7:12 AM
> > > To: Madalin-cristian Bucur <madalin.bucur@nxp.com>; yuan linyu
> > > <cugyly@163.com>; netdev@vger.kernel.org
> > > Cc: David S . Miller <davem@davemloft.net>
> > > Subject: RE: [PATCH net-next] net: dpaa: remove init which already
> done in
> > > per-cpu allocation
> > >
> > > Hi,
> > >
> > > devm_alloc_percpu() will allocate per-cpu memory and memset allocated
> > > block content to 0.
> > >
> > > > -----Original Message-----
> > > > From: Madalin-cristian Bucur [mailto:madalin.bucur@nxp.com]
> > > > Sent: Monday, October 30, 2017 1:08 PM
> > > > To: yuan linyu; netdev@vger.kernel.org
> > > > Cc: David S . Miller; Yuan, Linyu (NSB - CN/Shanghai)
> > > > Subject: RE: [PATCH net-next] net: dpaa: remove init which already
> done
> > > in
> > > > per-cpu allocation
> > > >
> > > > Hi Yuan,
> > > >
> > > > Can you please give more details about this change you are
> proposing?
> > > >
> > > > Regards,
> > > > Madalin
> > > >
> > > > > -----Original Message-----
> > > > > From: netdev-owner@vger.kernel.org
> > > > [mailto:netdev-owner@vger.kernel.org]
> > > > > On Behalf Of yuan linyu
> > > > > Sent: Sunday, October 29, 2017 3:49 AM
> > > > > To: netdev@vger.kernel.org
> > > > > Cc: David S . Miller <davem@davemloft.net>; yuan linyu
> > > > > <Linyu.Yuan@alcatel-sbell.com.cn>
> > > > > Subject: [PATCH net-next] net: dpaa: remove init which already
> done in
> > > > > per-cpu allocation
> > > > >
> > > > > From: yuan linyu <Linyu.Yuan@alcatel-sbell.com.cn>
> > > > >
> > > > > Signed-off-by: yuan linyu <Linyu.Yuan@alcatel-sbell.com.cn>
> > > > > ---
> > > > > drivers/net/ethernet/freescale/dpaa/dpaa_eth.c | 4 ----
> > > > > 1 file changed, 4 deletions(-)
> > > > >
> > > > > diff --git a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
> > > > > b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
> > > > > index a8d0be8..1ccc316 100644
> > > > > --- a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
> > > > > +++ b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
> > > > > @@ -2814,10 +2814,6 @@ static int dpaa_eth_probe(struct
> > > > platform_device
> > > > > *pdev)
> > > > > err = -ENOMEM;
> > > > > goto free_dpaa_fqs;
> > > > > }
> > > > > - for_each_possible_cpu(i) {
> > > > > - percpu_priv = per_cpu_ptr(priv->percpu_priv, i);
> > > > > - memset(percpu_priv, 0, sizeof(*percpu_priv));
> > > > > - }
> > > > >
> > > > > priv->num_tc = 1;
> > > > > netif_set_real_num_tx_queues(net_dev, priv->num_tc *
> > > > > DPAA_TC_TXQ_NUM);
> > > > > --
> > > > > 2.7.4
> > > > >
^ permalink raw reply [flat|nested] 10+ messages in thread
* RE: [PATCH net-next] net: dpaa: remove init which already done in per-cpu allocation
2017-10-30 5:56 ` Madalin-cristian Bucur
@ 2017-10-30 6:15 ` Yuan, Linyu (NSB - CN/Shanghai)
2017-10-30 7:13 ` Madalin-cristian Bucur
0 siblings, 1 reply; 10+ messages in thread
From: Yuan, Linyu (NSB - CN/Shanghai) @ 2017-10-30 6:15 UTC (permalink / raw)
To: Madalin-cristian Bucur, yuan linyu, netdev, gregkh; +Cc: David S . Miller
I just saw below accepted commit, it said "per cpu allocations are already zeroed, no need to clear them again."
https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git/commit/?id=bfd8e5a407133e58a92a38ccf3d0ba6db81f22d8
I will not touch memory sub-system, so I will not change this function description.
> -----Original Message-----
> From: Madalin-cristian Bucur [mailto:madalin.bucur@nxp.com]
> Sent: Monday, October 30, 2017 1:56 PM
> To: Yuan, Linyu (NSB - CN/Shanghai); yuan linyu; netdev@vger.kernel.org;
> gregkh@linuxfoundation.org
> Cc: David S . Miller
> Subject: RE: [PATCH net-next] net: dpaa: remove init which already done in
> per-cpu allocation
>
> Also here:
>
> http://elixir.free-electrons.com/linux/latest/source/mm/percpu.c#L717
>
> Should the fact that the memory is zeroed be included in the function
> description?
>
> /**
> * pcpu_alloc - the percpu allocator
> * @size: size of area to allocate in bytes
> * @align: alignment of area (max PAGE_SIZE)
> * @reserved: allocate from the reserved chunk if available
> * @gfp: allocation flags
> *
> * Allocate percpu area of @size bytes aligned at @align. If @gfp doesn't
> * contain %GFP_KERNEL, the allocation is atomic.
> *
> * RETURNS:
> * Percpu pointer to the allocated area on success, NULL on failure.
> */
>
> Now it seems to be an implementation detail rather than a guarantee.
>
> Looking at Documentation/driver-model/devres.txt, the memset is not
> mentioned there either.
>
> > -----Original Message-----
> > From: Yuan, Linyu (NSB - CN/Shanghai) [mailto:linyu.yuan@nokia-sbell.com]
> > Sent: Monday, October 30, 2017 7:21 AM
> > To: Madalin-cristian Bucur <madalin.bucur@nxp.com>; yuan linyu
> > <cugyly@163.com>; netdev@vger.kernel.org
> > Cc: David S . Miller <davem@davemloft.net>
> > Subject: RE: [PATCH net-next] net: dpaa: remove init which already done in
> > per-cpu allocation
> >
> > http://elixir.free-electrons.com/linux/latest/source/mm/percpu.c#L1018
> >
> > > -----Original Message-----
> > > From: Madalin-cristian Bucur [mailto:madalin.bucur@nxp.com]
> > > Sent: Monday, October 30, 2017 1:15 PM
> > > To: Yuan, Linyu (NSB - CN/Shanghai); yuan linyu; netdev@vger.kernel.org
> > > Cc: David S . Miller
> > > Subject: RE: [PATCH net-next] net: dpaa: remove init which already done
> > in
> > > per-cpu allocation
> > >
> > > Is the memset part documented?
> > > Can you point to the specific comment & code that does it?
> > >
> > > Thanks
> > >
> > > > -----Original Message-----
> > > > From: Yuan, Linyu (NSB - CN/Shanghai) [mailto:linyu.yuan@nokia-
> > sbell.com]
> > > > Sent: Monday, October 30, 2017 7:12 AM
> > > > To: Madalin-cristian Bucur <madalin.bucur@nxp.com>; yuan linyu
> > > > <cugyly@163.com>; netdev@vger.kernel.org
> > > > Cc: David S . Miller <davem@davemloft.net>
> > > > Subject: RE: [PATCH net-next] net: dpaa: remove init which already
> > done in
> > > > per-cpu allocation
> > > >
> > > > Hi,
> > > >
> > > > devm_alloc_percpu() will allocate per-cpu memory and memset allocated
> > > > block content to 0.
> > > >
> > > > > -----Original Message-----
> > > > > From: Madalin-cristian Bucur [mailto:madalin.bucur@nxp.com]
> > > > > Sent: Monday, October 30, 2017 1:08 PM
> > > > > To: yuan linyu; netdev@vger.kernel.org
> > > > > Cc: David S . Miller; Yuan, Linyu (NSB - CN/Shanghai)
> > > > > Subject: RE: [PATCH net-next] net: dpaa: remove init which already
> > done
> > > > in
> > > > > per-cpu allocation
> > > > >
> > > > > Hi Yuan,
> > > > >
> > > > > Can you please give more details about this change you are
> > proposing?
> > > > >
> > > > > Regards,
> > > > > Madalin
> > > > >
> > > > > > -----Original Message-----
> > > > > > From: netdev-owner@vger.kernel.org
> > > > > [mailto:netdev-owner@vger.kernel.org]
> > > > > > On Behalf Of yuan linyu
> > > > > > Sent: Sunday, October 29, 2017 3:49 AM
> > > > > > To: netdev@vger.kernel.org
> > > > > > Cc: David S . Miller <davem@davemloft.net>; yuan linyu
> > > > > > <Linyu.Yuan@alcatel-sbell.com.cn>
> > > > > > Subject: [PATCH net-next] net: dpaa: remove init which already
> > done in
> > > > > > per-cpu allocation
> > > > > >
> > > > > > From: yuan linyu <Linyu.Yuan@alcatel-sbell.com.cn>
> > > > > >
> > > > > > Signed-off-by: yuan linyu <Linyu.Yuan@alcatel-sbell.com.cn>
> > > > > > ---
> > > > > > drivers/net/ethernet/freescale/dpaa/dpaa_eth.c | 4 ----
> > > > > > 1 file changed, 4 deletions(-)
> > > > > >
> > > > > > diff --git a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
> > > > > > b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
> > > > > > index a8d0be8..1ccc316 100644
> > > > > > --- a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
> > > > > > +++ b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
> > > > > > @@ -2814,10 +2814,6 @@ static int dpaa_eth_probe(struct
> > > > > platform_device
> > > > > > *pdev)
> > > > > > err = -ENOMEM;
> > > > > > goto free_dpaa_fqs;
> > > > > > }
> > > > > > - for_each_possible_cpu(i) {
> > > > > > - percpu_priv = per_cpu_ptr(priv->percpu_priv, i);
> > > > > > - memset(percpu_priv, 0, sizeof(*percpu_priv));
> > > > > > - }
> > > > > >
> > > > > > priv->num_tc = 1;
> > > > > > netif_set_real_num_tx_queues(net_dev, priv->num_tc *
> > > > > > DPAA_TC_TXQ_NUM);
> > > > > > --
> > > > > > 2.7.4
> > > > > >
^ permalink raw reply [flat|nested] 10+ messages in thread
* RE: [PATCH net-next] net: dpaa: remove init which already done in per-cpu allocation
2017-10-30 6:15 ` Yuan, Linyu (NSB - CN/Shanghai)
@ 2017-10-30 7:13 ` Madalin-cristian Bucur
2017-10-30 7:17 ` Madalin-cristian Bucur
0 siblings, 1 reply; 10+ messages in thread
From: Madalin-cristian Bucur @ 2017-10-30 7:13 UTC (permalink / raw)
To: Yuan, Linyu (NSB - CN/Shanghai), yuan linyu, netdev, gregkh
Cc: David S . Miller
+Eric
> -----Original Message-----
> From: Yuan, Linyu (NSB - CN/Shanghai) [mailto:linyu.yuan@nokia-sbell.com]
>
> I just saw below accepted commit, it said "per cpu allocations are already
> zeroed, no need to clear them again."
>
> https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git/commit/?id=bfd8e5a407133e58a92a38ccf3d0ba6db81f22d8
>
> I will not touch memory sub-system, so I will not change this function
> description.
>
Your particular change removes redundancy, it's fine. Having the memset documented
somewhere would prevent similar redundancy from being added in the future.
> > -----Original Message-----
> > From: Madalin-cristian Bucur [mailto:madalin.bucur@nxp.com]
> > Sent: Monday, October 30, 2017 1:56 PM
> > To: Yuan, Linyu (NSB - CN/Shanghai); yuan linyu; netdev@vger.kernel.org;
> > gregkh@linuxfoundation.org
> > Cc: David S . Miller
> > Subject: RE: [PATCH net-next] net: dpaa: remove init which already done
> in
> > per-cpu allocation
> >
> > Also here:
> >
> >
> > http://elixir.free-electrons.com/linux/latest/source/mm/percpu.c#L717
> >
> > Should the fact that the memory is zeroed be included in the function
> > description?
> >
> > /**
> > * pcpu_alloc - the percpu allocator
> > * @size: size of area to allocate in bytes
> > * @align: alignment of area (max PAGE_SIZE)
> > * @reserved: allocate from the reserved chunk if available
> > * @gfp: allocation flags
> > *
> > * Allocate percpu area of @size bytes aligned at @align. If @gfp
> doesn't
> > * contain %GFP_KERNEL, the allocation is atomic.
> > *
> > * RETURNS:
> > * Percpu pointer to the allocated area on success, NULL on failure.
> > */
> >
> > Now it seems to be an implementation detail rather than a guarantee.
> >
> > Looking at Documentation/driver-model/devres.txt, the memset is not
> > mentioned there either.
> >
> > > -----Original Message-----
> > > From: Yuan, Linyu (NSB - CN/Shanghai) [mailto:linyu.yuan@nokia-
> sbell.com]
> > > Sent: Monday, October 30, 2017 7:21 AM
> > > To: Madalin-cristian Bucur <madalin.bucur@nxp.com>; yuan linyu
> > > <cugyly@163.com>; netdev@vger.kernel.org
> > > Cc: David S . Miller <davem@davemloft.net>
> > > Subject: RE: [PATCH net-next] net: dpaa: remove init which already
> > > done in per-cpu allocation
> > >
> > > http://elixir.free-electrons.com/linux/latest/source/mm/percpu.c#L1018
> > >
> > > > -----Original Message-----
> > > > From: Madalin-cristian Bucur [mailto:madalin.bucur@nxp.com]
> > > > Sent: Monday, October 30, 2017 1:15 PM
> > > > To: Yuan, Linyu (NSB - CN/Shanghai); yuan linyu;
> netdev@vger.kernel.org
> > > > Cc: David S . Miller
> > > > Subject: RE: [PATCH net-next] net: dpaa: remove init which already
> > > > done in per-cpu allocation
> > > >
> > > > Is the memset part documented?
> > > > Can you point to the specific comment & code that does it?
> > > >
> > > > Thanks
> > > >
> > > > > -----Original Message-----
> > > > > From: Yuan, Linyu (NSB - CN/Shanghai) [mailto:linyu.yuan@nokia-
> > > sbell.com]
> > > > > Sent: Monday, October 30, 2017 7:12 AM
> > > > > To: Madalin-cristian Bucur <madalin.bucur@nxp.com>; yuan linyu
> > > > > <cugyly@163.com>; netdev@vger.kernel.org
> > > > > Cc: David S . Miller <davem@davemloft.net>
> > > > > Subject: RE: [PATCH net-next] net: dpaa: remove init which already
> > > done in
> > > > > per-cpu allocation
> > > > >
> > > > > Hi,
> > > > >
> > > > > devm_alloc_percpu() will allocate per-cpu memory and memset
> allocated
> > > > > block content to 0.
> > > > >
> > > > > > -----Original Message-----
> > > > > > From: Madalin-cristian Bucur [mailto:madalin.bucur@nxp.com]
> > > > > > Sent: Monday, October 30, 2017 1:08 PM
> > > > > > To: yuan linyu; netdev@vger.kernel.org
> > > > > > Cc: David S . Miller; Yuan, Linyu (NSB - CN/Shanghai)
> > > > > > Subject: RE: [PATCH net-next] net: dpaa: remove init which
> > > > > > already done in per-cpu allocation
> > > > > >
> > > > > > Hi Yuan,
> > > > > >
> > > > > > Can you please give more details about this change you are
> > > proposing?
> > > > > >
> > > > > > Regards,
> > > > > > Madalin
> > > > > >
> > > > > > > -----Original Message-----
> > > > > > > From: netdev-owner@vger.kernel.org
> > > > > > [mailto:netdev-owner@vger.kernel.org]
> > > > > > > On Behalf Of yuan linyu
> > > > > > > Sent: Sunday, October 29, 2017 3:49 AM
> > > > > > > To: netdev@vger.kernel.org
> > > > > > > Cc: David S . Miller <davem@davemloft.net>; yuan linyu
> > > > > > > <Linyu.Yuan@alcatel-sbell.com.cn>
> > > > > > > Subject: [PATCH net-next] net: dpaa: remove init which already
> > > done in
> > > > > > > per-cpu allocation
> > > > > > >
> > > > > > > From: yuan linyu <Linyu.Yuan@alcatel-sbell.com.cn>
> > > > > > >
> > > > > > > Signed-off-by: yuan linyu <Linyu.Yuan@alcatel-sbell.com.cn>
> > > > > > > ---
> > > > > > > drivers/net/ethernet/freescale/dpaa/dpaa_eth.c | 4 ----
> > > > > > > 1 file changed, 4 deletions(-)
> > > > > > >
> > > > > > > diff --git a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
> > > > > > > b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
> > > > > > > index a8d0be8..1ccc316 100644
> > > > > > > --- a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
> > > > > > > +++ b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
> > > > > > > @@ -2814,10 +2814,6 @@ static int dpaa_eth_probe(struct
> > > > > > platform_device
> > > > > > > *pdev)
> > > > > > > err = -ENOMEM;
> > > > > > > goto free_dpaa_fqs;
> > > > > > > }
> > > > > > > - for_each_possible_cpu(i) {
> > > > > > > - percpu_priv = per_cpu_ptr(priv->percpu_priv, i);
> > > > > > > - memset(percpu_priv, 0, sizeof(*percpu_priv));
> > > > > > > - }
> > > > > > >
> > > > > > > priv->num_tc = 1;
> > > > > > > netif_set_real_num_tx_queues(net_dev, priv->num_tc *
> > > > > > > DPAA_TC_TXQ_NUM);
> > > > > > > --
> > > > > > > 2.7.4
> > > > > > >
^ permalink raw reply [flat|nested] 10+ messages in thread
* RE: [PATCH net-next] net: dpaa: remove init which already done in per-cpu allocation
2017-10-30 7:13 ` Madalin-cristian Bucur
@ 2017-10-30 7:17 ` Madalin-cristian Bucur
0 siblings, 0 replies; 10+ messages in thread
From: Madalin-cristian Bucur @ 2017-10-30 7:17 UTC (permalink / raw)
To: Madalin-cristian Bucur, Yuan, Linyu (NSB - CN/Shanghai),
yuan linyu, netdev, gregkh, edumazet
Cc: David S . Miller
> +Eric
>
> > -----Original Message-----
> > From: Yuan, Linyu (NSB - CN/Shanghai) [mailto:linyu.yuan@nokia-
> sbell.com]
> >
> > I just saw below accepted commit, it said "per cpu allocations are
> already
> > zeroed, no need to clear them again."
> >
> >
> https://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgit.ker
> nel.org%2Fpub%2Fscm%2Flinux%2Fkernel%2Fgit%2Fdavem%2Fnet-
> next.git%2Fcommit%2F%3Fid%3Dbfd8e5a407133e58a92a38ccf3d0ba6db81f22d8&data=
> 02%7C01%7Cmadalin.bucur%40nxp.com%7C4116c18371684740c41a08d51f65c6e9%7C686
> ea1d3bc2b4c6fa92cd99c5c301635%7C0%7C0%7C636449444348895856&sdata=PBvP4J0ch
> 8o%2Bvif3C8D77dVxGW4vjUlCYwJzJcIzhFk%3D&reserved=0
> >
> > I will not touch memory sub-system, so I will not change this function
> > description.
> >
>
> Your particular change removes redundancy, it's fine. Having the memset
> documented
> somewhere would prevent similar redundancy from being added in the future.
>
> > > -----Original Message-----
> > > From: Madalin-cristian Bucur [mailto:madalin.bucur@nxp.com]
> > > Sent: Monday, October 30, 2017 1:56 PM
> > > To: Yuan, Linyu (NSB - CN/Shanghai); yuan linyu;
> netdev@vger.kernel.org;
> > > gregkh@linuxfoundation.org
> > > Cc: David S . Miller
> > > Subject: RE: [PATCH net-next] net: dpaa: remove init which already
> done
> > in
> > > per-cpu allocation
> > >
> > > Also here:
> > >
> > >
> > >
> https://emea01.safelinks.protection.outlook.com/?url=http%3A%2F%2Felixir.f
> ree-
> electrons.com%2Flinux%2Flatest%2Fsource%2Fmm%2Fpercpu.c%23L717&data=02%7C0
> 1%7Cmadalin.bucur%40nxp.com%7C4116c18371684740c41a08d51f65c6e9%7C686ea1d3b
> c2b4c6fa92cd99c5c301635%7C0%7C0%7C636449444348895856&sdata=G9AEcoAPE7yWH%2
> FHi56DP3zns8LaIixJ4xkuQCTJDI5E%3D&reserved=0
> > >
> > > Should the fact that the memory is zeroed be included in the function
> > > description?
> > >
> > > /**
> > > * pcpu_alloc - the percpu allocator
> > > * @size: size of area to allocate in bytes
> > > * @align: alignment of area (max PAGE_SIZE)
> > > * @reserved: allocate from the reserved chunk if available
> > > * @gfp: allocation flags
> > > *
> > > * Allocate percpu area of @size bytes aligned at @align. If @gfp
> > doesn't
> > > * contain %GFP_KERNEL, the allocation is atomic.
> > > *
> > > * RETURNS:
> > > * Percpu pointer to the allocated area on success, NULL on failure.
> > > */
> > >
> > > Now it seems to be an implementation detail rather than a guarantee.
> > >
> > > Looking at Documentation/driver-model/devres.txt, the memset is not
> > > mentioned there either.
> > >
> > > > -----Original Message-----
> > > > From: Yuan, Linyu (NSB - CN/Shanghai) [mailto:linyu.yuan@nokia-
> > sbell.com]
> > > > Sent: Monday, October 30, 2017 7:21 AM
> > > > To: Madalin-cristian Bucur <madalin.bucur@nxp.com>; yuan linyu
> > > > <cugyly@163.com>; netdev@vger.kernel.org
> > > > Cc: David S . Miller <davem@davemloft.net>
> > > > Subject: RE: [PATCH net-next] net: dpaa: remove init which already
> > > > done in per-cpu allocation
> > > >
> > > >
> https://emea01.safelinks.protection.outlook.com/?url=http%3A%2F%2Felixir.f
> ree-
> electrons.com%2Flinux%2Flatest%2Fsource%2Fmm%2Fpercpu.c%23L1018&data=02%7C
> 01%7Cmadalin.bucur%40nxp.com%7C4116c18371684740c41a08d51f65c6e9%7C686ea1d3
> bc2b4c6fa92cd99c5c301635%7C0%7C0%7C636449444348895856&sdata=%2FOCOMao4jJti
> ptOqUUXBbZMt5TNRXdFfyrqa1zIekAI%3D&reserved=0
> > > >
> > > > > -----Original Message-----
> > > > > From: Madalin-cristian Bucur [mailto:madalin.bucur@nxp.com]
> > > > > Sent: Monday, October 30, 2017 1:15 PM
> > > > > To: Yuan, Linyu (NSB - CN/Shanghai); yuan linyu;
> > netdev@vger.kernel.org
> > > > > Cc: David S . Miller
> > > > > Subject: RE: [PATCH net-next] net: dpaa: remove init which already
> > > > > done in per-cpu allocation
> > > > >
> > > > > Is the memset part documented?
> > > > > Can you point to the specific comment & code that does it?
> > > > >
> > > > > Thanks
> > > > >
> > > > > > -----Original Message-----
> > > > > > From: Yuan, Linyu (NSB - CN/Shanghai) [mailto:linyu.yuan@nokia-
> > > > sbell.com]
> > > > > > Sent: Monday, October 30, 2017 7:12 AM
> > > > > > To: Madalin-cristian Bucur <madalin.bucur@nxp.com>; yuan linyu
> > > > > > <cugyly@163.com>; netdev@vger.kernel.org
> > > > > > Cc: David S . Miller <davem@davemloft.net>
> > > > > > Subject: RE: [PATCH net-next] net: dpaa: remove init which
> already
> > > > done in
> > > > > > per-cpu allocation
> > > > > >
> > > > > > Hi,
> > > > > >
> > > > > > devm_alloc_percpu() will allocate per-cpu memory and memset
> > allocated
> > > > > > block content to 0.
> > > > > >
> > > > > > > -----Original Message-----
> > > > > > > From: Madalin-cristian Bucur [mailto:madalin.bucur@nxp.com]
> > > > > > > Sent: Monday, October 30, 2017 1:08 PM
> > > > > > > To: yuan linyu; netdev@vger.kernel.org
> > > > > > > Cc: David S . Miller; Yuan, Linyu (NSB - CN/Shanghai)
> > > > > > > Subject: RE: [PATCH net-next] net: dpaa: remove init which
> > > > > > > already done in per-cpu allocation
> > > > > > >
> > > > > > > Hi Yuan,
> > > > > > >
> > > > > > > Can you please give more details about this change you are
> > > > proposing?
> > > > > > >
> > > > > > > Regards,
> > > > > > > Madalin
> > > > > > >
> > > > > > > > -----Original Message-----
> > > > > > > > From: netdev-owner@vger.kernel.org
> > > > > > > [mailto:netdev-owner@vger.kernel.org]
> > > > > > > > On Behalf Of yuan linyu
> > > > > > > > Sent: Sunday, October 29, 2017 3:49 AM
> > > > > > > > To: netdev@vger.kernel.org
> > > > > > > > Cc: David S . Miller <davem@davemloft.net>; yuan linyu
> > > > > > > > <Linyu.Yuan@alcatel-sbell.com.cn>
> > > > > > > > Subject: [PATCH net-next] net: dpaa: remove init which
> already
> > > > done in
> > > > > > > > per-cpu allocation
> > > > > > > >
> > > > > > > > From: yuan linyu <Linyu.Yuan@alcatel-sbell.com.cn>
> > > > > > > >
> > > > > > > > Signed-off-by: yuan linyu <Linyu.Yuan@alcatel-sbell.com.cn>
> > > > > > > > ---
> > > > > > > > drivers/net/ethernet/freescale/dpaa/dpaa_eth.c | 4 ----
> > > > > > > > 1 file changed, 4 deletions(-)
> > > > > > > >
> > > > > > > > diff --git a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
> > > > > > > > b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
> > > > > > > > index a8d0be8..1ccc316 100644
> > > > > > > > --- a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
> > > > > > > > +++ b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
> > > > > > > > @@ -2814,10 +2814,6 @@ static int dpaa_eth_probe(struct
> > > > > > > platform_device
> > > > > > > > *pdev)
> > > > > > > > err = -ENOMEM;
> > > > > > > > goto free_dpaa_fqs;
> > > > > > > > }
> > > > > > > > - for_each_possible_cpu(i) {
> > > > > > > > - percpu_priv = per_cpu_ptr(priv->percpu_priv, i);
> > > > > > > > - memset(percpu_priv, 0, sizeof(*percpu_priv));
> > > > > > > > - }
> > > > > > > >
> > > > > > > > priv->num_tc = 1;
> > > > > > > > netif_set_real_num_tx_queues(net_dev, priv->num_tc *
> > > > > > > > DPAA_TC_TXQ_NUM);
> > > > > > > > --
> > > > > > > > 2.7.4
> > > > > > > >
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH net-next] net: dpaa: remove init which already done in per-cpu allocation
2017-10-29 1:48 [PATCH net-next] net: dpaa: remove init which already done in per-cpu allocation yuan linyu
2017-10-30 5:08 ` Madalin-cristian Bucur
@ 2017-11-01 3:09 ` David Miller
1 sibling, 0 replies; 10+ messages in thread
From: David Miller @ 2017-11-01 3:09 UTC (permalink / raw)
To: cugyly; +Cc: netdev, Linyu.Yuan
From: yuan linyu <cugyly@163.com>
Date: Sun, 29 Oct 2017 09:48:44 +0800
> From: yuan linyu <Linyu.Yuan@alcatel-sbell.com.cn>
>
> Signed-off-by: yuan linyu <Linyu.Yuan@alcatel-sbell.com.cn>
Please compile test your patches and watch for warnings:
drivers/net/ethernet/freescale/dpaa/dpaa_eth.c: In function ‘dpaa_eth_probe’:
drivers/net/ethernet/freescale/dpaa/dpaa_eth.c:2671:27: warning: unused variable ‘percpu_priv’ [-Wunused-variable]
struct dpaa_percpu_priv *percpu_priv;
^~~~~~~~~~~
drivers/net/ethernet/freescale/dpaa/dpaa_eth.c: In function ‘dpaa_open’:
drivers/net/ethernet/freescale/dpaa/dpaa_eth.c:2497:9: warning: ‘err’ may be used uninitialized in this function [-Wmaybe-uninitialized]
return err;
^~~
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2017-11-01 3:09 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-29 1:48 [PATCH net-next] net: dpaa: remove init which already done in per-cpu allocation yuan linyu
2017-10-30 5:08 ` Madalin-cristian Bucur
2017-10-30 5:12 ` Yuan, Linyu (NSB - CN/Shanghai)
2017-10-30 5:15 ` Madalin-cristian Bucur
2017-10-30 5:20 ` Yuan, Linyu (NSB - CN/Shanghai)
2017-10-30 5:56 ` Madalin-cristian Bucur
2017-10-30 6:15 ` Yuan, Linyu (NSB - CN/Shanghai)
2017-10-30 7:13 ` Madalin-cristian Bucur
2017-10-30 7:17 ` Madalin-cristian Bucur
2017-11-01 3:09 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).