|
5 | 5 | //! C header: [`include/drm/gpu_scheduler.h`](../../../../include/drm/gpu_scheduler.h) |
6 | 6 |
|
7 | 7 | use crate::{ |
| 8 | + alloc::{box_ext::BoxExt, flags::*}, |
8 | 9 | bindings, device, |
9 | 10 | dma_fence::*, |
10 | 11 | error::{to_result, Result}, |
@@ -245,7 +246,8 @@ pub struct Entity<T: JobImpl>(Pin<Box<EntityInner<T>>>); |
245 | 246 | impl<T: JobImpl> Entity<T> { |
246 | 247 | /// Create a new scheduler entity. |
247 | 248 | pub fn new(sched: &Scheduler<T>, priority: Priority) -> Result<Self> { |
248 | | - let mut entity: Box<MaybeUninit<EntityInner<T>>> = Box::try_new_zeroed()?; |
| 249 | + let mut entity: Box<MaybeUninit<EntityInner<T>>> = |
| 250 | + Box::new_uninit(GFP_KERNEL | __GFP_ZERO)?; |
249 | 251 |
|
250 | 252 | let mut sched_ptr = &sched.0.sched as *const _ as *mut _; |
251 | 253 |
|
@@ -274,7 +276,7 @@ impl<T: JobImpl> Entity<T> { |
274 | 276 | /// this requires a mutable reference to the entity, ensuring that only one new job can be |
275 | 277 | /// in flight at once. |
276 | 278 | pub fn new_job(&mut self, credits: u32, inner: T) -> Result<PendingJob<'_, T>> { |
277 | | - let mut job: Box<MaybeUninit<Job<T>>> = Box::try_new_zeroed()?; |
| 279 | + let mut job: Box<MaybeUninit<Job<T>>> = Box::new_uninit(GFP_KERNEL | __GFP_ZERO)?; |
278 | 280 |
|
279 | 281 | // SAFETY: We hold a reference to the entity (which is a valid pointer), |
280 | 282 | // and the job object was just allocated above. |
@@ -335,7 +337,8 @@ impl<T: JobImpl> Scheduler<T> { |
335 | 337 | timeout_ms: usize, |
336 | 338 | name: &'static CStr, |
337 | 339 | ) -> Result<Scheduler<T>> { |
338 | | - let mut sched: UniqueArc<MaybeUninit<SchedulerInner<T>>> = UniqueArc::try_new_uninit()?; |
| 340 | + let mut sched: UniqueArc<MaybeUninit<SchedulerInner<T>>> = |
| 341 | + UniqueArc::new_uninit(GFP_KERNEL)?; |
339 | 342 |
|
340 | 343 | // SAFETY: zero sched->sched_rq as drm_sched_init() uses it to exit early withoput initialisation |
341 | 344 | // TODO: allocate sched zzeroed instead |
|
0 commit comments