Merge remote branch 'origin/master' into gdb
Conflicts: kernel/include/process.h
This commit is contained in:
@@ -30,6 +30,9 @@ struct malloc_header {
|
||||
#define CPU_STATUS_RUNNING (2)
|
||||
extern ihk_spinlock_t cpu_status_lock;
|
||||
|
||||
#define CPU_FLAG_NEED_RESCHED 0x1U
|
||||
#define CPU_FLAG_NEED_MIGRATE 0x2U
|
||||
|
||||
struct cpu_local_var {
|
||||
/* malloc */
|
||||
struct malloc_header free_list;
|
||||
@@ -54,6 +57,11 @@ struct cpu_local_var {
|
||||
int fs;
|
||||
|
||||
struct list_head pending_free_pages;
|
||||
|
||||
unsigned int flags;
|
||||
|
||||
ihk_spinlock_t migq_lock;
|
||||
struct list_head migq;
|
||||
} __attribute__((aligned(64)));
|
||||
|
||||
|
||||
|
||||
@@ -16,10 +16,19 @@
|
||||
#include <ihk/types.h>
|
||||
#include <ihk/atomic.h>
|
||||
#include <ihk/lock.h>
|
||||
#include <errno.h>
|
||||
#include <list.h>
|
||||
#include <shm.h>
|
||||
|
||||
enum {
|
||||
/* for memobj.flags */
|
||||
MF_HAS_PAGER = 0x0001,
|
||||
};
|
||||
|
||||
struct memobj {
|
||||
struct memobj_ops * ops;
|
||||
uint32_t flags;
|
||||
int8_t padding[4];
|
||||
ihk_spinlock_t lock;
|
||||
};
|
||||
|
||||
@@ -39,29 +48,42 @@ struct memobj_ops {
|
||||
|
||||
static inline void memobj_release(struct memobj *obj)
|
||||
{
|
||||
(*obj->ops->release)(obj);
|
||||
if (obj->ops->release) {
|
||||
(*obj->ops->release)(obj);
|
||||
}
|
||||
}
|
||||
|
||||
static inline void memobj_ref(struct memobj *obj)
|
||||
{
|
||||
(*obj->ops->ref)(obj);
|
||||
if (obj->ops->ref) {
|
||||
(*obj->ops->ref)(obj);
|
||||
}
|
||||
}
|
||||
|
||||
static inline int memobj_get_page(struct memobj *obj, off_t off,
|
||||
int p2align, uintptr_t *physp)
|
||||
{
|
||||
return (*obj->ops->get_page)(obj, off, p2align, physp);
|
||||
if (obj->ops->get_page) {
|
||||
return (*obj->ops->get_page)(obj, off, p2align, physp);
|
||||
}
|
||||
return -ENXIO;
|
||||
}
|
||||
|
||||
static inline uintptr_t memobj_copy_page(struct memobj *obj,
|
||||
uintptr_t orgphys, int p2align)
|
||||
{
|
||||
return (*obj->ops->copy_page)(obj, orgphys, p2align);
|
||||
if (obj->ops->copy_page) {
|
||||
return (*obj->ops->copy_page)(obj, orgphys, p2align);
|
||||
}
|
||||
return -ENXIO;
|
||||
}
|
||||
|
||||
static inline int memobj_flush_page(struct memobj *obj, uintptr_t phys, size_t pgsize)
|
||||
{
|
||||
return (*obj->ops->flush_page)(obj, phys, pgsize);
|
||||
if (obj->ops->flush_page) {
|
||||
return (*obj->ops->flush_page)(obj, phys, pgsize);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline void memobj_lock(struct memobj *obj)
|
||||
@@ -74,6 +96,13 @@ static inline void memobj_unlock(struct memobj *obj)
|
||||
ihk_mc_spinlock_unlock_noirq(&obj->lock);
|
||||
}
|
||||
|
||||
static inline int memobj_has_pager(struct memobj *obj)
|
||||
{
|
||||
return !!(obj->flags & MF_HAS_PAGER);
|
||||
}
|
||||
|
||||
int fileobj_create(int fd, struct memobj **objp, int *maxprotp);
|
||||
int shmobj_create(struct shmid_ds *ds, struct memobj **objp);
|
||||
int zeroobj_create(struct memobj **objp);
|
||||
|
||||
#endif /* HEADER_MEMOBJ_H */
|
||||
|
||||
@@ -63,4 +63,10 @@
|
||||
#define MADV_HWPOISON 100
|
||||
#define MADV_SOFT_OFFLINE 101
|
||||
|
||||
/*
|
||||
* for mremap()
|
||||
*/
|
||||
#define MREMAP_MAYMOVE 0x01
|
||||
#define MREMAP_FIXED 0x02
|
||||
|
||||
#endif /* HEADER_MMAN_H */
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
#include <list.h>
|
||||
#include <signal.h>
|
||||
#include <memobj.h>
|
||||
#include <affinity.h>
|
||||
|
||||
#define VR_NONE 0x0
|
||||
#define VR_STACK 0x1
|
||||
@@ -29,6 +30,7 @@
|
||||
#define VR_DEMAND_PAGING 0x1000
|
||||
#define VR_PRIVATE 0x2000
|
||||
#define VR_LOCKED 0x4000
|
||||
#define VR_FILEOFF 0x8000 /* remap_file_pages()ed range */
|
||||
#define VR_PROT_NONE 0x00000000
|
||||
#define VR_PROT_READ 0x00010000
|
||||
#define VR_PROT_WRITE 0x00020000
|
||||
@@ -186,6 +188,7 @@ struct process {
|
||||
void *pgio_arg;
|
||||
|
||||
struct fork_tree_node *ftn;
|
||||
cpu_set_t cpu_set;
|
||||
unsigned long saved_auxv[AUXV_LEN];
|
||||
};
|
||||
|
||||
@@ -231,12 +234,16 @@ int join_process_memory_range(struct process *process, struct vm_range *survivin
|
||||
int change_prot_process_memory_range(
|
||||
struct process *process, struct vm_range *range,
|
||||
unsigned long newflag);
|
||||
int remap_process_memory_range(struct process_vm *vm, struct vm_range *range,
|
||||
uintptr_t start, uintptr_t end, off_t off);
|
||||
struct vm_range *lookup_process_memory_range(
|
||||
struct process_vm *vm, uintptr_t start, uintptr_t end);
|
||||
struct vm_range *next_process_memory_range(
|
||||
struct process_vm *vm, struct vm_range *range);
|
||||
struct vm_range *previous_process_memory_range(
|
||||
struct process_vm *vm, struct vm_range *range);
|
||||
int extend_up_process_memory_range(struct process_vm *vm,
|
||||
struct vm_range *range, uintptr_t newend);
|
||||
|
||||
int page_fault_process(struct process *proc, void *fault_addr, uint64_t reason);
|
||||
int remove_process_region(struct process *proc,
|
||||
@@ -256,4 +263,7 @@ void runq_add_proc(struct process *proc, int cpu_id);
|
||||
void runq_del_proc(struct process *proc, int cpu_id);
|
||||
int sched_wakeup_process(struct process *proc, int valid_states);
|
||||
|
||||
void sched_request_migrate(int cpu_id, struct process *proc);
|
||||
void check_need_resched(void);
|
||||
|
||||
#endif
|
||||
|
||||
49
kernel/include/shm.h
Normal file
49
kernel/include/shm.h
Normal file
@@ -0,0 +1,49 @@
|
||||
/**
|
||||
* \file shm.h
|
||||
* License details are found in the file LICENSE.
|
||||
* \brief
|
||||
* header file for System V shared memory
|
||||
* \author Gou Nakamura <go.nakamura.yw@hitachi-solutions.com>
|
||||
*/
|
||||
/*
|
||||
* HISTORY:
|
||||
*/
|
||||
|
||||
#ifndef HEADER_SHM_H
|
||||
#define HEADER_SHM_H
|
||||
|
||||
/* begin types.h */
|
||||
typedef int32_t key_t;
|
||||
typedef uint32_t uid_t;
|
||||
typedef uint32_t gid_t;
|
||||
typedef int64_t time_t;
|
||||
typedef int32_t pid_t;
|
||||
/* end types.h */
|
||||
|
||||
typedef uint64_t shmatt_t;
|
||||
|
||||
struct ipc_perm {
|
||||
key_t key;
|
||||
uid_t uid;
|
||||
gid_t gid;
|
||||
uid_t cuid;
|
||||
gid_t cgid;
|
||||
uint16_t mode;
|
||||
uint8_t padding[2];
|
||||
uint16_t seq;
|
||||
uint8_t padding2[22];
|
||||
};
|
||||
|
||||
struct shmid_ds {
|
||||
struct ipc_perm shm_perm;
|
||||
size_t shm_segsz;
|
||||
time_t shm_atime;
|
||||
time_t shm_dtime;
|
||||
time_t shm_ctime;
|
||||
pid_t shm_cpid;
|
||||
pid_t shm_lpid;
|
||||
shmatt_t shm_nattch;
|
||||
uint8_t padding[16];
|
||||
};
|
||||
|
||||
#endif /* HEADER_SHM_H */
|
||||
Reference in New Issue
Block a user