Merge branch 'linux-linaro-lsk-v4.4-android' of git://git.linaro.org/kernel/linux...
[firefly-linux-kernel-4.4.55.git] / include / linux / sched.h
index edad7a43edea141b3ada89f7f12edac2add7b68e..951422587dd91844b4a61d696d49394d9a603377 100644 (file)
@@ -830,6 +830,8 @@ struct user_struct {
        unsigned long mq_bytes; /* How many bytes can be allocated to mqueue? */
 #endif
        unsigned long locked_shm; /* How many pages of mlocked shm ? */
+       unsigned long unix_inflight;    /* How many files in flight in unix sockets */
+       atomic_long_t pipe_bufs;  /* how many pages are allocated in pipe buffers */
 
 #ifdef CONFIG_KEYS
        struct key *uid_keyring;        /* UID specific keyring */
@@ -927,6 +929,14 @@ enum cpu_idle_type {
 #define SCHED_CAPACITY_SHIFT   10
 #define SCHED_CAPACITY_SCALE   (1L << SCHED_CAPACITY_SHIFT)
 
+struct sched_capacity_reqs {
+       unsigned long cfs;
+       unsigned long rt;
+       unsigned long dl;
+
+       unsigned long total;
+};
+
 /*
  * Wake-queues are lists of tasks with a pending wakeup, whose
  * callers have already marked the task as woken internally,
@@ -989,6 +999,7 @@ extern void wake_up_q(struct wake_q_head *head);
 #define SD_PREFER_SIBLING      0x1000  /* Prefer to place tasks in a sibling domain */
 #define SD_OVERLAP             0x2000  /* sched_domains of this level overlap */
 #define SD_NUMA                        0x4000  /* cross-node balancing */
+#define SD_SHARE_CAP_STATES    0x8000  /* Domain members share capacity state */
 
 #ifdef CONFIG_SCHED_SMT
 static inline int cpu_smt_flags(void)
@@ -1021,6 +1032,24 @@ struct sched_domain_attr {
 
 extern int sched_domain_level_max;
 
+struct capacity_state {
+       unsigned long cap;      /* compute capacity */
+       unsigned long power;    /* power consumption at this compute capacity */
+};
+
+struct idle_state {
+       unsigned long power;     /* power consumption in this idle state */
+};
+
+struct sched_group_energy {
+       unsigned int nr_idle_states;    /* number of idle states */
+       struct idle_state *idle_states; /* ptr to idle state array */
+       unsigned int nr_cap_states;     /* number of capacity states */
+       struct capacity_state *cap_states; /* ptr to capacity state array */
+};
+
+unsigned long capacity_curr_of(int cpu);
+
 struct sched_group;
 
 struct sched_domain {
@@ -1119,6 +1148,8 @@ bool cpus_share_cache(int this_cpu, int that_cpu);
 
 typedef const struct cpumask *(*sched_domain_mask_f)(int cpu);
 typedef int (*sched_domain_flags_f)(void);
+typedef
+const struct sched_group_energy * const(*sched_domain_energy_f)(int cpu);
 
 #define SDTL_OVERLAP   0x01
 
@@ -1131,6 +1162,7 @@ struct sd_data {
 struct sched_domain_topology_level {
        sched_domain_mask_f mask;
        sched_domain_flags_f sd_flags;
+       sched_domain_energy_f energy;
        int                 flags;
        int                 numa_level;
        struct sd_data      data;
@@ -1455,14 +1487,15 @@ struct task_struct {
        /* Used for emulating ABI behavior of previous Linux versions */
        unsigned int personality;
 
-       unsigned in_execve:1;   /* Tell the LSMs that the process is doing an
-                                * execve */
-       unsigned in_iowait:1;
-
-       /* Revert to default priority/policy when forking */
+       /* scheduler bits, serialized by scheduler locks */
        unsigned sched_reset_on_fork:1;
        unsigned sched_contributes_to_load:1;
        unsigned sched_migrated:1;
+       unsigned :0; /* force alignment to the next boundary */
+
+       /* unserialized, strictly 'current' */
+       unsigned in_execve:1; /* bit to tell LSMs we're in execve */
+       unsigned in_iowait:1;
 #ifdef CONFIG_MEMCG
        unsigned memcg_may_oom:1;
 #endif
@@ -1766,8 +1799,8 @@ struct task_struct {
         * time slack values; these are used to round up poll() and
         * select() etc timeout values. These are in nanoseconds.
         */
-       unsigned long timer_slack_ns;
-       unsigned long default_timer_slack_ns;
+       u64 timer_slack_ns;
+       u64 default_timer_slack_ns;
 
 #ifdef CONFIG_KASAN
        unsigned int kasan_depth;
@@ -2002,7 +2035,8 @@ static inline int pid_alive(const struct task_struct *p)
 }
 
 /**
- * is_global_init - check if a task structure is init
+ * is_global_init - check if a task structure is init. Since init
+ * is free to have sub-threads we need to check tgid.
  * @tsk: Task structure to be checked.
  *
  * Check if a task structure is the first user space task the kernel created.
@@ -2011,7 +2045,7 @@ static inline int pid_alive(const struct task_struct *p)
  */
 static inline int is_global_init(struct task_struct *tsk)
 {
-       return tsk->pid == 1;
+       return task_tgid_nr(tsk) == 1;
 }
 
 extern struct pid *cad_pid;