diff options
Diffstat (limited to 'kernel/fork.c')
| -rw-r--r-- | kernel/fork.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/kernel/fork.c b/kernel/fork.c index e2a5156bc9c3..d439c48ecf18 100644 --- a/kernel/fork.c +++ b/kernel/fork.c | |||
| @@ -744,15 +744,16 @@ void __init __weak arch_task_cache_init(void) { } | |||
| 744 | static void set_max_threads(unsigned int max_threads_suggested) | 744 | static void set_max_threads(unsigned int max_threads_suggested) |
| 745 | { | 745 | { |
| 746 | u64 threads; | 746 | u64 threads; |
| 747 | unsigned long nr_pages = totalram_pages(); | ||
| 747 | 748 | ||
| 748 | /* | 749 | /* |
| 749 | * The number of threads shall be limited such that the thread | 750 | * The number of threads shall be limited such that the thread |
| 750 | * structures may only consume a small part of the available memory. | 751 | * structures may only consume a small part of the available memory. |
| 751 | */ | 752 | */ |
| 752 | if (fls64(totalram_pages) + fls64(PAGE_SIZE) > 64) | 753 | if (fls64(nr_pages) + fls64(PAGE_SIZE) > 64) |
| 753 | threads = MAX_THREADS; | 754 | threads = MAX_THREADS; |
| 754 | else | 755 | else |
| 755 | threads = div64_u64((u64) totalram_pages * (u64) PAGE_SIZE, | 756 | threads = div64_u64((u64) nr_pages * (u64) PAGE_SIZE, |
| 756 | (u64) THREAD_SIZE * 8UL); | 757 | (u64) THREAD_SIZE * 8UL); |
| 757 | 758 | ||
| 758 | if (threads > max_threads_suggested) | 759 | if (threads > max_threads_suggested) |
| @@ -840,7 +841,7 @@ static struct task_struct *dup_task_struct(struct task_struct *orig, int node) | |||
| 840 | { | 841 | { |
| 841 | struct task_struct *tsk; | 842 | struct task_struct *tsk; |
| 842 | unsigned long *stack; | 843 | unsigned long *stack; |
| 843 | struct vm_struct *stack_vm_area; | 844 | struct vm_struct *stack_vm_area __maybe_unused; |
| 844 | int err; | 845 | int err; |
| 845 | 846 | ||
| 846 | if (node == NUMA_NO_NODE) | 847 | if (node == NUMA_NO_NODE) |
