mailweb.openeuler.org
Manage this list

Keyboard Shortcuts

Thread View

  • j: Next unread message
  • k: Previous unread message
  • j a: Jump to all threads
  • j l: Jump to MailingList overview

Kernel

Threads by month
  • ----- 2025 -----
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2024 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2023 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2022 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2021 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2020 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2019 -----
  • December
kernel@openeuler.org

  • 50 participants
  • 19886 discussions
[openeuler:OLK-6.6 2687/2687] kernel/irq/proc.c:334:13: warning: no previous prototype for function 'register_irqchip_proc'
by kernel test robot 18 Aug '25

18 Aug '25
Hi Jinjie, FYI, the error/warning still remains. tree: https://gitee.com/openeuler/kernel.git OLK-6.6 head: dc90c923fed4944f134644261022885c12631518 commit: 3053668e6b211924bb67c19d791a5a532eca2ad8 [2687/2687] arm64: Introduce Xint software solution config: x86_64-buildonly-randconfig-2003-20250818 (https://download.01.org/0day-ci/archive/20250818/202508181343.zoaM9lG5-lkp@…) compiler: clang version 20.1.8 (https://github.com/llvm/llvm-project 87f0227cb60147a26a1eeb4fb06e3b505e9c7261) reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250818/202508181343.zoaM9lG5-lkp@…) If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot <lkp(a)intel.com> | Closes: https://lore.kernel.org/oe-kbuild-all/202508181343.zoaM9lG5-lkp@intel.com/ All warnings (new ones prefixed by >>): >> kernel/irq/proc.c:334:13: warning: no previous prototype for function 'register_irqchip_proc' [-Wmissing-prototypes] 334 | void __weak register_irqchip_proc(struct irq_desc *desc, void *irqp) { } | ^ kernel/irq/proc.c:334:1: note: declare 'static' if the function is not intended to be used outside of this translation unit 334 | void __weak register_irqchip_proc(struct irq_desc *desc, void *irqp) { } | ^ | static >> kernel/irq/proc.c:335:13: warning: no previous prototype for function 'unregister_irqchip_proc' [-Wmissing-prototypes] 335 | void __weak unregister_irqchip_proc(struct irq_desc *desc) { } | ^ kernel/irq/proc.c:335:1: note: declare 'static' if the function is not intended to be used outside of this translation unit 335 | void __weak unregister_irqchip_proc(struct irq_desc *desc) { } | ^ | static 2 warnings generated. vim +/register_irqchip_proc +334 kernel/irq/proc.c 333 > 334 void __weak register_irqchip_proc(struct irq_desc *desc, void *irqp) { } > 335 void __weak unregister_irqchip_proc(struct irq_desc *desc) { } 336 -- 0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
1 0
0 0
[openeuler:OLK-6.6 2687/2687] arch/x86/events/zhaoxin/uncore.c:2828:6: warning: no previous prototype for function 'kx7000_uncore_cpu_init'
by kernel test robot 18 Aug '25

18 Aug '25
Hi leoliu-oc, FYI, the error/warning still remains. tree: https://gitee.com/openeuler/kernel.git OLK-6.6 head: 57dc07b15d29507022f36882532a0fe229cf2805 commit: 25fd62f6e8c9636272009dfcbe04fb1a260cbf8d [2687/2687] perf/x86/zhaoxin/uncore: update KX-7000 support config: x86_64-buildonly-randconfig-2003-20250818 (https://download.01.org/0day-ci/archive/20250818/202508181149.ZQroekLv-lkp@…) compiler: clang version 20.1.8 (https://github.com/llvm/llvm-project 87f0227cb60147a26a1eeb4fb06e3b505e9c7261) reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250818/202508181149.ZQroekLv-lkp@…) If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot <lkp(a)intel.com> | Closes: https://lore.kernel.org/oe-kbuild-all/202508181149.ZQroekLv-lkp@intel.com/ All warnings (new ones prefixed by >>): In file included from arch/x86/events/zhaoxin/uncore.c:3: In file included from arch/x86/events/zhaoxin/uncore.h:3: In file included from include/linux/pci.h:1666: In file included from include/linux/dmapool.h:14: In file included from include/linux/scatterlist.h:8: In file included from include/linux/mm.h:2235: include/linux/vmstat.h:522:36: warning: arithmetic between different enumeration types ('enum node_stat_item' and 'enum lru_list') [-Wenum-enum-conversion] 522 | return node_stat_name(NR_LRU_BASE + lru) + 3; // skip "nr_" | ~~~~~~~~~~~ ^ ~~~ arch/x86/events/zhaoxin/uncore.c:2798:6: warning: no previous prototype for function 'kx5000_uncore_cpu_init' [-Wmissing-prototypes] 2798 | void kx5000_uncore_cpu_init(void) | ^ arch/x86/events/zhaoxin/uncore.c:2798:1: note: declare 'static' if the function is not intended to be used outside of this translation unit 2798 | void kx5000_uncore_cpu_init(void) | ^ | static arch/x86/events/zhaoxin/uncore.c:2807:6: warning: no previous prototype for function 'kh40000_uncore_cpu_init' [-Wmissing-prototypes] 2807 | void kh40000_uncore_cpu_init(void) | ^ arch/x86/events/zhaoxin/uncore.c:2807:1: note: declare 'static' if the function is not intended to be used outside of this translation unit 2807 | void kh40000_uncore_cpu_init(void) | ^ | static arch/x86/events/zhaoxin/uncore.c:2812:5: warning: no previous prototype for function 'kh40000_uncore_pci_init' [-Wmissing-prototypes] 2812 | int kh40000_uncore_pci_init(void) | ^ arch/x86/events/zhaoxin/uncore.c:2812:1: note: declare 'static' if the function is not intended to be used outside of this translation unit 2812 | int kh40000_uncore_pci_init(void) | ^ | static >> arch/x86/events/zhaoxin/uncore.c:2828:6: warning: no previous prototype for function 'kx7000_uncore_cpu_init' [-Wmissing-prototypes] 2828 | void kx7000_uncore_cpu_init(void) | ^ arch/x86/events/zhaoxin/uncore.c:2828:1: note: declare 'static' if the function is not intended to be used outside of this translation unit 2828 | void kx7000_uncore_cpu_init(void) | ^ | static >> arch/x86/events/zhaoxin/uncore.c:2843:5: warning: no previous prototype for function 'kx7000_uncore_pci_init' [-Wmissing-prototypes] 2843 | int kx7000_uncore_pci_init(void) | ^ arch/x86/events/zhaoxin/uncore.c:2843:1: note: declare 'static' if the function is not intended to be used outside of this translation unit 2843 | int kx7000_uncore_pci_init(void) | ^ | static >> arch/x86/events/zhaoxin/uncore.c:2851:6: warning: no previous prototype for function 'kx7000_uncore_mmio_init' [-Wmissing-prototypes] 2851 | void kx7000_uncore_mmio_init(void) | ^ arch/x86/events/zhaoxin/uncore.c:2851:1: note: declare 'static' if the function is not intended to be used outside of this translation unit 2851 | void kx7000_uncore_mmio_init(void) | ^ | static 7 warnings generated. vim +/kx7000_uncore_cpu_init +2828 arch/x86/events/zhaoxin/uncore.c 2827 > 2828 void kx7000_uncore_cpu_init(void) 2829 { 2830 u64 val; 2831 int cpu; 2832 2833 uncore_msr_uncores = kx7000_msr_uncores; 2834 2835 /* clear bit 16 of MSR 0x1877 so that HIF can work normally */ 2836 for_each_present_cpu(cpu) { 2837 rdmsrl_on_cpu(cpu, 0x1877, &val); 2838 val = val & 0xfffffffffffeffffULL; 2839 wrmsrl_on_cpu(cpu, 0x1877, val); 2840 } 2841 } 2842 > 2843 int kx7000_uncore_pci_init(void) 2844 { 2845 uncore_pci_uncores = kx7000_pci_uncores; 2846 uncore_pci_driver = &kx7000_uncore_pci_driver; 2847 2848 return 0; 2849 } 2850 > 2851 void kx7000_uncore_mmio_init(void) 2852 { 2853 uncore_mmio_uncores = kx7000_mmio_uncores; 2854 } 2855 -- 0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
1 0
0 0
[openeuler:OLK-6.6 2687/2687] kernel/power/swap.c:1573: warning: Excess function parameter 'exclusive' description in 'swsusp_close'
by kernel test robot 18 Aug '25

