Changes in kernel/generic/src/mm/frame.c [c626117:597fa24] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/src/mm/frame.c
rc626117 r597fa24 72 72 * available. 73 73 */ 74 static IRQ_SPINLOCK_INITIALIZE(mem_avail_lock);74 static MUTEX_INITIALIZE(mem_avail_mtx, MUTEX_ACTIVE); 75 75 static CONDVAR_INITIALIZE(mem_avail_cv); 76 76 static size_t mem_avail_req = 0; /**< Number of frames requested. */ … … 951 951 #endif 952 952 953 /* Disabled interrupts needed to prevent deadlock with TLB shootdown. */ 954 irq_spinlock_lock(&mem_avail_lock, true); 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); 955 959 956 960 if (mem_avail_req > 0) … … 962 966 963 967 while (gen == mem_avail_gen) 964 condvar_wait(&mem_avail_cv, &mem_avail_lock); 965 966 irq_spinlock_unlock(&mem_avail_lock, true); 968 condvar_wait(&mem_avail_cv, &mem_avail_mtx); 969 970 mutex_unlock(&mem_avail_mtx); 971 interrupts_restore(ipl); 967 972 968 973 #ifdef CONFIG_DEBUG … … 1022 1027 irq_spinlock_unlock(&zones.lock, true); 1023 1028 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); 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); 1028 1038 1029 1039 if (mem_avail_req > 0) … … 1035 1045 } 1036 1046 1037 irq_spinlock_unlock(&mem_avail_lock, true); 1047 mutex_unlock(&mem_avail_mtx); 1048 interrupts_restore(ipl); 1038 1049 1039 1050 if (!(flags & FRAME_NO_RESERVE))
Note:
See TracChangeset
for help on using the changeset viewer.