574 lines · 14.0 KB · C
RawDownload
	}	rcu_read_unlock(); 	return nr;}EXPORT_SYMBOL(__task_pid_nr_ns); pid_t task_tgid_nr_ns(struct task_struct *tsk, struct pid_namespace *ns){	return pid_nr_ns(task_tgid(tsk), ns);}EXPORT_SYMBOL(task_tgid_nr_ns); struct pid_namespace *task_active_pid_ns(struct task_struct *tsk){	return ns_of_pid(task_pid(tsk));}EXPORT_SYMBOL_GPL(task_active_pid_ns); /* * Used by proc to find the first pid that is greater than or equal to nr. * * If there is a pid at nr this function is exactly the same as find_pid_ns. */struct pid *find_ge_pid(int nr, struct pid_namespace *ns){	struct pid *pid; 	do {		pid = find_pid_ns(nr, ns);		if (pid)			break;		nr = next_pidmap(ns, nr);	} while (nr > 0); 	return pid;} /* * The pid hash table is scaled according to the amount of memory in the * machine.  From a minimum of 16 slots up to 4096 slots at one gigabyte or * more. */void __init pidhash_init(void){	unsigned int i, pidhash_size; 	pid_hash = alloc_large_system_hash("PID", sizeof(*pid_hash), 0, 18,					   HASH_EARLY | HASH_SMALL,					   &pidhash_shift, NULL,					   0, 4096);	pidhash_size = 1U << pidhash_shift; 	for (i = 0; i < pidhash_size; i++)		INIT_HLIST_HEAD(&pid_hash[i]);} void __init pidmap_init(void){	/* bump default and minimum pid_max based on number of cpus */	pid_max = min(pid_max_max, max_t(int, pid_max,				PIDS_PER_CPU_DEFAULT * num_possible_cpus()));	pid_max_min = max_t(int, pid_max_min,				PIDS_PER_CPU_MIN * num_possible_cpus());	pr_info("pid_max: default: %u minimum: %u\n", pid_max, pid_max_min); 	init_pid_ns.pidmap[0].page = kzalloc(PAGE_SIZE, GFP_KERNEL);	/* Reserve PID 0. We never call free_pidmap(0) */	set_bit(0, init_pid_ns.pidmap[0].page);	atomic_dec(&init_pid_ns.pidmap[0].nr_free); 	init_pid_ns.pid_cachep = KMEM_CACHE(pid,			SLAB_HWCACHE_ALIGN | SLAB_PANIC);}

Lines 501–574 of 574. Previous lines

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t