From 2ab1ac2975e0e535cb8742c3cf88d21989850b65 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Wed, 8 Sep 2021 14:39:19 +0200 Subject: [PATCH] 5.10-stable patches added patches: mm-page_alloc-speed-up-the-iteration-of-max_order.patch net-ll_temac-remove-left-over-debug-message.patch usb-serial-mos7720-improve-oom-handling-in-read_mos_reg.patch --- ...-speed-up-the-iteration-of-max_order.patch | 73 +++++++++++++++++++ ...temac-remove-left-over-debug-message.patch | 31 ++++++++ queue-5.10/series | 3 + ...improve-oom-handling-in-read_mos_reg.patch | 51 +++++++++++++ 4 files changed, 158 insertions(+) create mode 100644 queue-5.10/mm-page_alloc-speed-up-the-iteration-of-max_order.patch create mode 100644 queue-5.10/net-ll_temac-remove-left-over-debug-message.patch create mode 100644 queue-5.10/usb-serial-mos7720-improve-oom-handling-in-read_mos_reg.patch diff --git a/queue-5.10/mm-page_alloc-speed-up-the-iteration-of-max_order.patch b/queue-5.10/mm-page_alloc-speed-up-the-iteration-of-max_order.patch new file mode 100644 index 00000000000..3e4d0c10ce0 --- /dev/null +++ b/queue-5.10/mm-page_alloc-speed-up-the-iteration-of-max_order.patch @@ -0,0 +1,73 @@ +From 7ad69832f37e3cea8557db6df7c793905f1135e8 Mon Sep 17 00:00:00 2001 +From: Muchun Song +Date: Mon, 14 Dec 2020 19:11:25 -0800 +Subject: mm/page_alloc: speed up the iteration of max_order + +From: Muchun Song + +commit 7ad69832f37e3cea8557db6df7c793905f1135e8 upstream. + +When we free a page whose order is very close to MAX_ORDER and greater +than pageblock_order, it wastes some CPU cycles to increase max_order to +MAX_ORDER one by one and check the pageblock migratetype of that page +repeatedly especially when MAX_ORDER is much larger than pageblock_order. + +We also should not be checking migratetype of buddy when "order == +MAX_ORDER - 1" as the buddy pfn may be invalid, so adjust the condition. +With the new check, we don't need the max_order check anymore, so we +replace it. + +Also adjust max_order initialization so that it's lower by one than +previously, which makes the code hopefully more clear. + +Link: https://lkml.kernel.org/r/20201204155109.55451-1-songmuchun@bytedance.com +Fixes: d9dddbf55667 ("mm/page_alloc: prevent merging between isolated and other pageblocks") +Signed-off-by: Muchun Song +Acked-by: Vlastimil Babka +Reviewed-by: Oscar Salvador +Reviewed-by: David Hildenbrand +Signed-off-by: Andrew Morton +Signed-off-by: Linus Torvalds +Signed-off-by: Greg Kroah-Hartman +--- + mm/page_alloc.c | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +--- a/mm/page_alloc.c ++++ b/mm/page_alloc.c +@@ -996,7 +996,7 @@ static inline void __free_one_page(struc + struct page *buddy; + bool to_tail; + +- max_order = min_t(unsigned int, MAX_ORDER, pageblock_order + 1); ++ max_order = min_t(unsigned int, MAX_ORDER - 1, pageblock_order); + + VM_BUG_ON(!zone_is_initialized(zone)); + VM_BUG_ON_PAGE(page->flags & PAGE_FLAGS_CHECK_AT_PREP, page); +@@ -1009,7 +1009,7 @@ static inline void __free_one_page(struc + VM_BUG_ON_PAGE(bad_range(zone, page), page); + + continue_merging: +- while (order < max_order - 1) { ++ while (order < max_order) { + if (compaction_capture(capc, page, order, migratetype)) { + __mod_zone_freepage_state(zone, -(1 << order), + migratetype); +@@ -1035,7 +1035,7 @@ continue_merging: + pfn = combined_pfn; + order++; + } +- if (max_order < MAX_ORDER) { ++ if (order < MAX_ORDER - 1) { + /* If we are here, it means order is >= pageblock_order. + * We want to prevent merge between freepages on isolate + * pageblock and normal pageblock. Without this, pageblock +@@ -1056,7 +1056,7 @@ continue_merging: + is_migrate_isolate(buddy_mt))) + goto done_merging; + } +- max_order++; ++ max_order = order + 1; + goto continue_merging; + } + diff --git a/queue-5.10/net-ll_temac-remove-left-over-debug-message.patch b/queue-5.10/net-ll_temac-remove-left-over-debug-message.patch new file mode 100644 index 00000000000..1c64075cff7 --- /dev/null +++ b/queue-5.10/net-ll_temac-remove-left-over-debug-message.patch @@ -0,0 +1,31 @@ +From ce03b94ba682a67e8233c9ee3066071656ded58f Mon Sep 17 00:00:00 2001 +From: Esben Haabendal +Date: Mon, 21 Jun 2021 10:20:08 +0200 +Subject: net: ll_temac: Remove left-over debug message + +From: Esben Haabendal + +commit ce03b94ba682a67e8233c9ee3066071656ded58f upstream. + +Fixes: f63963411942 ("net: ll_temac: Avoid ndo_start_xmit returning NETDEV_TX_BUSY") +Signed-off-by: Esben Haabendal +Signed-off-by: David S. Miller +Signed-off-by: Greg Kroah-Hartman +--- + drivers/net/ethernet/xilinx/ll_temac_main.c | 4 +--- + 1 file changed, 1 insertion(+), 3 deletions(-) + +--- a/drivers/net/ethernet/xilinx/ll_temac_main.c ++++ b/drivers/net/ethernet/xilinx/ll_temac_main.c +@@ -942,10 +942,8 @@ temac_start_xmit(struct sk_buff *skb, st + wmb(); + lp->dma_out(lp, TX_TAILDESC_PTR, tail_p); /* DMA start */ + +- if (temac_check_tx_bd_space(lp, MAX_SKB_FRAGS + 1)) { +- netdev_info(ndev, "%s -> netif_stop_queue\n", __func__); ++ if (temac_check_tx_bd_space(lp, MAX_SKB_FRAGS + 1)) + netif_stop_queue(ndev); +- } + + return NETDEV_TX_OK; + } diff --git a/queue-5.10/series b/queue-5.10/series index 5eda3658258..217ae7463d8 100644 --- a/queue-5.10/series +++ b/queue-5.10/series @@ -1 +1,4 @@ igmp-add-ip_mc_list-lock-in-ip_check_mc_rcu.patch +usb-serial-mos7720-improve-oom-handling-in-read_mos_reg.patch +net-ll_temac-remove-left-over-debug-message.patch +mm-page_alloc-speed-up-the-iteration-of-max_order.patch diff --git a/queue-5.10/usb-serial-mos7720-improve-oom-handling-in-read_mos_reg.patch b/queue-5.10/usb-serial-mos7720-improve-oom-handling-in-read_mos_reg.patch new file mode 100644 index 00000000000..68f10782614 --- /dev/null +++ b/queue-5.10/usb-serial-mos7720-improve-oom-handling-in-read_mos_reg.patch @@ -0,0 +1,51 @@ +From 161a582bd1d8681095f158d11bc679a58f1d026b Mon Sep 17 00:00:00 2001 +From: Tom Rix +Date: Mon, 11 Jan 2021 14:09:04 -0800 +Subject: USB: serial: mos7720: improve OOM-handling in read_mos_reg() + +From: Tom Rix + +commit 161a582bd1d8681095f158d11bc679a58f1d026b upstream. + +clang static analysis reports this problem + +mos7720.c:352:2: warning: Undefined or garbage value returned to caller + return d; + ^~~~~~~~ + +In the parport_mos7715_read_data()'s call to read_mos_reg(), 'd' is +only set after the alloc block. + + buf = kmalloc(1, GFP_KERNEL); + if (!buf) + return -ENOMEM; + +Although the problem is reported in parport_most7715_read_data(), +none of the callee's of read_mos_reg() check the return status. + +Make sure to clear the return-value buffer also on allocation failures. + +Fixes: 0d130367abf5 ("USB: serial: mos7720: fix control-message error handling") +Signed-off-by: Tom Rix +Link: https://lore.kernel.org/r/20210111220904.1035957-1-trix@redhat.com +[ johan: only clear the buffer on errors, amend commit message ] +Signed-off-by: Johan Hovold +Signed-off-by: Greg Kroah-Hartman +--- + drivers/usb/serial/mos7720.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +--- a/drivers/usb/serial/mos7720.c ++++ b/drivers/usb/serial/mos7720.c +@@ -226,8 +226,10 @@ static int read_mos_reg(struct usb_seria + int status; + + buf = kmalloc(1, GFP_KERNEL); +- if (!buf) ++ if (!buf) { ++ *data = 0; + return -ENOMEM; ++ } + + status = usb_control_msg(usbdev, pipe, request, requesttype, value, + index, buf, 1, MOS_WDR_TIMEOUT); -- 2.47.3