18 Aug '25
Hi Jan, FYI, the error/warning still remains. tree: https://gitee.com/openeuler/kernel.git OLK-6.6 head: 57dc07b15d29507022f36882532a0fe229cf2805 commit: 35143f27ceecf215984b938d1fe192e0e66e41b2 [2687/2687] PM: hibernate: Drop unused snapshot_test argument config: x86_64-buildonly-randconfig-2004-20250818 (https://download.01.org/0day-ci/archive/20250818/202508181142.iwn6mk8e-lkp@…) compiler: clang version 20.1.8 (https://github.com/llvm/llvm-project 87f0227cb60147a26a1eeb4fb06e3b505e9c7261) reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250818/202508181142.iwn6mk8e-lkp@…) If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot <lkp(a)intel.com> | Closes: https://lore.kernel.org/oe-kbuild-all/202508181142.iwn6mk8e-lkp@intel.com/ All warnings (new ones prefixed by >>): kernel/power/swap.c:544: warning: Function parameter or member 'handle' not described in 'save_image' kernel/power/swap.c:544: warning: Function parameter or member 'snapshot' not described in 'save_image' kernel/power/swap.c:544: warning: Function parameter or member 'nr_to_write' not described in 'save_image' kernel/power/swap.c:891: warning: Function parameter or member 'nr_pages' not described in 'enough_swap' kernel/power/swap.c:1062: warning: Function parameter or member 'handle' not described in 'load_image' kernel/power/swap.c:1062: warning: Function parameter or member 'snapshot' not described in 'load_image' kernel/power/swap.c:1062: warning: Function parameter or member 'nr_to_read' not described in 'load_image' >> kernel/power/swap.c:1573: warning: Excess function parameter 'exclusive' description in 'swsusp_close' vim +1573 kernel/power/swap.c 61159a314bca640 Rafael J. Wysocki 2006-03-23 1566 61159a314bca640 Rafael J. Wysocki 2006-03-23 1567 /** 61159a314bca640 Rafael J. Wysocki 2006-03-23 1568 * swsusp_close - close swap device. 40d84e198b0ae64 Chen Yu 2023-09-06 1569 * @exclusive: Close the resume device which is exclusively opened. 61159a314bca640 Rafael J. Wysocki 2006-03-23 1570 */ 61159a314bca640 Rafael J. Wysocki 2006-03-23 1571 35143f27ceecf21 Jan Kara 2023-11-30 1572 void swsusp_close(void) 61159a314bca640 Rafael J. Wysocki 2006-03-23 @1573 { 7f17d15e3e01aca Jan Kara 2023-11-30 1574 if (IS_ERR(hib_resume_bdev_handle)) { 64ec72a1ece37d9 Joe Perches 2017-09-27 1575 pr_debug("Image device not initialised\n"); 61159a314bca640 Rafael J. Wysocki 2006-03-23 1576 return; 61159a314bca640 Rafael J. Wysocki 2006-03-23 1577 } 61159a314bca640 Rafael J. Wysocki 2006-03-23 1578 7f17d15e3e01aca Jan Kara 2023-11-30 1579 bdev_release(hib_resume_bdev_handle); 61159a314bca640 Rafael J. Wysocki 2006-03-23 1580 } 1b29c1643c0d825 Vivek Goyal 2007-05-02 1581 :::::: The code at line 1573 was first introduced by commit :::::: 61159a314bca6408320c3173c1282c64f5cdaa76 [PATCH] swsusp: separate swap-writing/reading code :::::: TO: Rafael J. Wysocki <rjw(a)sisk.pl> :::::: CC: Linus Torvalds <torvalds(a)g5.osdl.org> -- 0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
1 0
0 0
[PATCH OLK-5.10] hugelb: do not sleep during spinlock hugetlb_lock
by Wupeng Ma 18 Aug '25

