Merge branch 'sched-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
authorLinus Torvalds <torvalds@linux-foundation.org>
Sun, 9 Jul 2017 17:52:16 +0000 (10:52 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Sun, 9 Jul 2017 17:52:16 +0000 (10:52 -0700)
Pull scheduler fixes from Thomas Gleixner:
 "This scheduler update provides:

   - The (hopefully) final fix for the vtime accounting issues which
     were around for quite some time

   - Use types known to user space in UAPI headers to unbreak user space
     builds

   - Make load balancing respect the current scheduling domain again
     instead of evaluating unrelated CPUs"

* 'sched-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  sched/headers/uapi: Fix linux/sched/types.h userspace compilation errors
  sched/fair: Fix load_balance() affinity redo path
  sched/cputime: Accumulate vtime on top of nsec clocksource
  sched/cputime: Move the vtime task fields to their own struct
  sched/cputime: Rename vtime fields
  sched/cputime: Always set tsk->vtime_snap_whence after accounting vtime
  vtime, sched/cputime: Remove vtime_account_user()
  Revert "sched/cputime: Refactor the cputime_adjust() code"

1  2 
include/linux/sched.h
kernel/fork.c

diff --combined include/linux/sched.h
index 5e8759b1b428082e4f90909107583b4caa1e5b3f,4818126c5153da9e931b2b6056b3b886e1d274ad..20814b7d7d70ebb40471e1eff9a27f865db0f635
@@@ -223,6 -223,24 +223,24 @@@ struct task_cputime 
  #define prof_exp                      stime
  #define sched_exp                     sum_exec_runtime
  
+ enum vtime_state {
+       /* Task is sleeping or running in a CPU with VTIME inactive: */
+       VTIME_INACTIVE = 0,
+       /* Task runs in userspace in a CPU with VTIME active: */
+       VTIME_USER,
+       /* Task runs in kernelspace in a CPU with VTIME active: */
+       VTIME_SYS,
+ };
+ struct vtime {
+       seqcount_t              seqcount;
+       unsigned long long      starttime;
+       enum vtime_state        state;
+       u64                     utime;
+       u64                     stime;
+       u64                     gtime;
+ };
  struct sched_info {
  #ifdef CONFIG_SCHED_INFO
        /* Cumulative counters: */
@@@ -688,16 -706,7 +706,7 @@@ struct task_struct 
        u64                             gtime;
        struct prev_cputime             prev_cputime;
  #ifdef CONFIG_VIRT_CPU_ACCOUNTING_GEN
-       seqcount_t                      vtime_seqcount;
-       unsigned long long              vtime_snap;
-       enum {
-               /* Task is sleeping or running in a CPU with VTIME inactive: */
-               VTIME_INACTIVE = 0,
-               /* Task runs in userspace in a CPU with VTIME active: */
-               VTIME_USER,
-               /* Task runs in kernelspace in a CPU with VTIME active: */
-               VTIME_SYS,
-       } vtime_snap_whence;
+       struct vtime                    vtime;
  #endif
  
  #ifdef CONFIG_NO_HZ_FULL
  #ifdef CONFIG_NUMA
        /* Protected by alloc_lock: */
        struct mempolicy                *mempolicy;
 -      short                           il_next;
 +      short                           il_prev;
        short                           pref_node_fork;
  #endif
  #ifdef CONFIG_NUMA_BALANCING
diff --combined kernel/fork.c
index aa01b810c0bdc872c275df43424c045a6eb56d2a,d927ec11aa7afa3ee663c9f4d860f26a4fcf0553..0f69a3e5281effb9185a71bd5f4fcd79f58a6140
@@@ -326,8 -326,8 +326,8 @@@ static void account_kernel_stack(struc
                }
  
                /* All stack pages belong to the same memcg. */
 -              memcg_kmem_update_page_stat(vm->pages[0], MEMCG_KERNEL_STACK_KB,
 -                                          account * (THREAD_SIZE / 1024));
 +              mod_memcg_page_state(vm->pages[0], MEMCG_KERNEL_STACK_KB,
 +                                   account * (THREAD_SIZE / 1024));
        } else {
                /*
                 * All stack pages are in the same zone and belong to the
                mod_zone_page_state(page_zone(first_page), NR_KERNEL_STACK_KB,
                                    THREAD_SIZE / 1024 * account);
  
 -              memcg_kmem_update_page_stat(first_page, MEMCG_KERNEL_STACK_KB,
 -                                          account * (THREAD_SIZE / 1024));
 +              mod_memcg_page_state(first_page, MEMCG_KERNEL_STACK_KB,
 +                                   account * (THREAD_SIZE / 1024));
        }
  }
  
@@@ -1637,9 -1637,9 +1637,9 @@@ static __latent_entropy struct task_str
        prev_cputime_init(&p->prev_cputime);
  
  #ifdef CONFIG_VIRT_CPU_ACCOUNTING_GEN
-       seqcount_init(&p->vtime_seqcount);
-       p->vtime_snap = 0;
-       p->vtime_snap_whence = VTIME_INACTIVE;
+       seqcount_init(&p->vtime.seqcount);
+       p->vtime.starttime = 0;
+       p->vtime.state = VTIME_INACTIVE;
  #endif
  
  #if defined(SPLIT_RSS_COUNTING)