* [PATCH] Improve Atheros ethernet driver not to do order 4 GFP_ATOMIC allocation
@ 2015-11-28 14:51 ` Pavel Machek
0 siblings, 0 replies; 51+ messages in thread
From: Pavel Machek @ 2015-11-28 14:51 UTC (permalink / raw)
To: Michal Hocko, davem, Andrew Morton
Cc: kernel list, jcliburn, chris.snook, netdev, Rafael J. Wysocki,
linux-mm, nic-devel, ronangeles, ebiederm
atl1c driver is doing order-4 allocation with GFP_ATOMIC
priority. That often breaks networking after resume. Switch to
GFP_KERNEL. Still not ideal, but should be significantly better.
Signed-off-by: Pavel Machek <pavel@ucw.cz>
diff --git a/drivers/net/ethernet/atheros/atl1c/atl1c_main.c b/drivers/net/ethernet/atheros/atl1c/atl1c_main.c
index 2795d6d..afb71e0 100644
--- a/drivers/net/ethernet/atheros/atl1c/atl1c_main.c
+++ b/drivers/net/ethernet/atheros/atl1c/atl1c_main.c
@@ -1016,10 +1016,10 @@ static int atl1c_setup_ring_resources(struct atl1c_adapter *adapter)
sizeof(struct atl1c_recv_ret_status) * rx_desc_count +
8 * 4;
- ring_header->desc = pci_alloc_consistent(pdev, ring_header->size,
- &ring_header->dma);
+ ring_header->desc = dma_alloc_coherent(&pdev->dev, ring_header->size,
+ &ring_header->dma, GFP_KERNEL);
if (unlikely(!ring_header->desc)) {
- dev_err(&pdev->dev, "pci_alloc_consistend failed\n");
+ dev_err(&pdev->dev, "could not get memmory for DMA buffer\n");
goto err_nomem;
}
memset(ring_header->desc, 0, ring_header->size);
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply related [flat|nested] 51+ messages in thread
* Re: [PATCH] Improve Atheros ethernet driver not to do order 4 GFP_ATOMIC allocation
2015-11-28 14:51 ` Pavel Machek
@ 2015-11-29 21:58 ` Sergei Shtylyov
-1 siblings, 0 replies; 51+ messages in thread
From: Sergei Shtylyov @ 2015-11-29 21:58 UTC (permalink / raw)
To: Pavel Machek, Michal Hocko, davem, Andrew Morton
Cc: kernel list, jcliburn, chris.snook, netdev, Rafael J. Wysocki,
linux-mm, nic-devel, ronangeles, ebiederm
Hello.
On 11/28/2015 5:51 PM, Pavel Machek wrote:
> atl1c driver is doing order-4 allocation with GFP_ATOMIC
> priority. That often breaks networking after resume. Switch to
> GFP_KERNEL. Still not ideal, but should be significantly better.
>
> Signed-off-by: Pavel Machek <pavel@ucw.cz>
>
> diff --git a/drivers/net/ethernet/atheros/atl1c/atl1c_main.c b/drivers/net/ethernet/atheros/atl1c/atl1c_main.c
> index 2795d6d..afb71e0 100644
> --- a/drivers/net/ethernet/atheros/atl1c/atl1c_main.c
> +++ b/drivers/net/ethernet/atheros/atl1c/atl1c_main.c
> @@ -1016,10 +1016,10 @@ static int atl1c_setup_ring_resources(struct atl1c_adapter *adapter)
> sizeof(struct atl1c_recv_ret_status) * rx_desc_count +
> 8 * 4;
>
> - ring_header->desc = pci_alloc_consistent(pdev, ring_header->size,
> - &ring_header->dma);
> + ring_header->desc = dma_alloc_coherent(&pdev->dev, ring_header->size,
> + &ring_header->dma, GFP_KERNEL);
> if (unlikely(!ring_header->desc)) {
> - dev_err(&pdev->dev, "pci_alloc_consistend failed\n");
> + dev_err(&pdev->dev, "could not get memmory for DMA buffer\n");
s/memmory/memory/.
[...]
MBR, Sergei
^ permalink raw reply [flat|nested] 51+ messages in thread
* Re: [PATCH] Improve Atheros ethernet driver not to do order 4 GFP_ATOMIC allocation
@ 2015-11-29 21:58 ` Sergei Shtylyov
0 siblings, 0 replies; 51+ messages in thread
From: Sergei Shtylyov @ 2015-11-29 21:58 UTC (permalink / raw)
To: Pavel Machek, Michal Hocko, davem, Andrew Morton
Cc: kernel list, jcliburn, chris.snook, netdev, Rafael J. Wysocki,
linux-mm, nic-devel, ronangeles, ebiederm
Hello.
On 11/28/2015 5:51 PM, Pavel Machek wrote:
> atl1c driver is doing order-4 allocation with GFP_ATOMIC
> priority. That often breaks networking after resume. Switch to
> GFP_KERNEL. Still not ideal, but should be significantly better.
>
> Signed-off-by: Pavel Machek <pavel@ucw.cz>
>
> diff --git a/drivers/net/ethernet/atheros/atl1c/atl1c_main.c b/drivers/net/ethernet/atheros/atl1c/atl1c_main.c
> index 2795d6d..afb71e0 100644
> --- a/drivers/net/ethernet/atheros/atl1c/atl1c_main.c
> +++ b/drivers/net/ethernet/atheros/atl1c/atl1c_main.c
> @@ -1016,10 +1016,10 @@ static int atl1c_setup_ring_resources(struct atl1c_adapter *adapter)
> sizeof(struct atl1c_recv_ret_status) * rx_desc_count +
> 8 * 4;
>
> - ring_header->desc = pci_alloc_consistent(pdev, ring_header->size,
> - &ring_header->dma);
> + ring_header->desc = dma_alloc_coherent(&pdev->dev, ring_header->size,
> + &ring_header->dma, GFP_KERNEL);
> if (unlikely(!ring_header->desc)) {
> - dev_err(&pdev->dev, "pci_alloc_consistend failed\n");
> + dev_err(&pdev->dev, "could not get memmory for DMA buffer\n");
s/memmory/memory/.
[...]
MBR, Sergei
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 51+ messages in thread
* Re: [PATCH] Improve Atheros ethernet driver not to do order 4 GFP_ATOMIC allocation
2015-11-28 14:51 ` Pavel Machek
@ 2015-11-30 13:21 ` Michal Hocko
-1 siblings, 0 replies; 51+ messages in thread
From: Michal Hocko @ 2015-11-30 13:21 UTC (permalink / raw)
To: Pavel Machek
Cc: davem, Andrew Morton, kernel list, jcliburn, chris.snook, netdev,
Rafael J. Wysocki, linux-mm, nic-devel, ronangeles, ebiederm
On Sat 28-11-15 15:51:13, Pavel Machek wrote:
>
> atl1c driver is doing order-4 allocation with GFP_ATOMIC
> priority. That often breaks networking after resume. Switch to
> GFP_KERNEL. Still not ideal, but should be significantly better.
It is not clear why GFP_KERNEL can replace GFP_ATOMIC safely neither
from the changelog nor from the patch context. It is correct here
because atl1c_setup_ring_resources is a sleepable context (otherwise
tpd_ring->buffer_info = kzalloc(size, GFP_KERNEL) would be incorrect
already) but a short note wouldn't kill us, would it?
> Signed-off-by: Pavel Machek <pavel@ucw.cz>
Anyway
Reviewed-by: Michal Hocko <mhocko@suse.com>
>
> diff --git a/drivers/net/ethernet/atheros/atl1c/atl1c_main.c b/drivers/net/ethernet/atheros/atl1c/atl1c_main.c
> index 2795d6d..afb71e0 100644
> --- a/drivers/net/ethernet/atheros/atl1c/atl1c_main.c
> +++ b/drivers/net/ethernet/atheros/atl1c/atl1c_main.c
> @@ -1016,10 +1016,10 @@ static int atl1c_setup_ring_resources(struct atl1c_adapter *adapter)
> sizeof(struct atl1c_recv_ret_status) * rx_desc_count +
> 8 * 4;
>
> - ring_header->desc = pci_alloc_consistent(pdev, ring_header->size,
> - &ring_header->dma);
> + ring_header->desc = dma_alloc_coherent(&pdev->dev, ring_header->size,
> + &ring_header->dma, GFP_KERNEL);
> if (unlikely(!ring_header->desc)) {
> - dev_err(&pdev->dev, "pci_alloc_consistend failed\n");
> + dev_err(&pdev->dev, "could not get memmory for DMA buffer\n");
> goto err_nomem;
> }
> memset(ring_header->desc, 0, ring_header->size);
>
> --
> (english) http://www.livejournal.com/~pavelmachek
> (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
--
Michal Hocko
SUSE Labs
^ permalink raw reply [flat|nested] 51+ messages in thread
* Re: [PATCH] Improve Atheros ethernet driver not to do order 4 GFP_ATOMIC allocation
@ 2015-11-30 13:21 ` Michal Hocko
0 siblings, 0 replies; 51+ messages in thread
From: Michal Hocko @ 2015-11-30 13:21 UTC (permalink / raw)
To: Pavel Machek
Cc: davem, Andrew Morton, kernel list, jcliburn, chris.snook, netdev,
Rafael J. Wysocki, linux-mm, nic-devel, ronangeles, ebiederm
On Sat 28-11-15 15:51:13, Pavel Machek wrote:
>
> atl1c driver is doing order-4 allocation with GFP_ATOMIC
> priority. That often breaks networking after resume. Switch to
> GFP_KERNEL. Still not ideal, but should be significantly better.
It is not clear why GFP_KERNEL can replace GFP_ATOMIC safely neither
from the changelog nor from the patch context. It is correct here
because atl1c_setup_ring_resources is a sleepable context (otherwise
tpd_ring->buffer_info = kzalloc(size, GFP_KERNEL) would be incorrect
already) but a short note wouldn't kill us, would it?
> Signed-off-by: Pavel Machek <pavel@ucw.cz>
Anyway
Reviewed-by: Michal Hocko <mhocko@suse.com>
>
> diff --git a/drivers/net/ethernet/atheros/atl1c/atl1c_main.c b/drivers/net/ethernet/atheros/atl1c/atl1c_main.c
> index 2795d6d..afb71e0 100644
> --- a/drivers/net/ethernet/atheros/atl1c/atl1c_main.c
> +++ b/drivers/net/ethernet/atheros/atl1c/atl1c_main.c
> @@ -1016,10 +1016,10 @@ static int atl1c_setup_ring_resources(struct atl1c_adapter *adapter)
> sizeof(struct atl1c_recv_ret_status) * rx_desc_count +
> 8 * 4;
>
> - ring_header->desc = pci_alloc_consistent(pdev, ring_header->size,
> - &ring_header->dma);
> + ring_header->desc = dma_alloc_coherent(&pdev->dev, ring_header->size,
> + &ring_header->dma, GFP_KERNEL);
> if (unlikely(!ring_header->desc)) {
> - dev_err(&pdev->dev, "pci_alloc_consistend failed\n");
> + dev_err(&pdev->dev, "could not get memmory for DMA buffer\n");
> goto err_nomem;
> }
> memset(ring_header->desc, 0, ring_header->size);
>
> --
> (english) http://www.livejournal.com/~pavelmachek
> (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
--
Michal Hocko
SUSE Labs
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 51+ messages in thread
* Re: [PATCH] Improve Atheros ethernet driver not to do order 4 GFP_ATOMIC allocation
2015-11-30 13:21 ` Michal Hocko
@ 2015-12-01 20:35 ` David Miller
-1 siblings, 0 replies; 51+ messages in thread
From: David Miller @ 2015-12-01 20:35 UTC (permalink / raw)
To: mhocko
Cc: pavel, akpm, linux-kernel, jcliburn, chris.snook, netdev, rjw,
linux-mm, nic-devel, ronangeles, ebiederm
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: Text/Plain; charset=utf-8, Size: 700 bytes --]
From: Michal Hocko <mhocko@kernel.org>
Date: Mon, 30 Nov 2015 14:21:29 +0100
> On Sat 28-11-15 15:51:13, Pavel Machek wrote:
>>
>> atl1c driver is doing order-4 allocation with GFP_ATOMIC
>> priority. That often breaks networking after resume. Switch to
>> GFP_KERNEL. Still not ideal, but should be significantly better.
>
> It is not clear why GFP_KERNEL can replace GFP_ATOMIC safely neither
> from the changelog nor from the patch context.
Earlier in the function we do a GFP_KERNEL kmalloc so:
¯\_(ã)_/¯
It should be fine.
ÿôèº{.nÇ+·®+%Ëÿ±éݶ\x17¥wÿº{.nÇ+·¥{±þG«éÿ{ayº\x1dÊÚë,j\a¢f£¢·hïêÿêçz_è®\x03(éÝ¢j"ú\x1a¶^[m§ÿÿ¾\a«þG«éÿ¢¸?¨èÚ&£ø§~á¶iOæ¬z·vØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢¸?I¥
^ permalink raw reply [flat|nested] 51+ messages in thread
* Re: [PATCH] Improve Atheros ethernet driver not to do order 4 GFP_ATOMIC allocation
@ 2015-12-01 20:35 ` David Miller
0 siblings, 0 replies; 51+ messages in thread
From: David Miller @ 2015-12-01 20:35 UTC (permalink / raw)
To: mhocko
Cc: pavel, akpm, linux-kernel, jcliburn, chris.snook, netdev, rjw,
linux-mm, nic-devel, ronangeles, ebiederm
From: Michal Hocko <mhocko@kernel.org>
Date: Mon, 30 Nov 2015 14:21:29 +0100
> On Sat 28-11-15 15:51:13, Pavel Machek wrote:
>>
>> atl1c driver is doing order-4 allocation with GFP_ATOMIC
>> priority. That often breaks networking after resume. Switch to
>> GFP_KERNEL. Still not ideal, but should be significantly better.
>
> It is not clear why GFP_KERNEL can replace GFP_ATOMIC safely neither
> from the changelog nor from the patch context.
Earlier in the function we do a GFP_KERNEL kmalloc so:
¯\_(ツ)_/¯
It should be fine.
^ permalink raw reply [flat|nested] 51+ messages in thread
* Re: [PATCH] Improve Atheros ethernet driver not to do order 4 GFP_ATOMIC allocation
2015-12-01 20:35 ` David Miller
(?)
@ 2015-12-02 22:43 ` Chris Snook
2015-12-03 7:49 ` Pavel Machek
2015-12-03 8:16 ` Michal Hocko
-1 siblings, 2 replies; 51+ messages in thread
From: Chris Snook @ 2015-12-02 22:43 UTC (permalink / raw)
To: David Miller, mhocko
Cc: pavel, akpm, linux-kernel, jcliburn, netdev, rjw, linux-mm,
nic-devel, ronangeles, ebiederm
[-- Attachment #1: Type: text/plain, Size: 1141 bytes --]
On Tue, Dec 1, 2015 at 12:35 PM David Miller <davem@davemloft.net> wrote:
> From: Michal Hocko <mhocko@kernel.org>
> Date: Mon, 30 Nov 2015 14:21:29 +0100
>
> > On Sat 28-11-15 15:51:13, Pavel Machek wrote:
> >>
> >> atl1c driver is doing order-4 allocation with GFP_ATOMIC
> >> priority. That often breaks networking after resume. Switch to
> >> GFP_KERNEL. Still not ideal, but should be significantly better.
> >
> > It is not clear why GFP_KERNEL can replace GFP_ATOMIC safely neither
> > from the changelog nor from the patch context.
>
> Earlier in the function we do a GFP_KERNEL kmalloc so:
>
> ¯\_(ツ)_/¯
>
> It should be fine.
>
AFAICT, the people who benefit from GFP_ATOMIC are the people running all
their storage over NFS/iSCSI who are suspending their machines while
they're so busy they don't have any clean order 4 pagecache to drop, and
want the machine to panic rather than hang. The people who benefit from
GFP_KERNEL are the people who use their laptop for a while, put it to
sleep, and then wake it up again. I think the latter is the use case we
should be optimizing for.
-- Chris
[-- Attachment #2: Type: text/html, Size: 1552 bytes --]
^ permalink raw reply [flat|nested] 51+ messages in thread
* Re: [PATCH] Improve Atheros ethernet driver not to do order 4 GFP_ATOMIC allocation
2015-12-02 22:43 ` Chris Snook
2015-12-03 7:49 ` Pavel Machek
@ 2015-12-03 7:49 ` Pavel Machek
1 sibling, 0 replies; 51+ messages in thread
From: Pavel Machek @ 2015-12-03 7:49 UTC (permalink / raw)
To: Chris Snook
Cc: David Miller, mhocko, akpm, linux-kernel, jcliburn, netdev, rjw,
linux-mm, nic-devel, ronangeles, ebiederm
On Wed 2015-12-02 22:43:31, Chris Snook wrote:
> On Tue, Dec 1, 2015 at 12:35 PM David Miller <davem@davemloft.net> wrote:
>
> > From: Michal Hocko <mhocko@kernel.org>
> > Date: Mon, 30 Nov 2015 14:21:29 +0100
> >
> > > On Sat 28-11-15 15:51:13, Pavel Machek wrote:
> > >>
> > >> atl1c driver is doing order-4 allocation with GFP_ATOMIC
> > >> priority. That often breaks networking after resume. Switch to
> > >> GFP_KERNEL. Still not ideal, but should be significantly better.
> > >
> > > It is not clear why GFP_KERNEL can replace GFP_ATOMIC safely neither
> > > from the changelog nor from the patch context.
> >
> > Earlier in the function we do a GFP_KERNEL kmalloc so:
> >
> > ¯\_(ツ)_/¯
> >
> > It should be fine.
> >
>
> AFAICT, the people who benefit from GFP_ATOMIC are the people running all
> their storage over NFS/iSCSI who are suspending their machines while
> they're so busy they don't have any clean order 4 pagecache to drop, and
> want the machine to panic rather than hang. The people who benefit
>from
iSCSI on machine that suspends... is that a joke or complicated way of
saying that noone benefits? And code uses... both GFP_ATOMIC and
GFP_KERNEL so that both sides are equally unhappy? :-).
Do you want to test the patch, update the subject line and send it to
Davem, or should I do it?
Do you see a way to split the allocation? Not even order 4 GFP_KERNEL
allocation is a nice thing to do...
Pavel
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
^ permalink raw reply [flat|nested] 51+ messages in thread
* Re: [PATCH] Improve Atheros ethernet driver not to do order 4 GFP_ATOMIC allocation
@ 2015-12-03 7:49 ` Pavel Machek
0 siblings, 0 replies; 51+ messages in thread
From: Pavel Machek @ 2015-12-03 7:49 UTC (permalink / raw)
To: Chris Snook
Cc: David Miller, mhocko, akpm, linux-kernel, jcliburn, netdev, rjw,
linux-mm, nic-devel, ronangeles, ebiederm
On Wed 2015-12-02 22:43:31, Chris Snook wrote:
> On Tue, Dec 1, 2015 at 12:35 PM David Miller <davem@davemloft.net> wrote:
>
> > From: Michal Hocko <mhocko@kernel.org>
> > Date: Mon, 30 Nov 2015 14:21:29 +0100
> >
> > > On Sat 28-11-15 15:51:13, Pavel Machek wrote:
> > >>
> > >> atl1c driver is doing order-4 allocation with GFP_ATOMIC
> > >> priority. That often breaks networking after resume. Switch to
> > >> GFP_KERNEL. Still not ideal, but should be significantly better.
> > >
> > > It is not clear why GFP_KERNEL can replace GFP_ATOMIC safely neither
> > > from the changelog nor from the patch context.
> >
> > Earlier in the function we do a GFP_KERNEL kmalloc so:
> >
> > A?\_(a??)_/A?
> >
> > It should be fine.
> >
>
> AFAICT, the people who benefit from GFP_ATOMIC are the people running all
> their storage over NFS/iSCSI who are suspending their machines while
> they're so busy they don't have any clean order 4 pagecache to drop, and
> want the machine to panic rather than hang. The people who benefit
>from
iSCSI on machine that suspends... is that a joke or complicated way of
saying that noone benefits? And code uses... both GFP_ATOMIC and
GFP_KERNEL so that both sides are equally unhappy? :-).
Do you want to test the patch, update the subject line and send it to
Davem, or should I do it?
Do you see a way to split the allocation? Not even order 4 GFP_KERNEL
allocation is a nice thing to do...
Pavel
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 51+ messages in thread
* Re: [PATCH] Improve Atheros ethernet driver not to do order 4 GFP_ATOMIC allocation
@ 2015-12-03 7:49 ` Pavel Machek
0 siblings, 0 replies; 51+ messages in thread
From: Pavel Machek @ 2015-12-03 7:49 UTC (permalink / raw)
To: Chris Snook
Cc: David Miller, mhocko, akpm, linux-kernel, jcliburn, netdev, rjw,
linux-mm, nic-devel, ronangeles, ebiederm
On Wed 2015-12-02 22:43:31, Chris Snook wrote:
> On Tue, Dec 1, 2015 at 12:35 PM David Miller <davem@davemloft.net> wrote:
>
> > From: Michal Hocko <mhocko@kernel.org>
> > Date: Mon, 30 Nov 2015 14:21:29 +0100
> >
> > > On Sat 28-11-15 15:51:13, Pavel Machek wrote:
> > >>
> > >> atl1c driver is doing order-4 allocation with GFP_ATOMIC
> > >> priority. That often breaks networking after resume. Switch to
> > >> GFP_KERNEL. Still not ideal, but should be significantly better.
> > >
> > > It is not clear why GFP_KERNEL can replace GFP_ATOMIC safely neither
> > > from the changelog nor from the patch context.
> >
> > Earlier in the function we do a GFP_KERNEL kmalloc so:
> >
> > ¯\_(ツ)_/¯
> >
> > It should be fine.
> >
>
> AFAICT, the people who benefit from GFP_ATOMIC are the people running all
> their storage over NFS/iSCSI who are suspending their machines while
> they're so busy they don't have any clean order 4 pagecache to drop, and
> want the machine to panic rather than hang. The people who benefit
>from
iSCSI on machine that suspends... is that a joke or complicated way of
saying that noone benefits? And code uses... both GFP_ATOMIC and
GFP_KERNEL so that both sides are equally unhappy? :-).
Do you want to test the patch, update the subject line and send it to
Davem, or should I do it?
Do you see a way to split the allocation? Not even order 4 GFP_KERNEL
allocation is a nice thing to do...
Pavel
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 51+ messages in thread
* Re: [PATCH] Improve Atheros ethernet driver not to do order 4 GFP_ATOMIC allocation
2015-12-02 22:43 ` Chris Snook
2015-12-03 7:49 ` Pavel Machek
@ 2015-12-03 8:16 ` Michal Hocko
1 sibling, 0 replies; 51+ messages in thread
From: Michal Hocko @ 2015-12-03 8:16 UTC (permalink / raw)
To: Chris Snook
Cc: David Miller, pavel, akpm, linux-kernel, jcliburn, netdev, rjw,
linux-mm, nic-devel, ronangeles, ebiederm
On Wed 02-12-15 22:43:31, Chris Snook wrote:
> On Tue, Dec 1, 2015 at 12:35 PM David Miller <davem@davemloft.net> wrote:
>
> > From: Michal Hocko <mhocko@kernel.org>
> > Date: Mon, 30 Nov 2015 14:21:29 +0100
> >
> > > On Sat 28-11-15 15:51:13, Pavel Machek wrote:
> > >>
> > >> atl1c driver is doing order-4 allocation with GFP_ATOMIC
> > >> priority. That often breaks networking after resume. Switch to
> > >> GFP_KERNEL. Still not ideal, but should be significantly better.
> > >
> > > It is not clear why GFP_KERNEL can replace GFP_ATOMIC safely neither
> > > from the changelog nor from the patch context.
> >
> > Earlier in the function we do a GFP_KERNEL kmalloc so:
> >
> > ¯\_(ツ)_/¯
> >
> > It should be fine.
> >
>
> AFAICT, the people who benefit from GFP_ATOMIC are the people running all
> their storage over NFS/iSCSI who are suspending their machines while
> they're so busy they don't have any clean order 4 pagecache to drop, and
> want the machine to panic rather than hang.
Why would GFP_KERNEL order-4 allocation hang? It will fail if there are
not >=4 order pages available even after reclaim and/or compaction.
GFP_ATOMIC allocations should be used only when an access to memory
reserves is really required. If the allocation just doesn't want to
invoke direct reclaim then GFP_NOWAIT is a more suitable alternative.
--
Michal Hocko
SUSE Labs
^ permalink raw reply [flat|nested] 51+ messages in thread
* Re: [PATCH] Improve Atheros ethernet driver not to do order 4 GFP_ATOMIC allocation
@ 2015-12-03 8:16 ` Michal Hocko
0 siblings, 0 replies; 51+ messages in thread
From: Michal Hocko @ 2015-12-03 8:16 UTC (permalink / raw)
To: Chris Snook
Cc: David Miller, pavel, akpm, linux-kernel, jcliburn, netdev, rjw,
linux-mm, nic-devel, ronangeles, ebiederm
On Wed 02-12-15 22:43:31, Chris Snook wrote:
> On Tue, Dec 1, 2015 at 12:35 PM David Miller <davem@davemloft.net> wrote:
>
> > From: Michal Hocko <mhocko@kernel.org>
> > Date: Mon, 30 Nov 2015 14:21:29 +0100
> >
> > > On Sat 28-11-15 15:51:13, Pavel Machek wrote:
> > >>
> > >> atl1c driver is doing order-4 allocation with GFP_ATOMIC
> > >> priority. That often breaks networking after resume. Switch to
> > >> GFP_KERNEL. Still not ideal, but should be significantly better.
> > >
> > > It is not clear why GFP_KERNEL can replace GFP_ATOMIC safely neither
> > > from the changelog nor from the patch context.
> >
> > Earlier in the function we do a GFP_KERNEL kmalloc so:
> >
> > A?\_(a??)_/A?
> >
> > It should be fine.
> >
>
> AFAICT, the people who benefit from GFP_ATOMIC are the people running all
> their storage over NFS/iSCSI who are suspending their machines while
> they're so busy they don't have any clean order 4 pagecache to drop, and
> want the machine to panic rather than hang.
Why would GFP_KERNEL order-4 allocation hang? It will fail if there are
not >=4 order pages available even after reclaim and/or compaction.
GFP_ATOMIC allocations should be used only when an access to memory
reserves is really required. If the allocation just doesn't want to
invoke direct reclaim then GFP_NOWAIT is a more suitable alternative.
--
Michal Hocko
SUSE Labs
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 51+ messages in thread
* Re: [PATCH] Improve Atheros ethernet driver not to do order 4 GFP_ATOMIC allocation
@ 2015-12-03 8:16 ` Michal Hocko
0 siblings, 0 replies; 51+ messages in thread
From: Michal Hocko @ 2015-12-03 8:16 UTC (permalink / raw)
To: Chris Snook
Cc: David Miller, pavel, akpm, linux-kernel, jcliburn, netdev, rjw,
linux-mm, nic-devel, ronangeles, ebiederm
On Wed 02-12-15 22:43:31, Chris Snook wrote:
> On Tue, Dec 1, 2015 at 12:35 PM David Miller <davem@davemloft.net> wrote:
>
> > From: Michal Hocko <mhocko@kernel.org>
> > Date: Mon, 30 Nov 2015 14:21:29 +0100
> >
> > > On Sat 28-11-15 15:51:13, Pavel Machek wrote:
> > >>
> > >> atl1c driver is doing order-4 allocation with GFP_ATOMIC
> > >> priority. That often breaks networking after resume. Switch to
> > >> GFP_KERNEL. Still not ideal, but should be significantly better.
> > >
> > > It is not clear why GFP_KERNEL can replace GFP_ATOMIC safely neither
> > > from the changelog nor from the patch context.
> >
> > Earlier in the function we do a GFP_KERNEL kmalloc so:
> >
> > ¯\_(ツ)_/¯
> >
> > It should be fine.
> >
>
> AFAICT, the people who benefit from GFP_ATOMIC are the people running all
> their storage over NFS/iSCSI who are suspending their machines while
> they're so busy they don't have any clean order 4 pagecache to drop, and
> want the machine to panic rather than hang.
Why would GFP_KERNEL order-4 allocation hang? It will fail if there are
not >=4 order pages available even after reclaim and/or compaction.
GFP_ATOMIC allocations should be used only when an access to memory
reserves is really required. If the allocation just doesn't want to
invoke direct reclaim then GFP_NOWAIT is a more suitable alternative.
--
Michal Hocko
SUSE Labs
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 51+ messages in thread
* Re: [PATCH] Improve Atheros ethernet driver not to do order 4 GFP_ATOMIC allocation
2015-12-03 8:16 ` Michal Hocko
(?)
(?)
@ 2015-12-03 19:26 ` Chris Snook
-1 siblings, 0 replies; 51+ messages in thread
From: Chris Snook @ 2015-12-03 19:26 UTC (permalink / raw)
To: Michal Hocko
Cc: David Miller, pavel, akpm, linux-kernel, jcliburn, netdev, rjw,
linux-mm, nic-devel, ronangeles, ebiederm
[-- Attachment #1: Type: text/plain, Size: 1827 bytes --]
On Thu, Dec 3, 2015 at 12:16 AM Michal Hocko <mhocko@kernel.org> wrote:
> On Wed 02-12-15 22:43:31, Chris Snook wrote:
> > On Tue, Dec 1, 2015 at 12:35 PM David Miller <davem@davemloft.net>
> wrote:
> >
> > > From: Michal Hocko <mhocko@kernel.org>
> > > Date: Mon, 30 Nov 2015 14:21:29 +0100
> > >
> > > > On Sat 28-11-15 15:51:13, Pavel Machek wrote:
> > > >>
> > > >> atl1c driver is doing order-4 allocation with GFP_ATOMIC
> > > >> priority. That often breaks networking after resume. Switch to
> > > >> GFP_KERNEL. Still not ideal, but should be significantly better.
> > > >
> > > > It is not clear why GFP_KERNEL can replace GFP_ATOMIC safely neither
> > > > from the changelog nor from the patch context.
> > >
> > > Earlier in the function we do a GFP_KERNEL kmalloc so:
> > >
> > > ¯\_(ツ)_/¯
> > >
> > > It should be fine.
> > >
> >
> > AFAICT, the people who benefit from GFP_ATOMIC are the people running all
> > their storage over NFS/iSCSI who are suspending their machines while
> > they're so busy they don't have any clean order 4 pagecache to drop, and
> > want the machine to panic rather than hang.
>
> Why would GFP_KERNEL order-4 allocation hang? It will fail if there are
> not >=4 order pages available even after reclaim and/or compaction.
> GFP_ATOMIC allocations should be used only when an access to memory
> reserves is really required. If the allocation just doesn't want to
> invoke direct reclaim then GFP_NOWAIT is a more suitable alternative.
>
The *machine* may hang if you can't bring back the interface that's
required to access the storage. It's a ridiculous use case, as Pavel noted.
I only pointed it out to note that there exists a rationale for GFP_ATOMIC.
It just isn't nearly as good as the rationale for using GFP_KERNEL.
-- Chris
[-- Attachment #2: Type: text/html, Size: 2478 bytes --]
^ permalink raw reply [flat|nested] 51+ messages in thread
* Re: [PATCH] Improve Atheros ethernet driver not to do order 4 GFP_ATOMIC allocation
2015-11-28 14:51 ` Pavel Machek
(?)
@ 2015-11-30 17:58 ` Eric Dumazet
-1 siblings, 0 replies; 51+ messages in thread
From: Eric Dumazet @ 2015-11-30 17:58 UTC (permalink / raw)
To: Pavel Machek
Cc: Michal Hocko, davem, Andrew Morton, kernel list, jcliburn,
chris.snook, netdev, Rafael J. Wysocki, linux-mm, nic-devel,
ronangeles, ebiederm
On Sat, 2015-11-28 at 15:51 +0100, Pavel Machek wrote:
> atl1c driver is doing order-4 allocation with GFP_ATOMIC
> priority. That often breaks networking after resume. Switch to
> GFP_KERNEL. Still not ideal, but should be significantly better.
>
> Signed-off-by: Pavel Machek <pavel@ucw.cz>
>
> diff --git a/drivers/net/ethernet/atheros/atl1c/atl1c_main.c b/drivers/net/ethernet/atheros/atl1c/atl1c_main.c
> index 2795d6d..afb71e0 100644
> --- a/drivers/net/ethernet/atheros/atl1c/atl1c_main.c
> +++ b/drivers/net/ethernet/atheros/atl1c/atl1c_main.c
> @@ -1016,10 +1016,10 @@ static int atl1c_setup_ring_resources(struct atl1c_adapter *adapter)
> sizeof(struct atl1c_recv_ret_status) * rx_desc_count +
> 8 * 4;
>
> - ring_header->desc = pci_alloc_consistent(pdev, ring_header->size,
> - &ring_header->dma);
> + ring_header->desc = dma_alloc_coherent(&pdev->dev, ring_header->size,
> + &ring_header->dma, GFP_KERNEL);
> if (unlikely(!ring_header->desc)) {
> - dev_err(&pdev->dev, "pci_alloc_consistend failed\n");
> + dev_err(&pdev->dev, "could not get memmory for DMA buffer\n");
> goto err_nomem;
> }
> memset(ring_header->desc, 0, ring_header->size);
>
It seems there is a missed opportunity to get rid of the memset() here,
by adding __GFP_ZERO to the dma_alloc_coherent() GFP_KERNEL mask,
or simply using dma_zalloc_coherent()
^ permalink raw reply [flat|nested] 51+ messages in thread
* Re: [PATCH] Improve Atheros ethernet driver not to do order 4 GFP_ATOMIC allocation
@ 2015-11-30 17:58 ` Eric Dumazet
0 siblings, 0 replies; 51+ messages in thread
From: Eric Dumazet @ 2015-11-30 17:58 UTC (permalink / raw)
To: Pavel Machek
Cc: Michal Hocko, davem, Andrew Morton, kernel list, jcliburn,
chris.snook, netdev, Rafael J. Wysocki, linux-mm, nic-devel,
ronangeles, ebiederm
On Sat, 2015-11-28 at 15:51 +0100, Pavel Machek wrote:
> atl1c driver is doing order-4 allocation with GFP_ATOMIC
> priority. That often breaks networking after resume. Switch to
> GFP_KERNEL. Still not ideal, but should be significantly better.
>
> Signed-off-by: Pavel Machek <pavel@ucw.cz>
>
> diff --git a/drivers/net/ethernet/atheros/atl1c/atl1c_main.c b/drivers/net/ethernet/atheros/atl1c/atl1c_main.c
> index 2795d6d..afb71e0 100644
> --- a/drivers/net/ethernet/atheros/atl1c/atl1c_main.c
> +++ b/drivers/net/ethernet/atheros/atl1c/atl1c_main.c
> @@ -1016,10 +1016,10 @@ static int atl1c_setup_ring_resources(struct atl1c_adapter *adapter)
> sizeof(struct atl1c_recv_ret_status) * rx_desc_count +
> 8 * 4;
>
> - ring_header->desc = pci_alloc_consistent(pdev, ring_header->size,
> - &ring_header->dma);
> + ring_header->desc = dma_alloc_coherent(&pdev->dev, ring_header->size,
> + &ring_header->dma, GFP_KERNEL);
> if (unlikely(!ring_header->desc)) {
> - dev_err(&pdev->dev, "pci_alloc_consistend failed\n");
> + dev_err(&pdev->dev, "could not get memmory for DMA buffer\n");
> goto err_nomem;
> }
> memset(ring_header->desc, 0, ring_header->size);
>
It seems there is a missed opportunity to get rid of the memset() here,
by adding __GFP_ZERO to the dma_alloc_coherent() GFP_KERNEL mask,
or simply using dma_zalloc_coherent()
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 51+ messages in thread
* Re: [PATCH] Improve Atheros ethernet driver not to do order 4 GFP_ATOMIC allocation
@ 2015-11-30 17:58 ` Eric Dumazet
0 siblings, 0 replies; 51+ messages in thread
From: Eric Dumazet @ 2015-11-30 17:58 UTC (permalink / raw)
To: Pavel Machek
Cc: Michal Hocko, davem, Andrew Morton, kernel list, jcliburn,
chris.snook, netdev, Rafael J. Wysocki, linux-mm, nic-devel,
ronangeles, ebiederm
On Sat, 2015-11-28 at 15:51 +0100, Pavel Machek wrote:
> atl1c driver is doing order-4 allocation with GFP_ATOMIC
> priority. That often breaks networking after resume. Switch to
> GFP_KERNEL. Still not ideal, but should be significantly better.
>
> Signed-off-by: Pavel Machek <pavel@ucw.cz>
>
> diff --git a/drivers/net/ethernet/atheros/atl1c/atl1c_main.c b/drivers/net/ethernet/atheros/atl1c/atl1c_main.c
> index 2795d6d..afb71e0 100644
> --- a/drivers/net/ethernet/atheros/atl1c/atl1c_main.c
> +++ b/drivers/net/ethernet/atheros/atl1c/atl1c_main.c
> @@ -1016,10 +1016,10 @@ static int atl1c_setup_ring_resources(struct atl1c_adapter *adapter)
> sizeof(struct atl1c_recv_ret_status) * rx_desc_count +
> 8 * 4;
>
> - ring_header->desc = pci_alloc_consistent(pdev, ring_header->size,
> - &ring_header->dma);
> + ring_header->desc = dma_alloc_coherent(&pdev->dev, ring_header->size,
> + &ring_header->dma, GFP_KERNEL);
> if (unlikely(!ring_header->desc)) {
> - dev_err(&pdev->dev, "pci_alloc_consistend failed\n");
> + dev_err(&pdev->dev, "could not get memmory for DMA buffer\n");
> goto err_nomem;
> }
> memset(ring_header->desc, 0, ring_header->size);
>
It seems there is a missed opportunity to get rid of the memset() here,
by adding __GFP_ZERO to the dma_alloc_coherent() GFP_KERNEL mask,
or simply using dma_zalloc_coherent()
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 51+ messages in thread
* Re: [PATCH] Improve Atheros ethernet driver not to do order 4 GFP_ATOMIC allocation
2015-11-30 17:58 ` Eric Dumazet
@ 2015-12-01 20:36 ` David Miller
-1 siblings, 0 replies; 51+ messages in thread
From: David Miller @ 2015-12-01 20:36 UTC (permalink / raw)
To: eric.dumazet
Cc: pavel, mhocko, akpm, linux-kernel, jcliburn, chris.snook, netdev,
rjw, linux-mm, nic-devel, ronangeles, ebiederm
From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Mon, 30 Nov 2015 09:58:23 -0800
> On Sat, 2015-11-28 at 15:51 +0100, Pavel Machek wrote:
>> atl1c driver is doing order-4 allocation with GFP_ATOMIC
>> priority. That often breaks networking after resume. Switch to
>> GFP_KERNEL. Still not ideal, but should be significantly better.
>>
>> Signed-off-by: Pavel Machek <pavel@ucw.cz>
>>
>> diff --git a/drivers/net/ethernet/atheros/atl1c/atl1c_main.c b/drivers/net/ethernet/atheros/atl1c/atl1c_main.c
>> index 2795d6d..afb71e0 100644
>> --- a/drivers/net/ethernet/atheros/atl1c/atl1c_main.c
>> +++ b/drivers/net/ethernet/atheros/atl1c/atl1c_main.c
>> @@ -1016,10 +1016,10 @@ static int atl1c_setup_ring_resources(struct atl1c_adapter *adapter)
>> sizeof(struct atl1c_recv_ret_status) * rx_desc_count +
>> 8 * 4;
>>
>> - ring_header->desc = pci_alloc_consistent(pdev, ring_header->size,
>> - &ring_header->dma);
>> + ring_header->desc = dma_alloc_coherent(&pdev->dev, ring_header->size,
>> + &ring_header->dma, GFP_KERNEL);
>> if (unlikely(!ring_header->desc)) {
>> - dev_err(&pdev->dev, "pci_alloc_consistend failed\n");
>> + dev_err(&pdev->dev, "could not get memmory for DMA buffer\n");
>> goto err_nomem;
>> }
>> memset(ring_header->desc, 0, ring_header->size);
>>
>
> It seems there is a missed opportunity to get rid of the memset() here,
> by adding __GFP_ZERO to the dma_alloc_coherent() GFP_KERNEL mask,
> or simply using dma_zalloc_coherent()
Also, the Subject line needs to be adjusted. The proper format for
the Subject line is:
[PATCH $TREE] $subsystem: $description.
Where "$TREE" is either 'net' or 'net-next', $subsystem is the lowercase
name of the driver (here 'atl1c') and then a colon, and then a space, and
then the single-line description.
Thanks.
^ permalink raw reply [flat|nested] 51+ messages in thread
* Re: [PATCH] Improve Atheros ethernet driver not to do order 4 GFP_ATOMIC allocation
@ 2015-12-01 20:36 ` David Miller
0 siblings, 0 replies; 51+ messages in thread
From: David Miller @ 2015-12-01 20:36 UTC (permalink / raw)
To: eric.dumazet
Cc: pavel, mhocko, akpm, linux-kernel, jcliburn, chris.snook, netdev,
rjw, linux-mm, nic-devel, ronangeles, ebiederm
From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Mon, 30 Nov 2015 09:58:23 -0800
> On Sat, 2015-11-28 at 15:51 +0100, Pavel Machek wrote:
>> atl1c driver is doing order-4 allocation with GFP_ATOMIC
>> priority. That often breaks networking after resume. Switch to
>> GFP_KERNEL. Still not ideal, but should be significantly better.
>>
>> Signed-off-by: Pavel Machek <pavel@ucw.cz>
>>
>> diff --git a/drivers/net/ethernet/atheros/atl1c/atl1c_main.c b/drivers/net/ethernet/atheros/atl1c/atl1c_main.c
>> index 2795d6d..afb71e0 100644
>> --- a/drivers/net/ethernet/atheros/atl1c/atl1c_main.c
>> +++ b/drivers/net/ethernet/atheros/atl1c/atl1c_main.c
>> @@ -1016,10 +1016,10 @@ static int atl1c_setup_ring_resources(struct atl1c_adapter *adapter)
>> sizeof(struct atl1c_recv_ret_status) * rx_desc_count +
>> 8 * 4;
>>
>> - ring_header->desc = pci_alloc_consistent(pdev, ring_header->size,
>> - &ring_header->dma);
>> + ring_header->desc = dma_alloc_coherent(&pdev->dev, ring_header->size,
>> + &ring_header->dma, GFP_KERNEL);
>> if (unlikely(!ring_header->desc)) {
>> - dev_err(&pdev->dev, "pci_alloc_consistend failed\n");
>> + dev_err(&pdev->dev, "could not get memmory for DMA buffer\n");
>> goto err_nomem;
>> }
>> memset(ring_header->desc, 0, ring_header->size);
>>
>
> It seems there is a missed opportunity to get rid of the memset() here,
> by adding __GFP_ZERO to the dma_alloc_coherent() GFP_KERNEL mask,
> or simply using dma_zalloc_coherent()
Also, the Subject line needs to be adjusted. The proper format for
the Subject line is:
[PATCH $TREE] $subsystem: $description.
Where "$TREE" is either 'net' or 'net-next', $subsystem is the lowercase
name of the driver (here 'atl1c') and then a colon, and then a space, and
then the single-line description.
Thanks.
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 51+ messages in thread
* Re: [PATCH] Improve Atheros ethernet driver not to do order 4 GFP_ATOMIC allocation
2015-12-01 20:36 ` David Miller
@ 2015-12-03 15:59 ` Pavel Machek
-1 siblings, 0 replies; 51+ messages in thread
From: Pavel Machek @ 2015-12-03 15:59 UTC (permalink / raw)
To: David Miller
Cc: eric.dumazet, mhocko, akpm, linux-kernel, jcliburn, chris.snook,
netdev, rjw, linux-mm, nic-devel, ronangeles, ebiederm
On Tue 2015-12-01 15:36:28, David Miller wrote:
> From: Eric Dumazet <eric.dumazet@gmail.com>
> Date: Mon, 30 Nov 2015 09:58:23 -0800
>
> > On Sat, 2015-11-28 at 15:51 +0100, Pavel Machek wrote:
> >> atl1c driver is doing order-4 allocation with GFP_ATOMIC
> >> priority. That often breaks networking after resume. Switch to
> >> GFP_KERNEL. Still not ideal, but should be significantly better.
> >>
> >> Signed-off-by: Pavel Machek <pavel@ucw.cz>
> >>
> >> diff --git a/drivers/net/ethernet/atheros/atl1c/atl1c_main.c b/drivers/net/ethernet/atheros/atl1c/atl1c_main.c
> >> index 2795d6d..afb71e0 100644
> >> --- a/drivers/net/ethernet/atheros/atl1c/atl1c_main.c
> >> +++ b/drivers/net/ethernet/atheros/atl1c/atl1c_main.c
> >> @@ -1016,10 +1016,10 @@ static int atl1c_setup_ring_resources(struct atl1c_adapter *adapter)
> >> sizeof(struct atl1c_recv_ret_status) * rx_desc_count +
> >> 8 * 4;
> >>
> >> - ring_header->desc = pci_alloc_consistent(pdev, ring_header->size,
> >> - &ring_header->dma);
> >> + ring_header->desc = dma_alloc_coherent(&pdev->dev, ring_header->size,
> >> + &ring_header->dma, GFP_KERNEL);
> >> if (unlikely(!ring_header->desc)) {
> >> - dev_err(&pdev->dev, "pci_alloc_consistend failed\n");
> >> + dev_err(&pdev->dev, "could not get memmory for DMA buffer\n");
> >> goto err_nomem;
> >> }
> >> memset(ring_header->desc, 0, ring_header->size);
> >>
> >
> > It seems there is a missed opportunity to get rid of the memset() here,
> > by adding __GFP_ZERO to the dma_alloc_coherent() GFP_KERNEL mask,
> > or simply using dma_zalloc_coherent()
>
> Also, the Subject line needs to be adjusted. The proper format for
> the Subject line is:
>
> [PATCH $TREE] $subsystem: $description.
>
> Where "$TREE" is either 'net' or 'net-next', $subsystem is the lowercase
> name of the driver (here 'atl1c') and then a colon, and then a space, and
> then the single-line description.
Done, thanks.
Pavel
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
^ permalink raw reply [flat|nested] 51+ messages in thread
* Re: [PATCH] Improve Atheros ethernet driver not to do order 4 GFP_ATOMIC allocation
@ 2015-12-03 15:59 ` Pavel Machek
0 siblings, 0 replies; 51+ messages in thread
From: Pavel Machek @ 2015-12-03 15:59 UTC (permalink / raw)
To: David Miller
Cc: eric.dumazet, mhocko, akpm, linux-kernel, jcliburn, chris.snook,
netdev, rjw, linux-mm, nic-devel, ronangeles, ebiederm
On Tue 2015-12-01 15:36:28, David Miller wrote:
> From: Eric Dumazet <eric.dumazet@gmail.com>
> Date: Mon, 30 Nov 2015 09:58:23 -0800
>
> > On Sat, 2015-11-28 at 15:51 +0100, Pavel Machek wrote:
> >> atl1c driver is doing order-4 allocation with GFP_ATOMIC
> >> priority. That often breaks networking after resume. Switch to
> >> GFP_KERNEL. Still not ideal, but should be significantly better.
> >>
> >> Signed-off-by: Pavel Machek <pavel@ucw.cz>
> >>
> >> diff --git a/drivers/net/ethernet/atheros/atl1c/atl1c_main.c b/drivers/net/ethernet/atheros/atl1c/atl1c_main.c
> >> index 2795d6d..afb71e0 100644
> >> --- a/drivers/net/ethernet/atheros/atl1c/atl1c_main.c
> >> +++ b/drivers/net/ethernet/atheros/atl1c/atl1c_main.c
> >> @@ -1016,10 +1016,10 @@ static int atl1c_setup_ring_resources(struct atl1c_adapter *adapter)
> >> sizeof(struct atl1c_recv_ret_status) * rx_desc_count +
> >> 8 * 4;
> >>
> >> - ring_header->desc = pci_alloc_consistent(pdev, ring_header->size,
> >> - &ring_header->dma);
> >> + ring_header->desc = dma_alloc_coherent(&pdev->dev, ring_header->size,
> >> + &ring_header->dma, GFP_KERNEL);
> >> if (unlikely(!ring_header->desc)) {
> >> - dev_err(&pdev->dev, "pci_alloc_consistend failed\n");
> >> + dev_err(&pdev->dev, "could not get memmory for DMA buffer\n");
> >> goto err_nomem;
> >> }
> >> memset(ring_header->desc, 0, ring_header->size);
> >>
> >
> > It seems there is a missed opportunity to get rid of the memset() here,
> > by adding __GFP_ZERO to the dma_alloc_coherent() GFP_KERNEL mask,
> > or simply using dma_zalloc_coherent()
>
> Also, the Subject line needs to be adjusted. The proper format for
> the Subject line is:
>
> [PATCH $TREE] $subsystem: $description.
>
> Where "$TREE" is either 'net' or 'net-next', $subsystem is the lowercase
> name of the driver (here 'atl1c') and then a colon, and then a space, and
> then the single-line description.
Done, thanks.
Pavel
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 51+ messages in thread
* [PATCH net] atl1c: Improve driver not to do order 4 GFP_ATOMIC allocation
2015-11-28 14:51 ` Pavel Machek
@ 2015-12-03 15:59 ` Pavel Machek
-1 siblings, 0 replies; 51+ messages in thread
From: Pavel Machek @ 2015-12-03 15:59 UTC (permalink / raw)
To: Michal Hocko, davem, Andrew Morton
Cc: kernel list, jcliburn, chris.snook, netdev, Rafael J. Wysocki,
linux-mm, nic-devel, ronangeles, ebiederm
atl1c driver is doing order-4 allocation with GFP_ATOMIC
priority. That often breaks networking after resume. Switch to
GFP_KERNEL. Still not ideal, but should be significantly better.
atl1c_setup_ring_resources() is called from .open() function, and
already uses GFP_KERNEL, so this change is safe.
Signed-off-by: Pavel Machek <pavel@ucw.cz>
diff --git a/drivers/net/ethernet/atheros/atl1c/atl1c_main.c b/drivers/net/ethernet/atheros/atl1c/atl1c_main.c
index 2795d6d..afb71e0 100644
--- a/drivers/net/ethernet/atheros/atl1c/atl1c_main.c
+++ b/drivers/net/ethernet/atheros/atl1c/atl1c_main.c
@@ -1016,10 +1016,10 @@ static int atl1c_setup_ring_resources(struct atl1c_adapter *adapter)
sizeof(struct atl1c_recv_ret_status) * rx_desc_count +
8 * 4;
- ring_header->desc = pci_alloc_consistent(pdev, ring_header->size,
- &ring_header->dma);
+ ring_header->desc = dma_alloc_coherent(&pdev->dev, ring_header->size,
+ &ring_header->dma, GFP_KERNEL);
if (unlikely(!ring_header->desc)) {
- dev_err(&pdev->dev, "pci_alloc_consistend failed\n");
+ dev_err(&pdev->dev, "could not get memory for DMA buffer\n");
goto err_nomem;
}
memset(ring_header->desc, 0, ring_header->size);
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
^ permalink raw reply related [flat|nested] 51+ messages in thread
* [PATCH net] atl1c: Improve driver not to do order 4 GFP_ATOMIC allocation
@ 2015-12-03 15:59 ` Pavel Machek
0 siblings, 0 replies; 51+ messages in thread
From: Pavel Machek @ 2015-12-03 15:59 UTC (permalink / raw)
To: Michal Hocko, davem, Andrew Morton
Cc: kernel list, jcliburn, chris.snook, netdev, Rafael J. Wysocki,
linux-mm, nic-devel, ronangeles, ebiederm
atl1c driver is doing order-4 allocation with GFP_ATOMIC
priority. That often breaks networking after resume. Switch to
GFP_KERNEL. Still not ideal, but should be significantly better.
atl1c_setup_ring_resources() is called from .open() function, and
already uses GFP_KERNEL, so this change is safe.
Signed-off-by: Pavel Machek <pavel@ucw.cz>
diff --git a/drivers/net/ethernet/atheros/atl1c/atl1c_main.c b/drivers/net/ethernet/atheros/atl1c/atl1c_main.c
index 2795d6d..afb71e0 100644
--- a/drivers/net/ethernet/atheros/atl1c/atl1c_main.c
+++ b/drivers/net/ethernet/atheros/atl1c/atl1c_main.c
@@ -1016,10 +1016,10 @@ static int atl1c_setup_ring_resources(struct atl1c_adapter *adapter)
sizeof(struct atl1c_recv_ret_status) * rx_desc_count +
8 * 4;
- ring_header->desc = pci_alloc_consistent(pdev, ring_header->size,
- &ring_header->dma);
+ ring_header->desc = dma_alloc_coherent(&pdev->dev, ring_header->size,
+ &ring_header->dma, GFP_KERNEL);
if (unlikely(!ring_header->desc)) {
- dev_err(&pdev->dev, "pci_alloc_consistend failed\n");
+ dev_err(&pdev->dev, "could not get memory for DMA buffer\n");
goto err_nomem;
}
memset(ring_header->desc, 0, ring_header->size);
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply related [flat|nested] 51+ messages in thread
* Re: [PATCH net] atl1c: Improve driver not to do order 4 GFP_ATOMIC allocation
2015-12-03 15:59 ` Pavel Machek
@ 2015-12-03 16:13 ` Michal Hocko
-1 siblings, 0 replies; 51+ messages in thread
From: Michal Hocko @ 2015-12-03 16:13 UTC (permalink / raw)
To: Pavel Machek
Cc: davem, Andrew Morton, kernel list, jcliburn, chris.snook, netdev,
Rafael J. Wysocki, linux-mm, nic-devel, ronangeles, ebiederm
On Thu 03-12-15 16:59:05, Pavel Machek wrote:
>
> atl1c driver is doing order-4 allocation with GFP_ATOMIC
> priority. That often breaks networking after resume. Switch to
> GFP_KERNEL. Still not ideal, but should be significantly better.
>
> atl1c_setup_ring_resources() is called from .open() function, and
> already uses GFP_KERNEL, so this change is safe.
Thanks for updating the changelog
> Signed-off-by: Pavel Machek <pavel@ucw.cz>
Acked-by: Michal Hocko <mhocko@suse.com>
>
> diff --git a/drivers/net/ethernet/atheros/atl1c/atl1c_main.c b/drivers/net/ethernet/atheros/atl1c/atl1c_main.c
> index 2795d6d..afb71e0 100644
> --- a/drivers/net/ethernet/atheros/atl1c/atl1c_main.c
> +++ b/drivers/net/ethernet/atheros/atl1c/atl1c_main.c
> @@ -1016,10 +1016,10 @@ static int atl1c_setup_ring_resources(struct atl1c_adapter *adapter)
> sizeof(struct atl1c_recv_ret_status) * rx_desc_count +
> 8 * 4;
>
> - ring_header->desc = pci_alloc_consistent(pdev, ring_header->size,
> - &ring_header->dma);
> + ring_header->desc = dma_alloc_coherent(&pdev->dev, ring_header->size,
> + &ring_header->dma, GFP_KERNEL);
> if (unlikely(!ring_header->desc)) {
> - dev_err(&pdev->dev, "pci_alloc_consistend failed\n");
> + dev_err(&pdev->dev, "could not get memory for DMA buffer\n");
> goto err_nomem;
> }
> memset(ring_header->desc, 0, ring_header->size);
>
>
> --
> (english) http://www.livejournal.com/~pavelmachek
> (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
--
Michal Hocko
SUSE Labs
^ permalink raw reply [flat|nested] 51+ messages in thread
* Re: [PATCH net] atl1c: Improve driver not to do order 4 GFP_ATOMIC allocation
@ 2015-12-03 16:13 ` Michal Hocko
0 siblings, 0 replies; 51+ messages in thread
From: Michal Hocko @ 2015-12-03 16:13 UTC (permalink / raw)
To: Pavel Machek
Cc: davem, Andrew Morton, kernel list, jcliburn, chris.snook, netdev,
Rafael J. Wysocki, linux-mm, nic-devel, ronangeles, ebiederm
On Thu 03-12-15 16:59:05, Pavel Machek wrote:
>
> atl1c driver is doing order-4 allocation with GFP_ATOMIC
> priority. That often breaks networking after resume. Switch to
> GFP_KERNEL. Still not ideal, but should be significantly better.
>
> atl1c_setup_ring_resources() is called from .open() function, and
> already uses GFP_KERNEL, so this change is safe.
Thanks for updating the changelog
> Signed-off-by: Pavel Machek <pavel@ucw.cz>
Acked-by: Michal Hocko <mhocko@suse.com>
>
> diff --git a/drivers/net/ethernet/atheros/atl1c/atl1c_main.c b/drivers/net/ethernet/atheros/atl1c/atl1c_main.c
> index 2795d6d..afb71e0 100644
> --- a/drivers/net/ethernet/atheros/atl1c/atl1c_main.c
> +++ b/drivers/net/ethernet/atheros/atl1c/atl1c_main.c
> @@ -1016,10 +1016,10 @@ static int atl1c_setup_ring_resources(struct atl1c_adapter *adapter)
> sizeof(struct atl1c_recv_ret_status) * rx_desc_count +
> 8 * 4;
>
> - ring_header->desc = pci_alloc_consistent(pdev, ring_header->size,
> - &ring_header->dma);
> + ring_header->desc = dma_alloc_coherent(&pdev->dev, ring_header->size,
> + &ring_header->dma, GFP_KERNEL);
> if (unlikely(!ring_header->desc)) {
> - dev_err(&pdev->dev, "pci_alloc_consistend failed\n");
> + dev_err(&pdev->dev, "could not get memory for DMA buffer\n");
> goto err_nomem;
> }
> memset(ring_header->desc, 0, ring_header->size);
>
>
> --
> (english) http://www.livejournal.com/~pavelmachek
> (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
--
Michal Hocko
SUSE Labs
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 51+ messages in thread
* Re: [PATCH net] atl1c: Improve driver not to do order 4 GFP_ATOMIC allocation
2015-12-03 15:59 ` Pavel Machek
(?)
@ 2015-12-03 17:17 ` Eric Dumazet
-1 siblings, 0 replies; 51+ messages in thread
From: Eric Dumazet @ 2015-12-03 17:17 UTC (permalink / raw)
To: Pavel Machek
Cc: Michal Hocko, davem, Andrew Morton, kernel list, jcliburn,
chris.snook, netdev, Rafael J. Wysocki, linux-mm, nic-devel,
ronangeles, ebiederm
On Thu, 2015-12-03 at 16:59 +0100, Pavel Machek wrote:
> atl1c driver is doing order-4 allocation with GFP_ATOMIC
> priority. That often breaks networking after resume. Switch to
> GFP_KERNEL. Still not ideal, but should be significantly better.
>
> atl1c_setup_ring_resources() is called from .open() function, and
> already uses GFP_KERNEL, so this change is safe.
>
> Signed-off-by: Pavel Machek <pavel@ucw.cz>
>
> diff --git a/drivers/net/ethernet/atheros/atl1c/atl1c_main.c b/drivers/net/ethernet/atheros/atl1c/atl1c_main.c
> index 2795d6d..afb71e0 100644
> --- a/drivers/net/ethernet/atheros/atl1c/atl1c_main.c
> +++ b/drivers/net/ethernet/atheros/atl1c/atl1c_main.c
> @@ -1016,10 +1016,10 @@ static int atl1c_setup_ring_resources(struct atl1c_adapter *adapter)
> sizeof(struct atl1c_recv_ret_status) * rx_desc_count +
> 8 * 4;
>
> - ring_header->desc = pci_alloc_consistent(pdev, ring_header->size,
> - &ring_header->dma);
> + ring_header->desc = dma_alloc_coherent(&pdev->dev, ring_header->size,
> + &ring_header->dma, GFP_KERNEL);
> if (unlikely(!ring_header->desc)) {
> - dev_err(&pdev->dev, "pci_alloc_consistend failed\n");
> + dev_err(&pdev->dev, "could not get memory for DMA buffer\n");
> goto err_nomem;
> }
> memset(ring_header->desc, 0, ring_header->size);
>
>
So this memset() will really require a different patch to get removed ?
Sigh, not sure why I review patches.
^ permalink raw reply [flat|nested] 51+ messages in thread
* Re: [PATCH net] atl1c: Improve driver not to do order 4 GFP_ATOMIC allocation
@ 2015-12-03 17:17 ` Eric Dumazet
0 siblings, 0 replies; 51+ messages in thread
From: Eric Dumazet @ 2015-12-03 17:17 UTC (permalink / raw)
To: Pavel Machek
Cc: Michal Hocko, davem, Andrew Morton, kernel list, jcliburn,
chris.snook, netdev, Rafael J. Wysocki, linux-mm, nic-devel,
ronangeles, ebiederm
On Thu, 2015-12-03 at 16:59 +0100, Pavel Machek wrote:
> atl1c driver is doing order-4 allocation with GFP_ATOMIC
> priority. That often breaks networking after resume. Switch to
> GFP_KERNEL. Still not ideal, but should be significantly better.
>
> atl1c_setup_ring_resources() is called from .open() function, and
> already uses GFP_KERNEL, so this change is safe.
>
> Signed-off-by: Pavel Machek <pavel@ucw.cz>
>
> diff --git a/drivers/net/ethernet/atheros/atl1c/atl1c_main.c b/drivers/net/ethernet/atheros/atl1c/atl1c_main.c
> index 2795d6d..afb71e0 100644
> --- a/drivers/net/ethernet/atheros/atl1c/atl1c_main.c
> +++ b/drivers/net/ethernet/atheros/atl1c/atl1c_main.c
> @@ -1016,10 +1016,10 @@ static int atl1c_setup_ring_resources(struct atl1c_adapter *adapter)
> sizeof(struct atl1c_recv_ret_status) * rx_desc_count +
> 8 * 4;
>
> - ring_header->desc = pci_alloc_consistent(pdev, ring_header->size,
> - &ring_header->dma);
> + ring_header->desc = dma_alloc_coherent(&pdev->dev, ring_header->size,
> + &ring_header->dma, GFP_KERNEL);
> if (unlikely(!ring_header->desc)) {
> - dev_err(&pdev->dev, "pci_alloc_consistend failed\n");
> + dev_err(&pdev->dev, "could not get memory for DMA buffer\n");
> goto err_nomem;
> }
> memset(ring_header->desc, 0, ring_header->size);
>
>
So this memset() will really require a different patch to get removed ?
Sigh, not sure why I review patches.
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 51+ messages in thread
* Re: [PATCH net] atl1c: Improve driver not to do order 4 GFP_ATOMIC allocation
@ 2015-12-03 17:17 ` Eric Dumazet
0 siblings, 0 replies; 51+ messages in thread
From: Eric Dumazet @ 2015-12-03 17:17 UTC (permalink / raw)
To: Pavel Machek
Cc: Michal Hocko, davem, Andrew Morton, kernel list, jcliburn,
chris.snook, netdev, Rafael J. Wysocki, linux-mm, nic-devel,
ronangeles, ebiederm
On Thu, 2015-12-03 at 16:59 +0100, Pavel Machek wrote:
> atl1c driver is doing order-4 allocation with GFP_ATOMIC
> priority. That often breaks networking after resume. Switch to
> GFP_KERNEL. Still not ideal, but should be significantly better.
>
> atl1c_setup_ring_resources() is called from .open() function, and
> already uses GFP_KERNEL, so this change is safe.
>
> Signed-off-by: Pavel Machek <pavel@ucw.cz>
>
> diff --git a/drivers/net/ethernet/atheros/atl1c/atl1c_main.c b/drivers/net/ethernet/atheros/atl1c/atl1c_main.c
> index 2795d6d..afb71e0 100644
> --- a/drivers/net/ethernet/atheros/atl1c/atl1c_main.c
> +++ b/drivers/net/ethernet/atheros/atl1c/atl1c_main.c
> @@ -1016,10 +1016,10 @@ static int atl1c_setup_ring_resources(struct atl1c_adapter *adapter)
> sizeof(struct atl1c_recv_ret_status) * rx_desc_count +
> 8 * 4;
>
> - ring_header->desc = pci_alloc_consistent(pdev, ring_header->size,
> - &ring_header->dma);
> + ring_header->desc = dma_alloc_coherent(&pdev->dev, ring_header->size,
> + &ring_header->dma, GFP_KERNEL);
> if (unlikely(!ring_header->desc)) {
> - dev_err(&pdev->dev, "pci_alloc_consistend failed\n");
> + dev_err(&pdev->dev, "could not get memory for DMA buffer\n");
> goto err_nomem;
> }
> memset(ring_header->desc, 0, ring_header->size);
>
>
So this memset() will really require a different patch to get removed ?
Sigh, not sure why I review patches.
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 51+ messages in thread
* Re: [PATCH net] atl1c: Improve driver not to do order 4 GFP_ATOMIC allocation
2015-12-03 17:17 ` Eric Dumazet
@ 2015-12-03 17:32 ` David Miller
-1 siblings, 0 replies; 51+ messages in thread
From: David Miller @ 2015-12-03 17:32 UTC (permalink / raw)
To: eric.dumazet
Cc: pavel, mhocko, akpm, linux-kernel, jcliburn, chris.snook, netdev,
rjw, linux-mm, nic-devel, ronangeles, ebiederm
From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Thu, 03 Dec 2015 09:17:28 -0800
> On Thu, 2015-12-03 at 16:59 +0100, Pavel Machek wrote:
>> atl1c driver is doing order-4 allocation with GFP_ATOMIC
>> priority. That often breaks networking after resume. Switch to
>> GFP_KERNEL. Still not ideal, but should be significantly better.
>>
>> atl1c_setup_ring_resources() is called from .open() function, and
>> already uses GFP_KERNEL, so this change is safe.
>>
>> Signed-off-by: Pavel Machek <pavel@ucw.cz>
>>
>> diff --git a/drivers/net/ethernet/atheros/atl1c/atl1c_main.c b/drivers/net/ethernet/atheros/atl1c/atl1c_main.c
>> index 2795d6d..afb71e0 100644
>> --- a/drivers/net/ethernet/atheros/atl1c/atl1c_main.c
>> +++ b/drivers/net/ethernet/atheros/atl1c/atl1c_main.c
>> @@ -1016,10 +1016,10 @@ static int atl1c_setup_ring_resources(struct atl1c_adapter *adapter)
>> sizeof(struct atl1c_recv_ret_status) * rx_desc_count +
>> 8 * 4;
>>
>> - ring_header->desc = pci_alloc_consistent(pdev, ring_header->size,
>> - &ring_header->dma);
>> + ring_header->desc = dma_alloc_coherent(&pdev->dev, ring_header->size,
>> + &ring_header->dma, GFP_KERNEL);
>> if (unlikely(!ring_header->desc)) {
>> - dev_err(&pdev->dev, "pci_alloc_consistend failed\n");
>> + dev_err(&pdev->dev, "could not get memory for DMA buffer\n");
>> goto err_nomem;
>> }
>> memset(ring_header->desc, 0, ring_header->size);
>>
>>
>
> So this memset() will really require a different patch to get removed ?
>
> Sigh, not sure why I review patches.
Agreed, please use dma_zalloc_coherent() and kill that memset().
Thanks.
^ permalink raw reply [flat|nested] 51+ messages in thread
* Re: [PATCH net] atl1c: Improve driver not to do order 4 GFP_ATOMIC allocation
@ 2015-12-03 17:32 ` David Miller
0 siblings, 0 replies; 51+ messages in thread
From: David Miller @ 2015-12-03 17:32 UTC (permalink / raw)
To: eric.dumazet
Cc: pavel, mhocko, akpm, linux-kernel, jcliburn, chris.snook, netdev,
rjw, linux-mm, nic-devel, ronangeles, ebiederm
From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Thu, 03 Dec 2015 09:17:28 -0800
> On Thu, 2015-12-03 at 16:59 +0100, Pavel Machek wrote:
>> atl1c driver is doing order-4 allocation with GFP_ATOMIC
>> priority. That often breaks networking after resume. Switch to
>> GFP_KERNEL. Still not ideal, but should be significantly better.
>>
>> atl1c_setup_ring_resources() is called from .open() function, and
>> already uses GFP_KERNEL, so this change is safe.
>>
>> Signed-off-by: Pavel Machek <pavel@ucw.cz>
>>
>> diff --git a/drivers/net/ethernet/atheros/atl1c/atl1c_main.c b/drivers/net/ethernet/atheros/atl1c/atl1c_main.c
>> index 2795d6d..afb71e0 100644
>> --- a/drivers/net/ethernet/atheros/atl1c/atl1c_main.c
>> +++ b/drivers/net/ethernet/atheros/atl1c/atl1c_main.c
>> @@ -1016,10 +1016,10 @@ static int atl1c_setup_ring_resources(struct atl1c_adapter *adapter)
>> sizeof(struct atl1c_recv_ret_status) * rx_desc_count +
>> 8 * 4;
>>
>> - ring_header->desc = pci_alloc_consistent(pdev, ring_header->size,
>> - &ring_header->dma);
>> + ring_header->desc = dma_alloc_coherent(&pdev->dev, ring_header->size,
>> + &ring_header->dma, GFP_KERNEL);
>> if (unlikely(!ring_header->desc)) {
>> - dev_err(&pdev->dev, "pci_alloc_consistend failed\n");
>> + dev_err(&pdev->dev, "could not get memory for DMA buffer\n");
>> goto err_nomem;
>> }
>> memset(ring_header->desc, 0, ring_header->size);
>>
>>
>
> So this memset() will really require a different patch to get removed ?
>
> Sigh, not sure why I review patches.
Agreed, please use dma_zalloc_coherent() and kill that memset().
Thanks.
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 51+ messages in thread
* Re: [PATCH net] atl1c: Improve driver not to do order 4 GFP_ATOMIC allocation
2015-12-03 17:32 ` David Miller
@ 2015-12-04 8:11 ` Pavel Machek
-1 siblings, 0 replies; 51+ messages in thread
From: Pavel Machek @ 2015-12-04 8:11 UTC (permalink / raw)
To: David Miller
Cc: eric.dumazet, mhocko, akpm, linux-kernel, jcliburn, chris.snook,
netdev, rjw, linux-mm, nic-devel, ronangeles, ebiederm
> >> if (unlikely(!ring_header->desc)) {
> >> - dev_err(&pdev->dev, "pci_alloc_consistend failed\n");
> >> + dev_err(&pdev->dev, "could not get memory for DMA buffer\n");
> >> goto err_nomem;
> >> }
> >> memset(ring_header->desc, 0, ring_header->size);
> >>
> >>
> >
> > So this memset() will really require a different patch to get removed ?
> >
> > Sigh, not sure why I review patches.
>
> Agreed, please use dma_zalloc_coherent() and kill that memset().
Ok, updated. I'll also add cc: stable, because it makes notebooks with
affected chipset unusable.
Pavel
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
^ permalink raw reply [flat|nested] 51+ messages in thread
* Re: [PATCH net] atl1c: Improve driver not to do order 4 GFP_ATOMIC allocation
@ 2015-12-04 8:11 ` Pavel Machek
0 siblings, 0 replies; 51+ messages in thread
From: Pavel Machek @ 2015-12-04 8:11 UTC (permalink / raw)
To: David Miller
Cc: eric.dumazet, mhocko, akpm, linux-kernel, jcliburn, chris.snook,
netdev, rjw, linux-mm, nic-devel, ronangeles, ebiederm
> >> if (unlikely(!ring_header->desc)) {
> >> - dev_err(&pdev->dev, "pci_alloc_consistend failed\n");
> >> + dev_err(&pdev->dev, "could not get memory for DMA buffer\n");
> >> goto err_nomem;
> >> }
> >> memset(ring_header->desc, 0, ring_header->size);
> >>
> >>
> >
> > So this memset() will really require a different patch to get removed ?
> >
> > Sigh, not sure why I review patches.
>
> Agreed, please use dma_zalloc_coherent() and kill that memset().
Ok, updated. I'll also add cc: stable, because it makes notebooks with
affected chipset unusable.
Pavel
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 51+ messages in thread
* Re: [PATCH net] atl1c: Improve driver not to do order 4 GFP_ATOMIC allocation
2015-12-04 8:11 ` Pavel Machek
@ 2015-12-04 16:21 ` David Miller
-1 siblings, 0 replies; 51+ messages in thread
From: David Miller @ 2015-12-04 16:21 UTC (permalink / raw)
To: pavel
Cc: eric.dumazet, mhocko, akpm, linux-kernel, jcliburn, chris.snook,
netdev, rjw, linux-mm, nic-devel, ronangeles, ebiederm
From: Pavel Machek <pavel@ucw.cz>
Date: Fri, 4 Dec 2015 09:11:27 +0100
>> >> if (unlikely(!ring_header->desc)) {
>> >> - dev_err(&pdev->dev, "pci_alloc_consistend failed\n");
>> >> + dev_err(&pdev->dev, "could not get memory for DMA buffer\n");
>> >> goto err_nomem;
>> >> }
>> >> memset(ring_header->desc, 0, ring_header->size);
>> >>
>> >>
>> >
>> > So this memset() will really require a different patch to get removed ?
>> >
>> > Sigh, not sure why I review patches.
>>
>> Agreed, please use dma_zalloc_coherent() and kill that memset().
>
> Ok, updated. I'll also add cc: stable, because it makes notebooks with
> affected chipset unusable.
Networking patches do not use CC: stable, instead you simply ask me
to queue it up and then I batch submit networking fixes to -stable
periodically myself.
^ permalink raw reply [flat|nested] 51+ messages in thread
* Re: [PATCH net] atl1c: Improve driver not to do order 4 GFP_ATOMIC allocation
@ 2015-12-04 16:21 ` David Miller
0 siblings, 0 replies; 51+ messages in thread
From: David Miller @ 2015-12-04 16:21 UTC (permalink / raw)
To: pavel
Cc: eric.dumazet, mhocko, akpm, linux-kernel, jcliburn, chris.snook,
netdev, rjw, linux-mm, nic-devel, ronangeles, ebiederm
From: Pavel Machek <pavel@ucw.cz>
Date: Fri, 4 Dec 2015 09:11:27 +0100
>> >> if (unlikely(!ring_header->desc)) {
>> >> - dev_err(&pdev->dev, "pci_alloc_consistend failed\n");
>> >> + dev_err(&pdev->dev, "could not get memory for DMA buffer\n");
>> >> goto err_nomem;
>> >> }
>> >> memset(ring_header->desc, 0, ring_header->size);
>> >>
>> >>
>> >
>> > So this memset() will really require a different patch to get removed ?
>> >
>> > Sigh, not sure why I review patches.
>>
>> Agreed, please use dma_zalloc_coherent() and kill that memset().
>
> Ok, updated. I'll also add cc: stable, because it makes notebooks with
> affected chipset unusable.
Networking patches do not use CC: stable, instead you simply ask me
to queue it up and then I batch submit networking fixes to -stable
periodically myself.
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 51+ messages in thread
* Re: [PATCH net] atl1c: Improve driver not to do order 4 GFP_ATOMIC allocation
2015-12-04 16:21 ` David Miller
@ 2015-12-04 21:30 ` Pavel Machek
-1 siblings, 0 replies; 51+ messages in thread
From: Pavel Machek @ 2015-12-04 21:30 UTC (permalink / raw)
To: David Miller
Cc: eric.dumazet, mhocko, akpm, linux-kernel, jcliburn, chris.snook,
netdev, rjw, linux-mm, nic-devel, ronangeles, ebiederm
On Fri 2015-12-04 11:21:40, David Miller wrote:
> From: Pavel Machek <pavel@ucw.cz>
> Date: Fri, 4 Dec 2015 09:11:27 +0100
>
> >> >> if (unlikely(!ring_header->desc)) {
> >> >> - dev_err(&pdev->dev, "pci_alloc_consistend failed\n");
> >> >> + dev_err(&pdev->dev, "could not get memory for DMA buffer\n");
> >> >> goto err_nomem;
> >> >> }
> >> >> memset(ring_header->desc, 0, ring_header->size);
> >> >>
> >> >>
> >> >
> >> > So this memset() will really require a different patch to get removed ?
> >> >
> >> > Sigh, not sure why I review patches.
> >>
> >> Agreed, please use dma_zalloc_coherent() and kill that memset().
> >
> > Ok, updated. I'll also add cc: stable, because it makes notebooks with
> > affected chipset unusable.
>
> Networking patches do not use CC: stable, instead you simply ask me
> to queue it up and then I batch submit networking fixes to -stable
> periodically myself.
Ok, can you take the patch and ignore the Cc, or should I do one more
iteration?
Thanks,
Pavel
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
^ permalink raw reply [flat|nested] 51+ messages in thread
* Re: [PATCH net] atl1c: Improve driver not to do order 4 GFP_ATOMIC allocation
@ 2015-12-04 21:30 ` Pavel Machek
0 siblings, 0 replies; 51+ messages in thread
From: Pavel Machek @ 2015-12-04 21:30 UTC (permalink / raw)
To: David Miller
Cc: eric.dumazet, mhocko, akpm, linux-kernel, jcliburn, chris.snook,
netdev, rjw, linux-mm, nic-devel, ronangeles, ebiederm
On Fri 2015-12-04 11:21:40, David Miller wrote:
> From: Pavel Machek <pavel@ucw.cz>
> Date: Fri, 4 Dec 2015 09:11:27 +0100
>
> >> >> if (unlikely(!ring_header->desc)) {
> >> >> - dev_err(&pdev->dev, "pci_alloc_consistend failed\n");
> >> >> + dev_err(&pdev->dev, "could not get memory for DMA buffer\n");
> >> >> goto err_nomem;
> >> >> }
> >> >> memset(ring_header->desc, 0, ring_header->size);
> >> >>
> >> >>
> >> >
> >> > So this memset() will really require a different patch to get removed ?
> >> >
> >> > Sigh, not sure why I review patches.
> >>
> >> Agreed, please use dma_zalloc_coherent() and kill that memset().
> >
> > Ok, updated. I'll also add cc: stable, because it makes notebooks with
> > affected chipset unusable.
>
> Networking patches do not use CC: stable, instead you simply ask me
> to queue it up and then I batch submit networking fixes to -stable
> periodically myself.
Ok, can you take the patch and ignore the Cc, or should I do one more
iteration?
Thanks,
Pavel
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 51+ messages in thread
* Re: [PATCH net] atl1c: Improve driver not to do order 4 GFP_ATOMIC allocation
2015-12-04 21:30 ` Pavel Machek
@ 2015-12-04 22:01 ` David Miller
-1 siblings, 0 replies; 51+ messages in thread
From: David Miller @ 2015-12-04 22:01 UTC (permalink / raw)
To: pavel
Cc: eric.dumazet, mhocko, akpm, linux-kernel, jcliburn, chris.snook,
netdev, rjw, linux-mm, nic-devel, ronangeles, ebiederm
From: Pavel Machek <pavel@ucw.cz>
Date: Fri, 4 Dec 2015 22:30:27 +0100
> On Fri 2015-12-04 11:21:40, David Miller wrote:
>> From: Pavel Machek <pavel@ucw.cz>
>> Date: Fri, 4 Dec 2015 09:11:27 +0100
>>
>> >> >> if (unlikely(!ring_header->desc)) {
>> >> >> - dev_err(&pdev->dev, "pci_alloc_consistend failed\n");
>> >> >> + dev_err(&pdev->dev, "could not get memory for DMA buffer\n");
>> >> >> goto err_nomem;
>> >> >> }
>> >> >> memset(ring_header->desc, 0, ring_header->size);
>> >> >>
>> >> >>
>> >> >
>> >> > So this memset() will really require a different patch to get removed ?
>> >> >
>> >> > Sigh, not sure why I review patches.
>> >>
>> >> Agreed, please use dma_zalloc_coherent() and kill that memset().
>> >
>> > Ok, updated. I'll also add cc: stable, because it makes notebooks with
>> > affected chipset unusable.
>>
>> Networking patches do not use CC: stable, instead you simply ask me
>> to queue it up and then I batch submit networking fixes to -stable
>> periodically myself.
>
> Ok, can you take the patch and ignore the Cc, or should I do one more
> iteration?
I took care of it.
^ permalink raw reply [flat|nested] 51+ messages in thread
* Re: [PATCH net] atl1c: Improve driver not to do order 4 GFP_ATOMIC allocation
@ 2015-12-04 22:01 ` David Miller
0 siblings, 0 replies; 51+ messages in thread
From: David Miller @ 2015-12-04 22:01 UTC (permalink / raw)
To: pavel
Cc: eric.dumazet, mhocko, akpm, linux-kernel, jcliburn, chris.snook,
netdev, rjw, linux-mm, nic-devel, ronangeles, ebiederm
From: Pavel Machek <pavel@ucw.cz>
Date: Fri, 4 Dec 2015 22:30:27 +0100
> On Fri 2015-12-04 11:21:40, David Miller wrote:
>> From: Pavel Machek <pavel@ucw.cz>
>> Date: Fri, 4 Dec 2015 09:11:27 +0100
>>
>> >> >> if (unlikely(!ring_header->desc)) {
>> >> >> - dev_err(&pdev->dev, "pci_alloc_consistend failed\n");
>> >> >> + dev_err(&pdev->dev, "could not get memory for DMA buffer\n");
>> >> >> goto err_nomem;
>> >> >> }
>> >> >> memset(ring_header->desc, 0, ring_header->size);
>> >> >>
>> >> >>
>> >> >
>> >> > So this memset() will really require a different patch to get removed ?
>> >> >
>> >> > Sigh, not sure why I review patches.
>> >>
>> >> Agreed, please use dma_zalloc_coherent() and kill that memset().
>> >
>> > Ok, updated. I'll also add cc: stable, because it makes notebooks with
>> > affected chipset unusable.
>>
>> Networking patches do not use CC: stable, instead you simply ask me
>> to queue it up and then I batch submit networking fixes to -stable
>> periodically myself.
>
> Ok, can you take the patch and ignore the Cc, or should I do one more
> iteration?
I took care of it.
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 51+ messages in thread
* [PATCH net] atl1c: Improve driver not to do order 4 GFP_ATOMIC allocation
2015-12-03 15:59 ` Pavel Machek
@ 2015-12-04 8:50 ` Pavel Machek
-1 siblings, 0 replies; 51+ messages in thread
From: Pavel Machek @ 2015-12-04 8:50 UTC (permalink / raw)
To: Michal Hocko, davem, Andrew Morton
Cc: kernel list, jcliburn, chris.snook, netdev, Rafael J. Wysocki,
linux-mm, nic-devel, ronangeles, ebiederm
atl1c driver is doing order-4 allocation with GFP_ATOMIC
priority. That often breaks networking after resume. Switch to
GFP_KERNEL. Still not ideal, but should be significantly better.
atl1c_setup_ring_resources() is called from .open() function, and
already uses GFP_KERNEL, so this change is safe.
Signed-off-by: Pavel Machek <pavel@ucw.cz>
Acked-by: Michal Hocko <mhocko@suse.com>
Cc: stable <stable@vger.kernel.org>
diff --git a/drivers/net/ethernet/atheros/atl1c/atl1c_main.c b/drivers/net/ethernet/atheros/atl1c/atl1c_main.c
index 2795d6d..8b5988e 100644
--- a/drivers/net/ethernet/atheros/atl1c/atl1c_main.c
+++ b/drivers/net/ethernet/atheros/atl1c/atl1c_main.c
@@ -1016,13 +1016,12 @@ static int atl1c_setup_ring_resources(struct atl1c_adapter *adapter)
sizeof(struct atl1c_recv_ret_status) * rx_desc_count +
8 * 4;
- ring_header->desc = pci_alloc_consistent(pdev, ring_header->size,
- &ring_header->dma);
+ ring_header->desc = dma_zalloc_coherent(&pdev->dev, ring_header->size,
+ &ring_header->dma, GFP_KERNEL);
if (unlikely(!ring_header->desc)) {
- dev_err(&pdev->dev, "pci_alloc_consistend failed\n");
+ dev_err(&pdev->dev, "could not get memory for DMA buffer\n");
goto err_nomem;
}
- memset(ring_header->desc, 0, ring_header->size);
/* init TPD ring */
tpd_ring[0].dma = roundup(ring_header->dma, 8);
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
^ permalink raw reply related [flat|nested] 51+ messages in thread
* [PATCH net] atl1c: Improve driver not to do order 4 GFP_ATOMIC allocation
@ 2015-12-04 8:50 ` Pavel Machek
0 siblings, 0 replies; 51+ messages in thread
From: Pavel Machek @ 2015-12-04 8:50 UTC (permalink / raw)
To: Michal Hocko, davem, Andrew Morton
Cc: kernel list, jcliburn, chris.snook, netdev, Rafael J. Wysocki,
linux-mm, nic-devel, ronangeles, ebiederm
atl1c driver is doing order-4 allocation with GFP_ATOMIC
priority. That often breaks networking after resume. Switch to
GFP_KERNEL. Still not ideal, but should be significantly better.
atl1c_setup_ring_resources() is called from .open() function, and
already uses GFP_KERNEL, so this change is safe.
Signed-off-by: Pavel Machek <pavel@ucw.cz>
Acked-by: Michal Hocko <mhocko@suse.com>
Cc: stable <stable@vger.kernel.org>
diff --git a/drivers/net/ethernet/atheros/atl1c/atl1c_main.c b/drivers/net/ethernet/atheros/atl1c/atl1c_main.c
index 2795d6d..8b5988e 100644
--- a/drivers/net/ethernet/atheros/atl1c/atl1c_main.c
+++ b/drivers/net/ethernet/atheros/atl1c/atl1c_main.c
@@ -1016,13 +1016,12 @@ static int atl1c_setup_ring_resources(struct atl1c_adapter *adapter)
sizeof(struct atl1c_recv_ret_status) * rx_desc_count +
8 * 4;
- ring_header->desc = pci_alloc_consistent(pdev, ring_header->size,
- &ring_header->dma);
+ ring_header->desc = dma_zalloc_coherent(&pdev->dev, ring_header->size,
+ &ring_header->dma, GFP_KERNEL);
if (unlikely(!ring_header->desc)) {
- dev_err(&pdev->dev, "pci_alloc_consistend failed\n");
+ dev_err(&pdev->dev, "could not get memory for DMA buffer\n");
goto err_nomem;
}
- memset(ring_header->desc, 0, ring_header->size);
/* init TPD ring */
tpd_ring[0].dma = roundup(ring_header->dma, 8);
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply related [flat|nested] 51+ messages in thread