]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
Revert "sparc64: Restrict number of processes"
authorPavel Tatashin <pasha.tatashin@oracle.com>
Tue, 13 Jun 2017 20:15:29 +0000 (13:15 -0700)
committerAllen Pais <allen.pais@oracle.com>
Thu, 29 Jun 2017 08:09:42 +0000 (13:39 +0530)
This reverts commit 8fd2a52b3bcc87f809298093a3be374d08d030f2.

The next patch set fixes the issue that limits the maximum number of
processes to number of context. Thefore revert.

Orabug: 24523680

Conflicts:

arch/sparc/mm/tsb.c

Signed-off-by: Pavel Tatashin <pasha.tatashin@oracle.com>
Reviewed-by: Steve Sistare <steven.sistare@oracle.com>
Signed-off-by: Allen Pais <allen.pais@oracle.com>
arch/sparc/include/asm/mmu_context_64.h
arch/sparc/mm/init_64.c
arch/sparc/mm/tsb.c

index 251bde36d4dcf5db3803377ccf070cb6e30b34dc..260b320634330f413215461cc0bbce3991c1823b 100644 (file)
@@ -17,7 +17,6 @@ static inline void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk)
 extern spinlock_t ctx_alloc_lock;
 extern unsigned long tlb_context_cache;
 extern unsigned long ctx_nr_bits;
-extern int max_user_nctx;
 extern unsigned long mmu_context_bmap[];
 
 void get_new_mmu_context(struct mm_struct *mm);
index 1509da6d3ff36fdaa4e3f8d2dbb243b3c7657e8e..0e42c840cb32c19f63aa1b3b823671a48d2eb061 100644 (file)
@@ -29,7 +29,6 @@
 #include <linux/gfp.h>
 #include <linux/kexec.h>
 #include <linux/crash_dump.h>
-#include <linux/ratelimit.h>
 
 #include <asm/head.h>
 #include <asm/page.h>
@@ -58,7 +57,6 @@
 #include "init_64.h"
 
 unsigned long ctx_nr_bits = DEFAULT_CTX_NR_BITS;
-int max_user_nctx;
 unsigned long kern_linear_pte_xor[4] __read_mostly;
 static unsigned long page_cache4v_flag;
 
@@ -912,12 +910,8 @@ out:
        mm->context.sparc64_ctx_val = new_ctx | orig_pgsz_bits;
        spin_unlock(&ctx_alloc_lock);
 
-       if (unlikely(new_version)) {
-               pr_err_ratelimited("Context ID wrapped: %s(%d) CPU%d\n",
-                                    current->comm, task_pid_nr(current),
-                                    smp_processor_id());
+       if (unlikely(new_version))
                smp_new_mmu_context_version();
-       }
 }
 
 static int numa_enabled = 1;
@@ -2679,8 +2673,6 @@ void __init paging_init(void)
                sun4u_linear_pte_xor_finalize();
        }
 
-       max_user_nctx = (1UL << ctx_nr_bits) - 1;
-
        /* Flush the TLBs and the 4M TSB so that the updated linear
         * pte XOR settings are realized for all mappings.
         */
index cbdc1665a452ac39badf1aca2a12e35d00867144..021895beaabc566add48de2275f288a81f70386d 100644 (file)
@@ -14,7 +14,6 @@
 #include <asm/tlb.h>
 #include <asm/oplib.h>
 #include <asm/mdesc.h>
-#include <linux/ratelimit.h>
 
 extern struct tsb swapper_tsb[KERNEL_TSB_NENTRIES];
 
@@ -616,8 +615,6 @@ retry_tsb_alloc:
        }
 }
 
-static atomic_t nctxs = ATOMIC_INIT(0);
-
 int init_new_context(struct task_struct *tsk, struct mm_struct *mm)
 {
        unsigned long mm_rss = get_mm_rss(mm);
@@ -626,24 +623,6 @@ int init_new_context(struct task_struct *tsk, struct mm_struct *mm)
        unsigned long saved_thp_pte_count;
 #endif
        unsigned int i;
-       int max_nctx = max_user_nctx;
-       int ret = 0;
-       int uid = current_cred()->uid.val;
-
-       /*
-        * In the worst case, user(s) might use up all contexts and make the
-        * system unusable.  Give root extra 100 grace ctxs to recover the
-        * system. E.g by killing some user processes.
-        */
-       if (uid != 0)
-               max_nctx -= 100;
-
-       if (unlikely(max_nctx <= atomic_inc_return(&nctxs))) {
-               pr_warn_ratelimited("Reached max(%d) number of processes for %s\n",
-                                   max_nctx, uid ? "users" : "root");
-               ret = -EAGAIN;
-               goto error;
-       }
 
        spin_lock_init(&mm->context.lock);
 
@@ -680,16 +659,10 @@ int init_new_context(struct task_struct *tsk, struct mm_struct *mm)
                         (saved_hugetlb_pte_count + saved_thp_pte_count) *
                         REAL_HPAGE_PER_HPAGE);
 #endif
+       if (unlikely(!mm->context.tsb_block[MM_TSB_BASE].tsb))
+               return -ENOMEM;
 
-       if (unlikely(!mm->context.tsb_block[MM_TSB_BASE].tsb)) {
-               ret = -ENOMEM;
-               goto error;
-       }
-
-       return ret;
-error:
-       atomic_dec(&nctxs);
-       return ret;
+       return 0;
 }
 
 static void tsb_destroy_one(struct tsb_config *tp)
@@ -711,8 +684,6 @@ void destroy_context(struct mm_struct *mm)
        for (i = 0; i < MM_NUM_TSBS; i++)
                tsb_destroy_one(&mm->context.tsb_block[i]);
 
-       atomic_dec(&nctxs);
-
        spin_lock_irqsave(&ctx_alloc_lock, flags);
 
        if (CTX_VALID(mm->context)) {