Skip to content
This repository has been archived by the owner on Feb 19, 2023. It is now read-only.

Commit

Permalink
Revert "[struct process] palloc -> malloc"
Browse files Browse the repository at this point in the history
This reverts commit 077011a.

Do not know why but this break multi-oom.
  • Loading branch information
CCXXXI committed Jan 12, 2021
1 parent 077011a commit b8c1aef
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
5 changes: 2 additions & 3 deletions src/userprog/process.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
#include "threads/init.h"
#include "threads/interrupt.h"
#include "threads/palloc.h"
#include "threads/malloc.h"
#include "threads/thread.h"
#include "threads/vaddr.h"

Expand Down Expand Up @@ -208,7 +207,7 @@ int process_wait(tid_t child_tid)
list_remove(&child->elem);
list_remove(&child->allelem);
int exit_code = child->exit_code;
free(child);
palloc_free_page(child);

return exit_code;
}
Expand Down Expand Up @@ -592,7 +591,7 @@ static bool install_page(void *upage, void *kpage, bool writable)
struct process *process_create(struct thread *t)
{
/* Allocate process. */
struct process *p = malloc(sizeof(struct process));
struct process *p = palloc_get_page(PAL_ZERO);
if (p == NULL)
return NULL;

Expand Down
2 changes: 1 addition & 1 deletion src/userprog/syscall.c
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ static pid_t exec(const char *cmd_line)
if (child->status == PROCESS_FAILED)
{
sema_down(&child->sema_wait);
free(child);
palloc_free_page(child);
return -1;
}
else
Expand Down

0 comments on commit b8c1aef

Please sign in to comment.