Changeset c626117 in mainline for kernel/generic/src/mm/frame.c


Ignore:
Timestamp:
2025-04-10T17:31:25Z (5 days ago)
Author:
Jiří Zárevúcky <zarevucky.jiri@…>
Branches:
master
Children:
9f2f5ee
Parents:
0b47781
git-author:
Jiří Zárevúcky <zarevucky.jiri@…> (2025-04-10 16:34:47)
git-committer:
Jiří Zárevúcky <zarevucky.jiri@…> (2025-04-10 17:31:25)
Message:

Replace uses of MUTEX_ACTIVE with irq_spinlock_t

File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/src/mm/frame.c

    r0b47781 rc626117  
    7272 * available.
    7373 */
    74 static MUTEX_INITIALIZE(mem_avail_mtx, MUTEX_ACTIVE);
     74static IRQ_SPINLOCK_INITIALIZE(mem_avail_lock);
    7575static CONDVAR_INITIALIZE(mem_avail_cv);
    7676static size_t mem_avail_req = 0;  /**< Number of frames requested. */
     
    951951#endif
    952952
    953                 /*
    954                  * Since the mem_avail_mtx is an active mutex, we need to
    955                  * disable interrupts to prevent deadlock with TLB shootdown.
    956                  */
    957                 ipl_t ipl = interrupts_disable();
    958                 mutex_lock(&mem_avail_mtx);
     953                /* Disabled interrupts needed to prevent deadlock with TLB shootdown. */
     954                irq_spinlock_lock(&mem_avail_lock, true);
    959955
    960956                if (mem_avail_req > 0)
     
    966962
    967963                while (gen == mem_avail_gen)
    968                         condvar_wait(&mem_avail_cv, &mem_avail_mtx);
    969 
    970                 mutex_unlock(&mem_avail_mtx);
    971                 interrupts_restore(ipl);
     964                        condvar_wait(&mem_avail_cv, &mem_avail_lock);
     965
     966                irq_spinlock_unlock(&mem_avail_lock, true);
    972967
    973968#ifdef CONFIG_DEBUG
     
    10271022        irq_spinlock_unlock(&zones.lock, true);
    10281023
    1029         /*
    1030          * Signal that some memory has been freed.
    1031          * Since the mem_avail_mtx is an active mutex,
    1032          * we need to disable interruptsto prevent deadlock
    1033          * with TLB shootdown.
    1034          */
    1035 
    1036         ipl_t ipl = interrupts_disable();
    1037         mutex_lock(&mem_avail_mtx);
     1024        /* Signal that some memory has been freed. */
     1025
     1026        /* Disabled interrupts needed to prevent deadlock with TLB shootdown. */
     1027        irq_spinlock_lock(&mem_avail_lock, true);
    10381028
    10391029        if (mem_avail_req > 0)
     
    10451035        }
    10461036
    1047         mutex_unlock(&mem_avail_mtx);
    1048         interrupts_restore(ipl);
     1037        irq_spinlock_unlock(&mem_avail_lock, true);
    10491038
    10501039        if (!(flags & FRAME_NO_RESERVE))
Note: See TracChangeset for help on using the changeset viewer.