mtd: fix build with GCC 14
[openwrt/openwrt.git] / target / linux / generic / backport-5.15 / 795-v6.3-06-r8152-Add-__GFP_NOWARN-to-big-allocations.patch
1 From 5cc33f139e11b893ff6dc60d8a0ae865a65521ac Mon Sep 17 00:00:00 2001
2 From: Douglas Anderson <dianders@chromium.org>
3 Date: Thu, 6 Apr 2023 17:14:26 -0700
4 Subject: [PATCH] r8152: Add __GFP_NOWARN to big allocations
5
6 When memory is a little tight on my system, it's pretty easy to see
7 warnings that look like this.
8
9 ksoftirqd/0: page allocation failure: order:3, mode:0x40a20(GFP_ATOMIC|__GFP_COMP), nodemask=(null),cpuset=/,mems_allowed=0
10 ...
11 Call trace:
12 dump_backtrace+0x0/0x1e8
13 show_stack+0x20/0x2c
14 dump_stack_lvl+0x60/0x78
15 dump_stack+0x18/0x38
16 warn_alloc+0x104/0x174
17 __alloc_pages+0x588/0x67c
18 alloc_rx_agg+0xa0/0x190 [r8152 ...]
19 r8152_poll+0x270/0x760 [r8152 ...]
20 __napi_poll+0x44/0x1ec
21 net_rx_action+0x100/0x300
22 __do_softirq+0xec/0x38c
23 run_ksoftirqd+0x38/0xec
24 smpboot_thread_fn+0xb8/0x248
25 kthread+0x134/0x154
26 ret_from_fork+0x10/0x20
27
28 On a fragmented system it's normal that order 3 allocations will
29 sometimes fail, especially atomic ones. The driver handles these
30 failures fine and the WARN just creates spam in the logs for this
31 case. The __GFP_NOWARN flag is exactly for this situation, so add it
32 to the allocation.
33
34 NOTE: my testing is on a 5.15 system, but there should be no reason
35 that this would be fundamentally different on a mainline kernel.
36
37 Signed-off-by: Douglas Anderson <dianders@chromium.org>
38 Acked-by: Hayes Wang <hayeswang@realtek.com>
39 Link: https://lore.kernel.org/r/20230406171411.1.I84dbef45786af440fd269b71e9436a96a8e7a152@changeid
40 Signed-off-by: Jakub Kicinski <kuba@kernel.org>
41 ---
42 drivers/net/usb/r8152.c | 2 +-
43 1 file changed, 1 insertion(+), 1 deletion(-)
44
45 --- a/drivers/net/usb/r8152.c
46 +++ b/drivers/net/usb/r8152.c
47 @@ -1944,7 +1944,7 @@ static struct rx_agg *alloc_rx_agg(struc
48 if (!rx_agg)
49 return NULL;
50
51 - rx_agg->page = alloc_pages(mflags | __GFP_COMP, order);
52 + rx_agg->page = alloc_pages(mflags | __GFP_COMP | __GFP_NOWARN, order);
53 if (!rx_agg->page)
54 goto free_rx;
55