18 Aug '25
hulk inclusion category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/ICLL1L -------------------------------- Commit 539370f5231b ("hugetlb: drain pcp for movable zone before alloc") try to drain pcp memory during hugepage allocation, however flush_work called by __drain_all_pages may sleep during draining. Fix this by moving this before alloc_pool_huge_page which hugetlb_lock is already unlocked before page allocation. Fixes: 539370f5231b ("hugetlb: drain pcp for movable zone before alloc") Signed-off-by: Wupeng Ma <mawupeng1(a)huawei.com> --- mm/hugetlb.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/mm/hugetlb.c b/mm/hugetlb.c index 5307e9c2b0538..1369aeab88858 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -3035,6 +3035,7 @@ static int set_max_huge_pages(struct hstate *h, unsigned long count, int nid, struct page *page; LIST_HEAD(page_list); NODEMASK_ALLOC(nodemask_t, node_alloc_noretry, GFP_KERNEL); + bool drained = false; /* * Bit mask controlling how hard we retry per-node allocations. @@ -3109,14 +3110,6 @@ static int set_max_huge_pages(struct hstate *h, unsigned long count, int nid, break; } - /* - * drain pcp for movable zone to increase the success rate for - * hugetlb memory allocation if movable_node enabled - */ - if ((nid != NUMA_NO_NODE) && movable_node_is_enabled() && - count > persistent_huge_pages(h)) - hugetlb_drain_movable_pcp(h, nid); - while (count > persistent_huge_pages(h)) { /* * If this allocation races such that we no longer need the @@ -3128,6 +3121,16 @@ static int set_max_huge_pages(struct hstate *h, unsigned long count, int nid, /* yield cpu to avoid soft lockup */ cond_resched(); + /* + * drain pcp for movable zone to increase the success rate + * for hugetlb memory allocation if movable_node enabled + */ + if (!drained && (nid != NUMA_NO_NODE) && + movable_node_is_enabled()) { + hugetlb_drain_movable_pcp(h, nid); + drained = true; + } + ret = alloc_pool_huge_page(h, nodes_allowed, node_alloc_noretry); spin_lock_irq(&hugetlb_lock); -- 2.43.0
2 1
0 0
[PATCH OLK-6.6 0/5]Enhance soft hwpoison handling and injection
by Tong Tiangen 18 Aug '25

18 Aug '25
This series aim at the following enhancement - - Let one hwpoison injector, that is, madvise(MADV_HWPOISON) to behave more like as if a real UE occurred. Because the other two injectors such as hwpoison-inject and the 'einj' on x86 can't, and it seems to me we need a better simulation to real UE scenario. - For years, if the kernel is unable to unmap a hwpoisoned page, it send a SIGKILL instead of SIGBUS to prevent user process from potentially accessing the page again. But in doing so, the user process also lose important information: vaddr, for recovery. Fortunately, the kernel already has code to kill process re-accessing a hwpoisoned page, so remove the '!unmap_success' check. - Right now, if a thp page under GUP longterm pin is hwpoisoned, and kernel cannot split the thp page, memory-failure simply ignores the UE and returns. That's not ideal, it could deliver a SIGBUS with useful information for userspace recovery. Jane Chu (5): mm/memory-failure: try to send SIGBUS even if unmap failed mm/madvise: add MF_ACTION_REQUIRED to madvise(MADV_HWPOISON) mm/memory-failure: improve memory failure action_result messages mm/memory-failure: move hwpoison_filter() higher up mm/memory-failure: send SIGBUS in the event of thp split fail include/linux/mm.h | 2 + include/ras/ras_event.h | 2 + mm/madvise.c | 2 +- mm/memory-failure.c | 105 +++++++++++++++++++++++++++++----------- 4 files changed, 81 insertions(+), 30 deletions(-) -- 2.25.1
2 6
0 0
[openeuler:OLK-6.6 2687/2687] arch/x86/events/zhaoxin/uncore.c:2761:6: warning: no previous prototype for function 'kx5000_uncore_cpu_init'
by kernel test robot 18 Aug '25

18 Aug '25
Hi leoliu-oc, FYI, the error/warning still remains. tree: https://gitee.com/openeuler/kernel.git OLK-6.6 head: 08d6c0b8f95e9c676bd9bc28b12d198df722218e commit: dc5b97374ba722156acbdfc4e3adbc69e2dbe7f4 [2687/2687] perf/x86/zhaoxin/uncore: Add KX-7000 support config: x86_64-buildonly-randconfig-2003-20250818 (https://download.01.org/0day-ci/archive/20250818/202508180932.bKWZIbb7-lkp@…) compiler: clang version 20.1.8 (https://github.com/llvm/llvm-project 87f0227cb60147a26a1eeb4fb06e3b505e9c7261) reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250818/202508180932.bKWZIbb7-lkp@…) If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot <lkp(a)intel.com> | Closes: https://lore.kernel.org/oe-kbuild-all/202508180932.bKWZIbb7-lkp@intel.com/ All warnings (new ones prefixed by >>): In file included from arch/x86/events/zhaoxin/uncore.c:3: In file included from arch/x86/events/zhaoxin/uncore.h:3: In file included from include/linux/pci.h:1663: In file included from include/linux/dmapool.h:14: In file included from include/linux/scatterlist.h:8: In file included from include/linux/mm.h:2193: include/linux/vmstat.h:522:36: warning: arithmetic between different enumeration types ('enum node_stat_item' and 'enum lru_list') [-Wenum-enum-conversion] 522 | return node_stat_name(NR_LRU_BASE + lru) + 3; // skip "nr_" | ~~~~~~~~~~~ ^ ~~~ >> arch/x86/events/zhaoxin/uncore.c:2761:6: warning: no previous prototype for function 'kx5000_uncore_cpu_init' [-Wmissing-prototypes] 2761 | void kx5000_uncore_cpu_init(void) | ^ arch/x86/events/zhaoxin/uncore.c:2761:1: note: declare 'static' if the function is not intended to be used outside of this translation unit 2761 | void kx5000_uncore_cpu_init(void) | ^ | static >> arch/x86/events/zhaoxin/uncore.c:2770:6: warning: no previous prototype for function 'kh40000_uncore_cpu_init' [-Wmissing-prototypes] 2770 | void kh40000_uncore_cpu_init(void) | ^ arch/x86/events/zhaoxin/uncore.c:2770:1: note: declare 'static' if the function is not intended to be used outside of this translation unit 2770 | void kh40000_uncore_cpu_init(void) | ^ | static >> arch/x86/events/zhaoxin/uncore.c:2775:5: warning: no previous prototype for function 'kh40000_uncore_pci_init' [-Wmissing-prototypes] 2775 | int kh40000_uncore_pci_init(void) | ^ arch/x86/events/zhaoxin/uncore.c:2775:1: note: declare 'static' if the function is not intended to be used outside of this translation unit 2775 | int kh40000_uncore_pci_init(void) | ^ | static arch/x86/events/zhaoxin/uncore.c:2791:6: warning: no previous prototype for function 'kx8000_uncore_cpu_init' [-Wmissing-prototypes] 2791 | void kx8000_uncore_cpu_init(void) | ^ arch/x86/events/zhaoxin/uncore.c:2791:1: note: declare 'static' if the function is not intended to be used outside of this translation unit 2791 | void kx8000_uncore_cpu_init(void) | ^ | static arch/x86/events/zhaoxin/uncore.c:2796:5: warning: no previous prototype for function 'kx8000_uncore_pci_init' [-Wmissing-prototypes] 2796 | int kx8000_uncore_pci_init(void) | ^ arch/x86/events/zhaoxin/uncore.c:2796:1: note: declare 'static' if the function is not intended to be used outside of this translation unit 2796 | int kx8000_uncore_pci_init(void) | ^ | static arch/x86/events/zhaoxin/uncore.c:2804:6: warning: no previous prototype for function 'kx8000_uncore_mmio_init' [-Wmissing-prototypes] 2804 | void kx8000_uncore_mmio_init(void) | ^ arch/x86/events/zhaoxin/uncore.c:2804:1: note: declare 'static' if the function is not intended to be used outside of this translation unit 2804 | void kx8000_uncore_mmio_init(void) | ^ | static 7 warnings generated. vim +/kx5000_uncore_cpu_init +2761 arch/x86/events/zhaoxin/uncore.c 2760 > 2761 void kx5000_uncore_cpu_init(void) 2762 { 2763 uncore_msr_uncores = kx5000_msr_uncores; 2764 } 2765 2766 static const struct zhaoxin_uncore_init_fun kx5000_uncore_init __initconst = { 2767 .cpu_init = kx5000_uncore_cpu_init, 2768 }; 2769 > 2770 void kh40000_uncore_cpu_init(void) 2771 { 2772 uncore_msr_uncores = kh40000_msr_uncores; 2773 } 2774 > 2775 int kh40000_uncore_pci_init(void) 2776 { 2777 int ret = kh40000_pci2node_map_init();/*pci_bus to package mapping, do nothing*/ 2778 2779 if (ret) 2780 return ret; 2781 uncore_pci_uncores = kh40000_pci_uncores; 2782 uncore_pci_driver = &kh40000_uncore_pci_driver; 2783 return 0; 2784 } 2785 -- 0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
1 0
0 0
[openeuler:OLK-6.6 2687/2687] mm/madvise.c:297:6: warning: no previous prototype for function 'force_swapin_vma'
by kernel test robot 18 Aug '25

18 Aug '25
Hi Liu, FYI, the error/warning still remains. tree: https://gitee.com/openeuler/kernel.git OLK-6.6 head: 08d6c0b8f95e9c676bd9bc28b12d198df722218e commit: 92a0eb9bde6c03412b39f9f3d20968c091ea3b46 [2687/2687] memcg: introduce per-memcg swapin interface config: x86_64-buildonly-randconfig-2003-20250818 (https://download.01.org/0day-ci/archive/20250818/202508180823.hOEzzv8k-lkp@…) compiler: clang version 20.1.8 (https://github.com/llvm/llvm-project 87f0227cb60147a26a1eeb4fb06e3b505e9c7261) reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250818/202508180823.hOEzzv8k-lkp@…) If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot <lkp(a)intel.com> | Closes: https://lore.kernel.org/oe-kbuild-all/202508180823.hOEzzv8k-lkp@intel.com/ All warnings (new ones prefixed by >>): In file included from mm/madvise.c:9: In file included from include/linux/mman.h:5: In file included from include/linux/mm.h:2181: include/linux/vmstat.h:522:36: warning: arithmetic between different enumeration types ('enum node_stat_item' and 'enum lru_list') [-Wenum-enum-conversion] 522 | return node_stat_name(NR_LRU_BASE + lru) + 3; // skip "nr_" | ~~~~~~~~~~~ ^ ~~~ In file included from mm/madvise.c:21: include/linux/mm_inline.h:46:41: warning: arithmetic between different enumeration types ('enum node_stat_item' and 'enum lru_list') [-Wenum-enum-conversion] 46 | __mod_lruvec_state(lruvec, NR_LRU_BASE + lru, nr_pages); | ~~~~~~~~~~~ ^ ~~~ include/linux/mm_inline.h:48:22: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum lru_list') [-Wenum-enum-conversion] 48 | NR_ZONE_LRU_BASE + lru, nr_pages); | ~~~~~~~~~~~~~~~~ ^ ~~~ >> mm/madvise.c:297:6: warning: no previous prototype for function 'force_swapin_vma' [-Wmissing-prototypes] 297 | void force_swapin_vma(struct vm_area_struct *vma) | ^ mm/madvise.c:297:1: note: declare 'static' if the function is not intended to be used outside of this translation unit 297 | void force_swapin_vma(struct vm_area_struct *vma) | ^ | static 4 warnings generated. vim +/force_swapin_vma +297 mm/madvise.c 280 281 #ifdef CONFIG_MEMCG_SWAP_QOS 282 void force_swapin_vma(struct vm_area_struct *vma) 283 { 284 struct file *file = vma->vm_file; 285 286 if (!can_madv_lru_vma(vma)) 287 return; 288 289 if (!file) { 290 walk_page_vma(vma, &swapin_walk_ops, vma); 291 lru_add_drain(); 292 } else if (shmem_mapping(file->f_mapping)) 293 shmem_swapin_range(vma, vma->vm_start, 294 vma->vm_end, file->f_mapping); 295 } 296 #else > 297 void force_swapin_vma(struct vm_area_struct *vma) 298 { 299 } 300 #endif 301 -- 0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
1 0
0 0
[PATCH OLK-6.6] bpf: Reject %p% format string in bprintf-like helpers
by Pu Lehui 18 Aug '25

18 Aug '25
From: Paul Chaignon <paul.chaignon(a)gmail.com> stable inclusion from stable-v6.6.100 commit e7be679124bae8cf4fa6e40d7e1661baddfb3289 category: bugfix bugzilla: https://gitee.com/src-openeuler/kernel/issues/ICTB66 CVE: CVE-2025-38528 Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id… -------------------------------- [ Upstream commit f8242745871f81a3ac37f9f51853d12854fd0b58 ] static const char fmt[] = "%p%"; bpf_trace_printk(fmt, sizeof(fmt)); The above BPF program isn't rejected and causes a kernel warning at runtime: Please remove unsupported %\x00 in format string WARNING: CPU: 1 PID: 7244 at lib/vsprintf.c:2680 format_decode+0x49c/0x5d0 This happens because bpf_bprintf_prepare skips over the second %, detected as punctuation, while processing %p. This patch fixes it by not skipping over punctuation. %\x00 is then processed in the next iteration and rejected. Reported-by: syzbot+e2c932aec5c8a6e1d31c(a)syzkaller.appspotmail.com Fixes: 48cac3f4a96d ("bpf: Implement formatted output helpers with bstr_printf") Acked-by: Yonghong Song <yonghong.song(a)linux.dev> Signed-off-by: Paul Chaignon <paul.chaignon(a)gmail.com> Link: https://lore.kernel.org/r/a0e06cc479faec9e802ae51ba5d66420523251ee.17513954… Signed-off-by: Alexei Starovoitov <ast(a)kernel.org> Signed-off-by: Sasha Levin <sashal(a)kernel.org> Signed-off-by: Pu Lehui <pulehui(a)huawei.com> --- kernel/bpf/helpers.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/kernel/bpf/helpers.c b/kernel/bpf/helpers.c index 780905e24016..41f049ecb5c8 100644 --- a/kernel/bpf/helpers.c +++ b/kernel/bpf/helpers.c @@ -885,6 +885,13 @@ int bpf_bprintf_prepare(char *fmt, u32 fmt_size, const u64 *raw_args, if (fmt[i] == 'p') { sizeof_cur_arg = sizeof(long); + if (fmt[i + 1] == 0 || isspace(fmt[i + 1]) || + ispunct(fmt[i + 1])) { + if (tmp_buf) + cur_arg = raw_args[num_spec]; + goto nocopy_fmt; + } + if ((fmt[i + 1] == 'k' || fmt[i + 1] == 'u') && fmt[i + 2] == 's') { fmt_ptype = fmt[i + 1]; @@ -892,11 +899,9 @@ int bpf_bprintf_prepare(char *fmt, u32 fmt_size, const u64 *raw_args, goto fmt_str; } - if (fmt[i + 1] == 0 || isspace(fmt[i + 1]) || - ispunct(fmt[i + 1]) || fmt[i + 1] == 'K' || + if (fmt[i + 1] == 'K' || fmt[i + 1] == 'x' || fmt[i + 1] == 's' || fmt[i + 1] == 'S') { - /* just kernel pointers */ if (tmp_buf) cur_arg = raw_args[num_spec]; i++; -- 2.34.1
2 1
0 0
[PATCH openEuler-1.0-LTS V1] sched: Fix sched tunable parameter range overflow
by Cheng Yu 17 Aug '25

17 Aug '25
hulk inclusion category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/ICSER4 -------------------------------- When recalculating scheduler tunables during CPU hotplug(online/offline), we failed to check and constrain the tunnable parameters within their valid ranges. After repeated operations, this could cause parameters to overflow beyond limits. In extreme cases, sysctl_sched_min_granularity could become 0, which disrupts normal scheduler operation and leads to unexpected behavior. Furthermore, setting sysctl_sched_tunable_scaling when this condition exists triggers a division-by-zero error, resulting in a system crash. Fix this by adding proper range checks and constraints during the tunable recalculation process during CPU hotplug events. Fixes: 0bcdcf28c979 ("sched: Fix missing sched tunable recalculation on cpu add/remove") Signed-off-by: Cheng Yu <serein.chengyu(a)huawei.com> --- include/linux/sched/sysctl.h | 5 +++++ kernel/sched/fair.c | 14 +++++++++----- kernel/sysctl.c | 15 +++++++-------- 3 files changed, 21 insertions(+), 13 deletions(-) diff --git a/include/linux/sched/sysctl.h b/include/linux/sched/sysctl.h index ad472760e97d..8a428c10be46 100644 --- a/include/linux/sched/sysctl.h +++ b/include/linux/sched/sysctl.h @@ -32,6 +32,11 @@ extern unsigned int sysctl_sched_min_granularity; extern unsigned int sysctl_sched_wakeup_granularity; extern unsigned int sysctl_sched_child_runs_first; +extern unsigned int min_sched_granularity_ns; +extern unsigned int max_sched_granularity_ns; +extern unsigned int min_wakeup_granularity_ns; +extern unsigned int max_wakeup_granularity_ns; + #ifdef CONFIG_QOS_SCHED_DYNAMIC_AFFINITY extern int sysctl_sched_util_low_pct; #endif diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 4a357dce540c..87f905bfcf3e 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -193,11 +193,15 @@ static void update_sysctl(void) { unsigned int factor = get_update_sysctl_factor(); -#define SET_SYSCTL(name) \ - (sysctl_##name = (factor) * normalized_sysctl_##name) - SET_SYSCTL(sched_min_granularity); - SET_SYSCTL(sched_latency); - SET_SYSCTL(sched_wakeup_granularity); +#define SET_SYSCTL(name, min_val, max_val) \ + (sysctl_##name = clamp((factor) * normalized_sysctl_##name, \ + min_val, max_val)) + SET_SYSCTL(sched_min_granularity, + min_sched_granularity_ns, max_sched_granularity_ns); + SET_SYSCTL(sched_latency, + min_sched_granularity_ns, max_sched_granularity_ns); + SET_SYSCTL(sched_wakeup_granularity, + min_wakeup_granularity_ns, max_wakeup_granularity_ns); #undef SET_SYSCTL } diff --git a/kernel/sysctl.c b/kernel/sysctl.c index f64c4495bc54..0d1f07dc7b44 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c @@ -329,16 +329,15 @@ static struct ctl_table sysctl_base_table[] = { { } }; -#ifdef CONFIG_SCHED_DEBUG -static int min_sched_granularity_ns = 100000; /* 100 usecs */ -static int max_sched_granularity_ns = NSEC_PER_SEC; /* 1 second */ -static int min_wakeup_granularity_ns; /* 0 usecs */ -static int max_wakeup_granularity_ns = NSEC_PER_SEC; /* 1 second */ -#ifdef CONFIG_SMP +unsigned int min_sched_granularity_ns = 100000; /* 100 usecs */ +unsigned int max_sched_granularity_ns = NSEC_PER_SEC; /* 1 second */ +unsigned int min_wakeup_granularity_ns; /* 0 usecs */ +unsigned int max_wakeup_granularity_ns = NSEC_PER_SEC; /* 1 second */ + +#if defined(CONFIG_SCHED_DEBUG) && defined(CONFIG_SMP) static int min_sched_tunable_scaling = SCHED_TUNABLESCALING_NONE; static int max_sched_tunable_scaling = SCHED_TUNABLESCALING_END-1; -#endif /* CONFIG_SMP */ -#endif /* CONFIG_SCHED_DEBUG */ +#endif #ifdef CONFIG_COMPACTION static int min_extfrag_threshold; -- 2.25.1
2 1
0 0
[PATCH OLK-6.6 V1] sched: More flexible use of CPU quota when CPU is idle
by Cheng Yu 17 Aug '25

17 Aug '25
From: Zheng Zucheng <zhengzucheng(a)huawei.com> hulk inclusion category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/ICE7WC -------------------------------- This feature allows users to use CPU quota more flexibly when CPU is idle and it will cause the CPU quota to be exceeded. So, it cannot be used in scenarios where there are strict restrictions on the use of the CPU quota, such as some commercial scenarios that charge based on the use of CPU quota. Signed-off-by: Zheng Zucheng <zhengzucheng(a)huawei.com> Signed-off-by: Liao Chang <liaochang1(a)huawei.com> Signed-off-by: Cheng Yu <serein.chengyu(a)huawei.com> --- arch/arm64/Kconfig | 1 + arch/arm64/configs/openeuler_defconfig | 1 + arch/arm64/kernel/idle.c | 35 +++++- init/Kconfig | 18 +++ kernel/sched/core.c | 32 +++++ kernel/sched/fair.c | 168 +++++++++++++++++++++++-- kernel/sched/features.h | 4 + kernel/sched/idle.c | 7 ++ kernel/sched/sched.h | 15 +++ 9 files changed, 272 insertions(+), 9 deletions(-) diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig index b1f550c8c82a..3c8daac96773 100644 --- a/arch/arm64/Kconfig +++ b/arch/arm64/Kconfig @@ -106,6 +106,7 @@ config ARM64 select ARCH_SUPPORTS_INT128 if CC_HAS_INT128 select ARCH_SUPPORTS_NUMA_BALANCING select ARCH_SUPPORTS_SCHED_PARAL + select ARCH_SUPPORTS_SCHED_SOFT_QUOTA select ARCH_SUPPORTS_PAGE_TABLE_CHECK select ARCH_SUPPORTS_PER_VMA_LOCK select ARCH_WANT_BATCHED_UNMAP_TLB_FLUSH diff --git a/arch/arm64/configs/openeuler_defconfig b/arch/arm64/configs/openeuler_defconfig index 37c970407d37..4b8b1c4fa9f3 100644 --- a/arch/arm64/configs/openeuler_defconfig +++ b/arch/arm64/configs/openeuler_defconfig @@ -210,6 +210,7 @@ CONFIG_PID_NS=y CONFIG_NET_NS=y CONFIG_SCHED_STEAL=y CONFIG_SCHED_PARAL=y +CONFIG_SCHED_SOFT_QUOTA=y CONFIG_CHECKPOINT_RESTORE=y CONFIG_SCHED_AUTOGROUP=y CONFIG_RELAY=y diff --git a/arch/arm64/kernel/idle.c b/arch/arm64/kernel/idle.c index 46a40b693da8..31d9bfbe10b8 100644 --- a/arch/arm64/kernel/idle.c +++ b/arch/arm64/kernel/idle.c @@ -45,6 +45,26 @@ void noinstr arch_cpu_idle(void) } EXPORT_SYMBOL_GPL(arch_cpu_idle); +#ifdef CONFIG_SCHED_SOFT_QUOTA +static DEFINE_PER_CPU(int, sibling_idle) = 1; + +int is_sibling_idle(void) +{ + return this_cpu_read(sibling_idle); +} + +static void smt_measurement_begin(void) +{ +} + +static void smt_measurement_done(void) +{ +} +#else +static inline void smt_measurement_begin(void) { } +static inline void smt_measurement_done(void) { } +#endif + #ifdef CONFIG_ACTLR_XCALL_XINT struct arm_cpuidle_xcall_xint_context { unsigned long actlr_el1; @@ -57,6 +77,8 @@ void arch_cpu_idle_enter(void) { struct arm_cpuidle_xcall_xint_context *context; + smt_measurement_begin(); + if (!system_uses_xcall_xint()) return; @@ -71,6 +93,8 @@ void arch_cpu_idle_exit(void) { struct arm_cpuidle_xcall_xint_context *context; + smt_measurement_done(); + if (!system_uses_xcall_xint()) return; @@ -81,6 +105,13 @@ void arch_cpu_idle_exit(void) put_cpu_var(contexts); } #else -void arch_cpu_idle_enter(void) {} -void arch_cpu_idle_exit(void) {} +void arch_cpu_idle_enter(void) +{ + smt_measurement_begin(); +} + +void arch_cpu_idle_exit(void) +{ + smt_measurement_done(); +} #endif diff --git a/init/Kconfig b/init/Kconfig index 925e8517a7e8..2720083aaa17 100644 --- a/init/Kconfig +++ b/init/Kconfig @@ -1174,6 +1174,24 @@ config SCHED_SOFT_DOMAIN If in doubt, say N. +# +# For architectures that want to enable the support for SCHED_SOFT_QUOTA +# +config ARCH_SUPPORTS_SCHED_SOFT_QUOTA + bool + +config SCHED_SOFT_QUOTA + bool "More flexible use of CPU quota" + depends on ARCH_SUPPORTS_SCHED_SOFT_QUOTA + depends on CFS_BANDWIDTH + default n + help + This option allows users to use CPU quota more flexibly when CPU + is idle. It is better for users to have some understanding of + CFS_BANDWIDTH. It cannot be used in scenarios where there are strict + restrictions on the use of the CPU quota, such as some commercial + scenarios that charge based on the use of CPU quota. + config SCHED_MM_CID def_bool n depends on SMP && RSEQ diff --git a/kernel/sched/core.c b/kernel/sched/core.c index fab904f44c87..ba3cd68cbd03 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -11682,6 +11682,30 @@ static inline s64 cpu_qos_read(struct cgroup_subsys_state *css, } #endif +#ifdef CONFIG_SCHED_SOFT_QUOTA +static int cpu_soft_quota_write(struct cgroup_subsys_state *css, + struct cftype *cftype, s64 soft_quota) +{ + struct task_group *tg = css_tg(css); + + if (soft_quota != 1 && soft_quota != 0) + return -EINVAL; + + if (tg->soft_quota == soft_quota) + return 0; + + tg->soft_quota = soft_quota; + + return 0; +} + +static inline s64 cpu_soft_quota_read(struct cgroup_subsys_state *css, + struct cftype *cft) +{ + return css_tg(css)->soft_quota; +} +#endif + #ifdef CONFIG_BPF_SCHED void sched_settag(struct task_struct *tsk, s64 tag) { @@ -11928,6 +11952,14 @@ static struct cftype cpu_legacy_files[] = { .write_s64 = cpu_qos_write, }, #endif +#ifdef CONFIG_SCHED_SOFT_QUOTA + { + .name = "soft_quota", + .flags = CFTYPE_NOT_ON_ROOT, + .read_s64 = cpu_soft_quota_read, + .write_s64 = cpu_soft_quota_write, + }, +#endif #ifdef CONFIG_BPF_SCHED { .name = "tag", diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 99175318885c..89ce1269b474 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -190,6 +190,10 @@ unsigned int sysctl_qos_level_weights[5] = { static long qos_reweight(long shares, struct task_group *tg); #endif +#ifdef CONFIG_SCHED_SOFT_QUOTA +static DEFINE_PER_CPU_SHARED_ALIGNED(struct list_head, soft_quota_throttled_cfs_rq); +#endif + #ifdef CONFIG_CFS_BANDWIDTH /* * Amount of runtime to allocate from global (tg) to local (per-cfs_rq) pool @@ -223,6 +227,10 @@ extern unsigned int sysctl_smart_grid_strategy_ctrl; static int sysctl_affinity_adjust_delay_ms = 5000; #endif +#ifdef CONFIG_SCHED_SOFT_QUOTA +unsigned int sysctl_soft_runtime_ratio = 20; +#endif + #ifdef CONFIG_SYSCTL static struct ctl_table sched_fair_sysctls[] = { { @@ -322,6 +330,17 @@ static struct ctl_table sched_fair_sysctls[] = { .extra1 = SYSCTL_ZERO, .extra2 = &hundred_thousand, }, +#endif +#ifdef CONFIG_SCHED_SOFT_QUOTA + { + .procname = "sched_soft_runtime_ratio", + .data = &sysctl_soft_runtime_ratio, + .maxlen = sizeof(sysctl_soft_runtime_ratio), + .mode = 0644, + .proc_handler = proc_dointvec_minmax, + .extra1 = SYSCTL_ONE, + .extra2 = SYSCTL_ONE_HUNDRED, + }, #endif {} }; @@ -592,10 +611,11 @@ static inline struct sched_entity *parent_entity(const struct sched_entity *se) return se->parent; } -static void +static bool find_matching_se(struct sched_entity **se, struct sched_entity **pse) { int se_depth, pse_depth; + bool ret = false; /* * preemption test can be made between sibling entities who are in the @@ -609,6 +629,10 @@ find_matching_se(struct sched_entity **se, struct sched_entity **pse) pse_depth = (*pse)->depth; while (se_depth > pse_depth) { +#ifdef CONFIG_SCHED_SOFT_QUOTA + if (!ret && cfs_rq_of(*se)->soft_quota_enable == 1) + ret = true; +#endif se_depth--; *se = parent_entity(*se); } @@ -619,9 +643,15 @@ find_matching_se(struct sched_entity **se, struct sched_entity **pse) } while (!is_same_group(*se, *pse)) { +#ifdef CONFIG_SCHED_SOFT_QUOTA + if (!ret && cfs_rq_of(*se)->soft_quota_enable == 1) + ret = true; +#endif *se = parent_entity(*se); *pse = parent_entity(*pse); } + + return ret; } static int tg_is_idle(struct task_group *tg) @@ -667,9 +697,10 @@ static inline struct sched_entity *parent_entity(struct sched_entity *se) return NULL; } -static inline void +static inline bool find_matching_se(struct sched_entity **se, struct sched_entity **pse) { + return false; } static inline int tg_is_idle(struct task_group *tg) @@ -6030,6 +6061,14 @@ static bool throttle_cfs_rq(struct cfs_rq *cfs_rq) SCHED_WARN_ON(cfs_rq->throttled_clock); if (cfs_rq->nr_running) cfs_rq->throttled_clock = rq_clock(rq); + +#ifdef CONFIG_SCHED_SOFT_QUOTA + if (cfs_rq->tg->soft_quota == 1) { + list_add(&cfs_rq->soft_quota_throttled_list, + &per_cpu(soft_quota_throttled_cfs_rq, cpu_of(rq))); + } +#endif + return true; } @@ -6046,6 +6085,10 @@ void unthrottle_cfs_rq(struct cfs_rq *cfs_rq) se = cfs_rq->tg->se[cpu_of(rq)]; +#ifdef CONFIG_SCHED_SOFT_QUOTA + list_del_init(&cfs_rq->soft_quota_throttled_list); +#endif + #ifdef CONFIG_QOS_SCHED /* * if this cfs_rq throttled by qos, not need unthrottle it. @@ -6244,6 +6287,16 @@ static bool distribute_cfs_runtime(struct cfs_bandwidth *cfs_b) } rq_lock_irqsave(rq, &rf); + +#ifdef CONFIG_SCHED_SOFT_QUOTA + if (cfs_rq->soft_quota_enable == 1) { + if (cfs_rq->runtime_remaining > 0) + cfs_rq->runtime_remaining = 0; + + cfs_rq->soft_quota_enable = 0; + } +#endif + if (!cfs_rq_throttled(cfs_rq)) goto next; @@ -6306,6 +6359,17 @@ static bool distribute_cfs_runtime(struct cfs_bandwidth *cfs_b) return throttled; } +#ifdef CONFIG_SCHED_SOFT_QUOTA +static inline void init_tg_sum_soft_runtime(struct cfs_bandwidth *cfs_b) +{ + unsigned int cpu; + struct task_group *tg = container_of(cfs_b, struct task_group, cfs_bandwidth); + + for_each_possible_cpu(cpu) + tg->cfs_rq[cpu]->sum_soft_runtime = 0; +} +#endif + /* * Responsible for refilling a task_group's bandwidth and unthrottling its * cfs_rqs as appropriate. If there has been no activity within the last @@ -6323,6 +6387,10 @@ static int do_sched_cfs_period_timer(struct cfs_bandwidth *cfs_b, int overrun, u throttled = !list_empty(&cfs_b->throttled_cfs_rq); cfs_b->nr_periods += overrun; +#ifdef CONFIG_SCHED_SOFT_QUOTA + init_tg_sum_soft_runtime(cfs_b); +#endif + /* Refill extra burst quota even if cfs_b->idle */ __refill_cfs_bandwidth_runtime(cfs_b); @@ -6637,6 +6705,9 @@ static void init_cfs_rq_runtime(struct cfs_rq *cfs_rq) #ifdef CONFIG_QOS_SCHED INIT_LIST_HEAD(&cfs_rq->qos_throttled_list); #endif +#ifdef CONFIG_SCHED_SOFT_QUOTA + INIT_LIST_HEAD(&cfs_rq->soft_quota_throttled_list); +#endif } void start_cfs_bandwidth(struct cfs_bandwidth *cfs_b) @@ -9457,6 +9528,7 @@ static void check_preempt_wakeup(struct rq *rq, struct task_struct *p, int wake_ struct cfs_rq *cfs_rq = task_cfs_rq(curr); int next_buddy_marked = 0; int cse_is_idle, pse_is_idle; + bool ret = 0; if (unlikely(se == pse)) return; @@ -9491,7 +9563,12 @@ static void check_preempt_wakeup(struct rq *rq, struct task_struct *p, int wake_ if (!sched_feat(WAKEUP_PREEMPTION)) return; - find_matching_se(&se, &pse); + ret = find_matching_se(&se, &pse); +#ifdef CONFIG_SCHED_SOFT_QUOTA + if (ret) + goto preempt; +#endif + WARN_ON_ONCE(!pse); cse_is_idle = se_is_idle(se); @@ -14982,6 +15059,9 @@ void unregister_fair_sched_group(struct task_group *tg) unsigned long flags; struct rq *rq; int cpu; +#ifdef CONFIG_SCHED_SOFT_QUOTA + struct cfs_rq *cfs_rq; +#endif destroy_cfs_bandwidth(tg_cfs_bandwidth(tg)); destroy_auto_affinity(tg); @@ -14991,10 +15071,16 @@ void unregister_fair_sched_group(struct task_group *tg) if (tg->se[cpu]) remove_entity_load_avg(tg->se[cpu]); - #ifdef CONFIG_QOS_SCHED - if (tg->cfs_rq && tg->cfs_rq[cpu]) - unthrottle_qos_sched_group(tg->cfs_rq[cpu]); - #endif +#ifdef CONFIG_QOS_SCHED + if (tg->cfs_rq && tg->cfs_rq[cpu]) + unthrottle_qos_sched_group(tg->cfs_rq[cpu]); +#endif +#ifdef CONFIG_SCHED_SOFT_QUOTA + if (tg->cfs_rq && tg->cfs_rq[cpu]) { + cfs_rq = tg->cfs_rq[cpu]; + list_del_init(&cfs_rq->soft_quota_throttled_list); + } +#endif /* * Only empty task groups can be destroyed; so we can speculatively @@ -15309,6 +15395,11 @@ __init void init_sched_fair_class(void) INIT_LIST_HEAD(&per_cpu(qos_throttled_cfs_rq, i)); #endif +#ifdef CONFIG_SCHED_SOFT_QUOTA + for_each_possible_cpu(i) + INIT_LIST_HEAD(&per_cpu(soft_quota_throttled_cfs_rq, i)); +#endif + open_softirq(SCHED_SOFTIRQ, run_rebalance_domains); #ifdef CONFIG_NO_HZ_COMMON @@ -15319,3 +15410,66 @@ __init void init_sched_fair_class(void) #endif /* SMP */ } + +#ifdef CONFIG_SCHED_SOFT_QUOTA +static bool check_soft_runtime(struct task_group *tg, int slice) +{ + int cpu; + u64 sum_soft_runtime = slice; + struct cfs_bandwidth *cfs_b = &tg->cfs_bandwidth; + + if (cfs_b->quota == RUNTIME_INF) + return true; + + for_each_possible_cpu(cpu) + sum_soft_runtime += tg->cfs_rq[cpu]->sum_soft_runtime; + + return sum_soft_runtime < sysctl_soft_runtime_ratio * cfs_b->quota / 100; +} + +int __weak is_sibling_idle(void) +{ + return 0; +} + +bool unthrottle_cfs_rq_soft_quota(struct rq *rq) +{ + int max_cnt = 0; + bool ret = false; + struct cfs_rq *cfs_rq, *tmp_rq; + struct cfs_bandwidth *cfs_b; + int slice = sched_cfs_bandwidth_slice(); + + if (!is_sibling_idle()) + return ret; + + list_for_each_entry_safe(cfs_rq, tmp_rq, &per_cpu(soft_quota_throttled_cfs_rq, cpu_of(rq)), + soft_quota_throttled_list) { + if (max_cnt++ > 20) + break; + + if (cfs_rq->throttled) { + cfs_b = tg_cfs_bandwidth(cfs_rq->tg); + raw_spin_lock(&cfs_b->lock); + + if (!check_soft_runtime(cfs_rq->tg, slice)) { + raw_spin_unlock(&cfs_b->lock); + continue; + } + + raw_spin_unlock(&cfs_b->lock); + + if (cfs_rq->runtime_remaining + slice > 0) { + cfs_rq->runtime_remaining += slice; + cfs_rq->sum_soft_runtime += slice; + cfs_rq->soft_quota_enable = 1; + unthrottle_cfs_rq(cfs_rq); + ret = true; + break; + } + } + } + + return ret; +} +#endif diff --git a/kernel/sched/features.h b/kernel/sched/features.h index 67939d04542f..b95797360dd6 100644 --- a/kernel/sched/features.h +++ b/kernel/sched/features.h @@ -114,3 +114,7 @@ SCHED_FEAT(DA_UTIL_TASKGROUP, true) #ifdef CONFIG_SCHED_SOFT_DOMAIN SCHED_FEAT(SOFT_DOMAIN, false) #endif + +#ifdef CONFIG_SCHED_SOFT_QUOTA +SCHED_FEAT(SOFT_QUOTA, false) +#endif diff --git a/kernel/sched/idle.c b/kernel/sched/idle.c index 5007b25c5bc6..3518a1a28e8c 100644 --- a/kernel/sched/idle.c +++ b/kernel/sched/idle.c @@ -427,6 +427,13 @@ struct task_struct *pick_next_task_idle(struct rq *rq) { struct task_struct *next = rq->idle; +#ifdef CONFIG_SCHED_SOFT_QUOTA + if (sched_feat(SOFT_QUOTA)) { + if (unthrottle_cfs_rq_soft_quota(rq) && rq->cfs.nr_running) + return pick_next_task_fair(rq, NULL, NULL); + } +#endif + set_next_task_idle(rq, next, true); return next; diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h index f6a3f93d1f75..0e21ad151ec9 100644 --- a/kernel/sched/sched.h +++ b/kernel/sched/sched.h @@ -484,7 +484,11 @@ struct task_group { #else KABI_RESERVE(1) #endif +#ifdef CONFIG_SCHED_SOFT_QUOTA + KABI_USE(2, u64 soft_quota) +#else KABI_RESERVE(2) +#endif KABI_RESERVE(3) KABI_RESERVE(4) KABI_RESERVE(5) @@ -578,6 +582,10 @@ static inline void tg_update_affinity_domains(int cpu, int online) {} static inline void offline_auto_affinity(struct task_group *tg) { } #endif +#ifdef CONFIG_SCHED_SOFT_QUOTA +extern bool unthrottle_cfs_rq_soft_quota(struct rq *rq); +#endif + #ifdef CONFIG_FAIR_GROUP_SCHED extern int sched_group_set_shares(struct task_group *tg, unsigned long shares); @@ -769,10 +777,17 @@ struct cfs_rq { unsigned long qos_idle_h_nr_running_padding; }; #endif +#ifdef CONFIG_SCHED_SOFT_QUOTA + KABI_USE(1, u64 soft_quota_enable) + KABI_USE(2, u64 sum_soft_runtime) + KABI_REPLACE(_KABI_RESERVE(3); _KABI_RESERVE(4), + struct list_head soft_quota_throttled_list) +#else KABI_RESERVE(1) KABI_RESERVE(2) KABI_RESERVE(3) KABI_RESERVE(4) +#endif KABI_RESERVE(5) KABI_RESERVE(6) KABI_RESERVE(7) -- 2.25.1
2 1
0 0
  • ← Newer
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • ...
  • 1989
  • Older →

HyperKitty Powered by HyperKitty