@@ -1956,10 +1956,6 @@ int main(int argc, char **argv)
|
|||||||
n_threads = ncpu;
|
n_threads = ncpu;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Quick fix for #900: Limit the number of clone() */
|
|
||||||
desc->rlimit[MCK_RLIMIT_NPROC].rlim_cur = n_threads;
|
|
||||||
desc->rlimit[MCK_RLIMIT_NPROC].rlim_max = n_threads;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* XXX: keep thread_data ncpu sized despite that there are only
|
* XXX: keep thread_data ncpu sized despite that there are only
|
||||||
* n_threads worker threads in the pool so that signaling code
|
* n_threads worker threads in the pool so that signaling code
|
||||||
|
|||||||
@@ -147,12 +147,6 @@ rusage_num_threads_dec()
|
|||||||
{
|
{
|
||||||
__sync_sub_and_fetch(&monitor->rusage_num_threads, 1);
|
__sync_sub_and_fetch(&monitor->rusage_num_threads, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline unsigned long
|
|
||||||
rusage_num_threads_get()
|
|
||||||
{
|
|
||||||
return monitor->rusage_num_threads;
|
|
||||||
}
|
|
||||||
#else
|
#else
|
||||||
static inline void
|
static inline void
|
||||||
rusage_total_memory_add(unsigned long size)
|
rusage_total_memory_add(unsigned long size)
|
||||||
@@ -198,12 +192,6 @@ static inline void
|
|||||||
rusage_num_threads_dec()
|
rusage_num_threads_dec()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline unsigned long
|
|
||||||
rusage_num_threads_get()
|
|
||||||
{
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
#endif // ENABLE_RUSAGE
|
#endif // ENABLE_RUSAGE
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -2127,7 +2127,6 @@ unsigned long do_fork(int clone_flags, unsigned long newsp,
|
|||||||
{
|
{
|
||||||
int cpuid;
|
int cpuid;
|
||||||
int parent_cpuid;
|
int parent_cpuid;
|
||||||
int nr_threads;
|
|
||||||
struct thread *old = cpu_local_var(current);
|
struct thread *old = cpu_local_var(current);
|
||||||
struct process *oldproc = old->proc;
|
struct process *oldproc = old->proc;
|
||||||
struct process *newproc;
|
struct process *newproc;
|
||||||
@@ -2174,17 +2173,6 @@ unsigned long do_fork(int clone_flags, unsigned long newsp,
|
|||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* FIXME: It is not appropriate to enforce rlimit only when rusage is enabled */
|
|
||||||
nr_threads = rusage_num_threads_get();
|
|
||||||
if(nr_threads != -1) {
|
|
||||||
struct rlimit *rlim;
|
|
||||||
rlim = &oldproc->rlimit[MCK_RLIMIT_NPROC];
|
|
||||||
if (nr_threads >= rlim->rlim_cur) {
|
|
||||||
ekprintf("%s,resource limit exceeded,RLIMIT_NPROC=%d,nr_threads=%d\n", __FUNCTION__, rlim->rlim_cur, nr_threads);
|
|
||||||
return -EAGAIN;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
cpuid = obtain_clone_cpuid(&old->cpu_set);
|
cpuid = obtain_clone_cpuid(&old->cpu_set);
|
||||||
if (cpuid == -1) {
|
if (cpuid == -1) {
|
||||||
kprintf("do_fork,core not available\n");
|
kprintf("do_fork,core not available\n");
|
||||||
|
|||||||
Reference in New Issue
Block a user