Skip to content

Commit 4706830

Browse files
leitaohtejun
authored andcommitted
sched_ext: Use kvzalloc for large exit_dump allocation
Replace kzalloc with kvzalloc for the exit_dump buffer allocation, which can require large contiguous memory depending on the implementation. This change prevents allocation failures by allowing the system to fall back to vmalloc when contiguous memory allocation fails. Since this buffer is only used for debugging purposes, physical memory contiguity is not required, making vmalloc a suitable alternative. Cc: stable@vger.kernel.org Fixes: 07814a9 ("sched_ext: Print debug dump after an error exit") Suggested-by: Rik van Riel <riel@surriel.com> Signed-off-by: Breno Leitao <leitao@debian.org> Acked-by: Andrea Righi <arighi@nvidia.com> Signed-off-by: Tejun Heo <tj@kernel.org>
1 parent 4a1d8ab commit 4706830

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

kernel/sched/ext.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4623,7 +4623,7 @@ static void scx_ops_bypass(bool bypass)
46234623

46244624
static void free_exit_info(struct scx_exit_info *ei)
46254625
{
4626-
kfree(ei->dump);
4626+
kvfree(ei->dump);
46274627
kfree(ei->msg);
46284628
kfree(ei->bt);
46294629
kfree(ei);
@@ -4639,7 +4639,7 @@ static struct scx_exit_info *alloc_exit_info(size_t exit_dump_len)
46394639

46404640
ei->bt = kcalloc(SCX_EXIT_BT_LEN, sizeof(ei->bt[0]), GFP_KERNEL);
46414641
ei->msg = kzalloc(SCX_EXIT_MSG_LEN, GFP_KERNEL);
4642-
ei->dump = kzalloc(exit_dump_len, GFP_KERNEL);
4642+
ei->dump = kvzalloc(exit_dump_len, GFP_KERNEL);
46434643

46444644
if (!ei->bt || !ei->msg || !ei->dump) {
46454645
free_exit_info(ei);

0 commit comments

Comments
 (0)