函数源码

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source File:kernel\kexec_file.c Create Date:2022-07-27 12:05:45
首页 Copyright©Brick

531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
static int locate_mem_hole_callback(struct resource *res, void *arg)
{
    struct kexec_buf *kbuf = (struct kexec_buf *)arg;
    u64 start = res->start, end = res->end;
    unsigned long sz = end - start + 1;
 
    /* Returning 0 will take to next memory range */
    if (sz < kbuf->memsz)
        return 0;
 
    if (end < kbuf->buf_min || start > kbuf->buf_max)
        return 0;
 
    /*
     * Allocate memory top down with-in ram range. Otherwise bottom up
     * allocation.
     */
    if (kbuf->top_down)
        return locate_mem_hole_top_down(start, end, kbuf);
    return locate_mem_hole_bottom_up(start, end, kbuf);
}