mirror of
https://github.com/SerenityOS/serenity
synced 2024-09-06 08:56:40 +00:00
Make the kmalloc global stats variable volatile.
I know I'm praying for cargo here, but this does fix a weird issue where logging the sum_alloc and sum_free globals wouldn't display symmetric values all the time.
This commit is contained in:
parent
82dae8fc90
commit
a5caf7ca99
|
@ -497,6 +497,17 @@ bool scheduleNewTask()
|
||||||
|
|
||||||
if (task == prevHead) {
|
if (task == prevHead) {
|
||||||
// Back at task_head, nothing wants to run.
|
// Back at task_head, nothing wants to run.
|
||||||
|
kprintf("Nothing wants to run!\n");
|
||||||
|
kprintf("PID OWNER STATE NSCHED NAME\n");
|
||||||
|
for (auto* task = s_tasks->head(); task; task = task->next()) {
|
||||||
|
kprintf("%w %w:%w %b %w %s\n",
|
||||||
|
task->pid(),
|
||||||
|
task->uid(),
|
||||||
|
task->gid(),
|
||||||
|
task->state(),
|
||||||
|
task->timesScheduled(),
|
||||||
|
task->name().characters());
|
||||||
|
}
|
||||||
kprintf("Switch to kernel task\n");
|
kprintf("Switch to kernel task\n");
|
||||||
return contextSwitch(Task::kernelTask());
|
return contextSwitch(Task::kernelTask());
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,8 +27,8 @@ typedef struct
|
||||||
|
|
||||||
PRIVATE BYTE alloc_map[POOL_SIZE / CHUNK_SIZE / 8];
|
PRIVATE BYTE alloc_map[POOL_SIZE / CHUNK_SIZE / 8];
|
||||||
|
|
||||||
DWORD sum_alloc = 0;
|
volatile DWORD sum_alloc = 0;
|
||||||
DWORD sum_free = POOL_SIZE;
|
volatile DWORD sum_free = POOL_SIZE;
|
||||||
|
|
||||||
static SpinLock s_kmallocLock;
|
static SpinLock s_kmallocLock;
|
||||||
|
|
||||||
|
|
|
@ -4,8 +4,8 @@ void kmalloc_init();
|
||||||
void *kmalloc(DWORD size) __attribute__ ((malloc));
|
void *kmalloc(DWORD size) __attribute__ ((malloc));
|
||||||
void kfree(void*);
|
void kfree(void*);
|
||||||
|
|
||||||
extern DWORD sum_alloc;
|
extern volatile DWORD sum_alloc;
|
||||||
extern DWORD sum_free;
|
extern volatile DWORD sum_free;
|
||||||
|
|
||||||
inline void* operator new(size_t, void* p) { return p; }
|
inline void* operator new(size_t, void* p) { return p; }
|
||||||
inline void* operator new[](size_t, void* p) { return p; }
|
inline void* operator new[](size_t, void* p) { return p; }
|
||||||
|
|
Loading…
Reference in a new issue