hulk inclusion
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I7ZMCB
CVE: NA
--------------------------------
CPU hotplug callbacks race against distribute_cfs_runtime(),
when the QOS_SCHED feature is enabled, there may be
situations where the cfs_rq-> runtime_remaining == 1
and cfs_rq is QOS_THROTTLED.
Turn off the Qos_throttle when the CPU is offline.
No longer allocate time to cfs_rq in this scenario to fix the warning.
Fixes: fbea24f5894e ("sched/qos: Don't unthrottle cfs_rq when cfs_rq is throttled by qos")
Signed-off-by: Xia Fukun <xiafukun(a)huawei.com>
---
kernel/sched/fair.c | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index e9afb1e6ca4c..1c78e2f29901 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -4783,6 +4783,19 @@ static u64 distribute_cfs_runtime(struct cfs_bandwidth *cfs_b, u64 remaining)
if (!cfs_rq_throttled(cfs_rq))
goto next;
+ /*
+ * CPU hotplug callbacks race against distribute_cfs_runtime()
+ * when the QOS_SCHED feature is enabled, there may be
+ * situations where the runtime_remaining > 0.
+ * Qos_sched does not care whether the cfs_rq has time left,
+ * so no longer allocate time to cfs_rq in this scenario.
+ */
+#ifdef CONFIG_QOS_SCHED
+ if (cfs_rq->throttled == QOS_THROTTLED &&
+ cfs_rq->runtime_remaining > 0)
+ goto next;
+#endif
+
/* By the above check, this should never be true */
SCHED_WARN_ON(cfs_rq->runtime_remaining > 0);
@@ -7754,6 +7767,10 @@ static bool check_qos_cfs_rq(struct cfs_rq *cfs_rq)
if (unlikely(cfs_rq && cfs_rq->tg->qos_level < 0 &&
!sched_idle_cpu(smp_processor_id()) &&
cfs_rq->h_nr_running == cfs_rq->idle_h_nr_running)) {
+
+ if (!rq_of(cfs_rq)->online)
+ return false;
+
throttle_qos_cfs_rq(cfs_rq);
return true;
}
--
2.34.1
hulk inclusion
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I81E6X
---------------------------------------------
Build the kernel Image out of the srctree with the following command:
$ mkdir build
$ cd build
$ make -C ../ O=`pwd` openeuler_defconfig
$ make Image -j64
would get the following error message:
../Makefile:1315: Makefile.oever: No such file or directory
make: *** No rule to make target 'Makefile.oever'. Stop.
Add a directory path for the included file to fix this.
Fixes: 0177b043eb4e ("kernel: add OPENEULER_VERSION_CODE to version.h")
Signed-off-by: Wang Wensheng <wangwensheng4(a)huawei.com>
---
Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Makefile b/Makefile
index 5b2b3ad42a2d..5061718274f0 100644
--- a/Makefile
+++ b/Makefile
@@ -1312,7 +1312,7 @@ uapi-asm-generic:
# ---------------------------------------------------------------------------
# openEuler version variables
-include Makefile.oever
+include $(srctree)/Makefile.oever
# KERNELRELEASE can change from a few different places, meaning version.h
# needs to be updated, so this check is forced on all builds
--
2.17.1
From: Sergey Senozhatsky <senozhatsky(a)chromium.org>
mainline inclusion
from mainline-v6.1-rc1
commit f635725c3905e755a8c3e2dc8cab7fcd0d38977f
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I7TWVA
CVE: NA
Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id…
-------------------------------------------
zram_table_entry::flags stores object size in the lower bits and zram
pageflags in the upper bits. However, for some reason, we use 24 lower
bits, while maximum zram object size is PAGE_SIZE, which requires
PAGE_SHIFT bits (up to 16 on arm64). This wastes 24 - PAGE_SHIFT bits
that we can use for additional zram pageflags instead.
Also add a BUILD_BUG_ON() to alert us should we run out of bits in
zram_table_entry::flags.
Link: https://lkml.kernel.org/r/20220912152744.527438-1-senozhatsky@chromium.org
Signed-off-by: Sergey Senozhatsky <senozhatsky(a)chromium.org>
Reviewed-by: Brian Geffon <bgeffon(a)google.com>
Acked-by: Minchan Kim <minchan(a)kernel.org>
Cc: Nitin Gupta <ngupta(a)vflare.org>
Signed-off-by: Andrew Morton <akpm(a)linux-foundation.org>
---
drivers/block/zram/zram_drv.c | 2 ++
drivers/block/zram/zram_drv.h | 15 +++++++--------
2 files changed, 9 insertions(+), 8 deletions(-)
diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c
index 24a5f892d64d..e332b4d55359 100644
--- a/drivers/block/zram/zram_drv.c
+++ b/drivers/block/zram/zram_drv.c
@@ -2591,6 +2591,8 @@ static int __init zram_init(void)
{
int ret;
+ BUILD_BUG_ON(__NR_ZRAM_PAGEFLAGS > BITS_PER_LONG);
+
ret = cpuhp_setup_state_multi(CPUHP_ZCOMP_PREPARE, "block/zram:prepare",
zcomp_cpu_up_prepare, zcomp_cpu_dead);
if (ret < 0)
diff --git a/drivers/block/zram/zram_drv.h b/drivers/block/zram/zram_drv.h
index b5b94e6b6ec8..eb13d0299f89 100644
--- a/drivers/block/zram/zram_drv.h
+++ b/drivers/block/zram/zram_drv.h
@@ -30,16 +30,15 @@
/*
- * The lower ZRAM_FLAG_SHIFT bits of table.flags is for
- * object size (excluding header), the higher bits is for
- * zram_pageflags.
+ * ZRAM is mainly used for memory efficiency so we want to keep memory
+ * footprint small and thus squeeze size and zram pageflags into a flags
+ * member. The lower ZRAM_FLAG_SHIFT bits is for object size (excluding
+ * header), which cannot be larger than PAGE_SIZE (requiring PAGE_SHIFT
+ * bits), the higher bits are for zram_pageflags.
*
- * zram is mainly used for memory efficiency so we want to keep memory
- * footprint small so we can squeeze size and flags into a field.
- * The lower ZRAM_FLAG_SHIFT bits is for object size (excluding header),
- * the higher bits is for zram_pageflags.
+ * We use BUILD_BUG_ON() to make sure that zram pageflags don't overflow.
*/
-#define ZRAM_FLAG_SHIFT 24
+#define ZRAM_FLAG_SHIFT (PAGE_SHIFT + 1)
/* Only 2 bits are allowed for comp priority index */
#define ZRAM_COMP_PRIORITY_MASK 0x3
--
2.25.1