]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
Merge remote-tracking branch 'y2038/y2038'
authorStephen Rothwell <sfr@canb.auug.org.au>
Thu, 5 Nov 2015 04:25:04 +0000 (15:25 +1100)
committerStephen Rothwell <sfr@canb.auug.org.au>
Thu, 5 Nov 2015 04:25:04 +0000 (15:25 +1100)
1  2 
drivers/staging/gdm72xx/gdm_sdio.c
drivers/staging/media/lirc/lirc_sasem.c
drivers/staging/media/lirc/lirc_serial.c
kernel/cpuset.c

index b0521da3c793178ddda39965723562644d7d8621,2b9c41443d4506a91fcd9ba156fc392c6a165496..1f5a087723baeb9286164b8ce85535a5dd432a7c
@@@ -36,7 -36,7 +36,7 @@@
  #define RX_BUF_SIZE   (25*1024)
  
  #define TX_HZ         2000
- #define TX_INTERVAL   (1000000/TX_HZ)
+ #define TX_INTERVAL   (NSEC_PER_SEC/TX_HZ)
  
  static struct sdio_tx *alloc_tx_struct(struct tx_cxt *tx)
  {
@@@ -173,12 -173,12 +173,12 @@@ static int init_sdio(struct sdiowm_dev 
        spin_lock_init(&tx->lock);
  
        tx->sdu_buf = kmalloc(SDU_TX_BUF_SIZE, GFP_KERNEL);
 -      if (tx->sdu_buf == NULL)
 +      if (!tx->sdu_buf)
                goto fail;
  
        for (i = 0; i < MAX_NR_SDU_BUF; i++) {
                t = alloc_tx_struct(tx);
 -              if (t == NULL) {
 +              if (!t) {
                        ret = -ENOMEM;
                        goto fail;
                }
  
        for (i = 0; i < MAX_NR_RX_BUF; i++) {
                r = alloc_rx_struct(rx);
 -              if (r == NULL) {
 +              if (!r) {
                        ret = -ENOMEM;
                        goto fail;
                }
        }
  
        rx->rx_buf = kmalloc(RX_BUF_SIZE, GFP_KERNEL);
 -      if (rx->rx_buf == NULL)
 +      if (!rx->rx_buf)
                goto fail;
  
        return 0;
@@@ -303,7 -303,7 +303,7 @@@ static void send_sdu(struct sdio_func *
                put_tx_struct(t->tx_cxt, t);
        }
  
-       do_gettimeofday(&tx->sdu_stamp);
+       tx->sdu_stamp = ktime_get();
        spin_unlock_irqrestore(&tx->lock, flags);
  }
  
@@@ -330,7 -330,7 +330,7 @@@ static void do_tx(struct work_struct *w
        struct sdio_func *func = sdev->func;
        struct tx_cxt *tx = &sdev->tx;
        struct sdio_tx *t = NULL;
-       struct timeval now, *before;
+       ktime_t now, before;
        int is_sdu = 0;
        long diff;
        unsigned long flags;
                list_del(&t->list);
                is_sdu = 0;
        } else if (!tx->stop_sdu_tx && !list_empty(&tx->sdu_list)) {
-               do_gettimeofday(&now);
-               before = &tx->sdu_stamp;
+               now = ktime_get();
+               before = tx->sdu_stamp;
  
-               diff = (now.tv_sec - before->tv_sec) * 1000000 +
-                       (now.tv_usec - before->tv_usec);
+               diff = ktime_to_ns(ktime_sub(now, before));
                if (diff >= 0 && diff < TX_INTERVAL) {
                        schedule_work(&sdev->ws);
                        spin_unlock_irqrestore(&tx->lock, flags);
                is_sdu = 1;
        }
  
 -      if (!is_sdu && t == NULL) {
 +      if (!is_sdu && !t) {
                spin_unlock_irqrestore(&tx->lock, flags);
                return;
        }
@@@ -393,7 -392,7 +392,7 @@@ static int gdm_sdio_send(void *priv_dev
        cmd_evt = (pkt[0] << 8) | pkt[1];
        if (cmd_evt == WIMAX_TX_SDU) {
                t = get_tx_struct(tx, &no_spc);
 -              if (t == NULL) {
 +              if (!t) {
                        /* This case must not happen. */
                        spin_unlock_irqrestore(&tx->lock, flags);
                        return -ENOSPC;
                t->cb_data = cb_data;
        } else {
                t = alloc_tx_struct(tx);
 -              if (t == NULL) {
 +              if (!t) {
                        spin_unlock_irqrestore(&tx->lock, flags);
                        return -ENOMEM;
                }
@@@ -581,7 -580,7 +580,7 @@@ static int gdm_sdio_receive(void *priv_
  
        spin_lock_irqsave(&rx->lock, flags);
        r = get_rx_struct(rx);
 -      if (r == NULL) {
 +      if (!r) {
                spin_unlock_irqrestore(&rx->lock, flags);
                return -ENOMEM;
        }
@@@ -615,12 -614,12 +614,12 @@@ static int sdio_wimax_probe(struct sdio
                return ret;
  
        phy_dev = kzalloc(sizeof(*phy_dev), GFP_KERNEL);
 -      if (phy_dev == NULL) {
 +      if (!phy_dev) {
                ret = -ENOMEM;
                goto out;
        }
        sdev = kzalloc(sizeof(*sdev), GFP_KERNEL);
 -      if (sdev == NULL) {
 +      if (!sdev) {
                ret = -ENOMEM;
                goto out;
        }
index f2dca69c2bc0ed3ea8704e9d9df68ba4d04fc980,c14ca7e0945b5a346e85709570540795c91f2978..2218d0042030ed29ba95376c8d1dd310f1ce2437
@@@ -42,6 -42,7 +42,7 @@@
  #include <linux/slab.h>
  #include <linux/uaccess.h>
  #include <linux/usb.h>
+ #include <linux/ktime.h>
  
  #include <media/lirc.h>
  #include <media/lirc_dev.h>
@@@ -111,7 -112,7 +112,7 @@@ struct sasem_context 
        } tx;
  
        /* for dealing with repeat codes (wish there was a toggle bit!) */
-       struct timeval presstime;
+       ktime_t presstime;
        char lastcode[8];
        int codesaved;
  };
@@@ -181,7 -182,7 +182,7 @@@ static void deregister_from_lirc(struc
        if (retval)
                dev_err(&context->dev->dev,
                        "%s: unable to deregister from lirc (%d)\n",
 -                     __func__, retval);
 +                      __func__, retval);
        else
                dev_info(&context->dev->dev,
                         "Deregistered Sasem driver (minor:%d)\n", minor);
@@@ -244,7 -245,7 +245,7 @@@ exit
   */
  static long vfd_ioctl(struct file *file, unsigned cmd, unsigned long arg)
  {
 -      struct sasem_context *context = NULL;
 +      struct sasem_context *context;
  
        context = (struct sasem_context *) file->private_data;
  
@@@ -566,8 -567,8 +567,8 @@@ static void incoming_packet(struct sase
  {
        int len = urb->actual_length;
        unsigned char *buf = urb->transfer_buffer;
-       long ms;
-       struct timeval tv;
+       u64 ns;
+       ktime_t kt;
  
        if (len != 8) {
                dev_warn(&context->dev->dev,
         */
  
        /* get the time since the last button press */
-       do_gettimeofday(&tv);
-       ms = (tv.tv_sec - context->presstime.tv_sec) * 1000 +
-            (tv.tv_usec - context->presstime.tv_usec) / 1000;
+       kt = ktime_get();
+       ns = ktime_to_ns(ktime_sub(kt, context->presstime));
  
        if (memcmp(buf, "\x08\0\0\0\0\0\0\0", 8) == 0) {
                /*
                 *   in that time and then get a false repeat of the previous
                 *   press but it is long enough for a genuine repeat
                 */
-               if ((ms < 250) && (context->codesaved != 0)) {
+               if ((ns < 250 * NSEC_PER_MSEC) && (context->codesaved != 0)) {
                        memcpy(buf, &context->lastcode, 8);
-                       context->presstime.tv_sec = tv.tv_sec;
-                       context->presstime.tv_usec = tv.tv_usec;
+                       context->presstime = kt;
                }
        } else {
                /* save the current valid code for repeats */
                 * just for safety reasons
                 */
                context->codesaved = 1;
-               context->presstime.tv_sec = tv.tv_sec;
-               context->presstime.tv_usec = tv.tv_usec;
+               context->presstime = kt;
        }
  
        lirc_buffer_write(context->driver->rbuf, buf);
@@@ -697,11 -695,16 +695,11 @@@ static int sasem_probe(struct usb_inter
        for (i = 0; i < num_endpoints && !(ir_ep_found && vfd_ep_found); ++i) {
  
                struct usb_endpoint_descriptor *ep;
 -              int ep_dir;
 -              int ep_type;
  
                ep = &iface_desc->endpoint [i].desc;
 -              ep_dir = ep->bEndpointAddress & USB_ENDPOINT_DIR_MASK;
 -              ep_type = ep->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK;
  
                if (!ir_ep_found &&
 -                      ep_dir == USB_DIR_IN &&
 -                      ep_type == USB_ENDPOINT_XFER_INT) {
 +                      usb_endpoint_is_int_in(ep)) {
  
                        rx_endpoint = ep;
                        ir_ep_found = 1;
                                        "%s: found IR endpoint\n", __func__);
  
                } else if (!vfd_ep_found &&
 -                      ep_dir == USB_DIR_OUT &&
 -                      ep_type == USB_ENDPOINT_XFER_INT) {
 +                      usb_endpoint_is_int_out(ep)) {
  
                        tx_endpoint = ep;
                        vfd_ep_found = 1;
index 64a7b2fc5289b6c1c0c0cabfa865756fb92208ed,35b4ce37691ebd6a4add498642bbc7f8ee598e2e..b798b311d32ccbe47129e0b6626aa23ae73dade4
@@@ -59,7 -59,7 +59,7 @@@
  #include <linux/ioport.h>
  #include <linux/kernel.h>
  #include <linux/serial_reg.h>
- #include <linux/time.h>
+ #include <linux/ktime.h>
  #include <linux/string.h>
  #include <linux/types.h>
  #include <linux/wait.h>
@@@ -109,9 -109,17 +109,9 @@@ static bool iommap
  static int ioshift;
  static bool softcarrier = true;
  static bool share_irq;
 -static bool debug;
  static int sense = -1;        /* -1 = auto, 0 = active high, 1 = active low */
  static bool txsense;  /* 0 = active high, 1 = active low */
  
 -#define dprintk(fmt, args...)                                 \
 -      do {                                                    \
 -              if (debug)                                      \
 -                      printk(KERN_DEBUG LIRC_DRIVER_NAME ": " \
 -                             fmt, ## args);                   \
 -      } while (0)
 -
  /* forward declarations */
  static long send_pulse_irdeo(unsigned long length);
  static long send_pulse_homebrew(unsigned long length);
@@@ -204,7 -212,7 +204,7 @@@ static struct lirc_serial hardware[] = 
  
  #define RBUF_LEN 256
  
- static struct timeval lasttv = {0, 0};
+ static ktime_t lastkt;
  
  static struct lirc_buffer rbuf;
  
@@@ -344,9 -352,10 +344,9 @@@ static int init_timing_params(unsigned 
        /* Derive pulse and space from the period */
        pulse_width = period * duty_cycle / 100;
        space_width = period - pulse_width;
 -      dprintk("in init_timing_params, freq=%d, duty_cycle=%d, "
 -              "clk/jiffy=%ld, pulse=%ld, space=%ld\n",
 -              freq, duty_cycle, __this_cpu_read(cpu_info.loops_per_jiffy),
 -              pulse_width, space_width);
 +      pr_debug("in init_timing_params, freq=%d, duty_cycle=%d, clk/jiffy=%ld, pulse=%ld, space=%ld, conv_us_to_clocks=%ld\n",
 +               freq, duty_cycle, __this_cpu_read(cpu_info.loops_per_jiffy),
 +               pulse_width, space_width, conv_us_to_clocks);
        return 0;
  }
  #else /* ! USE_RDTSC */
@@@ -368,8 -377,8 +368,8 @@@ static int init_timing_params(unsigned 
        period = 256 * 1000000L / freq;
        pulse_width = period * duty_cycle / 100;
        space_width = period - pulse_width;
 -      dprintk("in init_timing_params, freq=%d pulse=%ld, space=%ld\n",
 -              freq, pulse_width, space_width);
 +      pr_debug("in init_timing_params, freq=%d pulse=%ld, space=%ld\n",
 +               freq, pulse_width, space_width);
        return 0;
  }
  #endif /* USE_RDTSC */
@@@ -491,7 -500,7 +491,7 @@@ static void rbwrite(int l
  {
        if (lirc_buffer_full(&rbuf)) {
                /* no new signals will be accepted */
 -              dprintk("Buffer overrun\n");
 +              pr_debug("Buffer overrun\n");
                return;
        }
        lirc_buffer_write(&rbuf, (void *)&l);
@@@ -542,10 -551,10 +542,10 @@@ static void frbwrite(int l
  
  static irqreturn_t lirc_irq_handler(int i, void *blah)
  {
-       struct timeval tv;
+       ktime_t kt;
        int counter, dcd;
        u8 status;
-       long deltv;
+       ktime_t delkt;
        int data;
        static int last_dcd = -1;
  
                if ((status & hardware[type].signal_pin_change)
                    && sense != -1) {
                        /* get current time */
-                       do_gettimeofday(&tv);
+                       kt = ktime_get();
  
                        /* New mode, written by Trent Piepho
                           <xyzzy@u.washington.edu>. */
                        dcd = (status & hardware[type].signal_pin) ? 1 : 0;
  
                        if (dcd == last_dcd) {
-                               pr_warn("ignoring spike: %d %d %lx %lx %lx %lx\n",
-                                       dcd, sense,
-                                       tv.tv_sec, lasttv.tv_sec,
-                                       (unsigned long)tv.tv_usec,
-                                       (unsigned long)lasttv.tv_usec);
+                               pr_warn("ignoring spike: %d %d %llx %llx\n",
+                                       dcd, sense, ktime_to_us(kt),
+                                       ktime_to_us(lastkt));
                                continue;
                        }
  
-                       deltv = tv.tv_sec-lasttv.tv_sec;
-                       if (tv.tv_sec < lasttv.tv_sec ||
-                           (tv.tv_sec == lasttv.tv_sec &&
-                            tv.tv_usec < lasttv.tv_usec)) {
-                               pr_warn("AIEEEE: your clock just jumped backwards\n");
-                               pr_warn("%d %d %lx %lx %lx %lx\n",
-                                       dcd, sense,
-                                       tv.tv_sec, lasttv.tv_sec,
-                                       (unsigned long)tv.tv_usec,
-                                       (unsigned long)lasttv.tv_usec);
-                               data = PULSE_MASK;
-                       } else if (deltv > 15) {
+                       delkt = ktime_sub(kt, lastkt);
+                       if (ktime_compare(delkt, ktime_set(15, 0)) > 0) {
                                data = PULSE_MASK; /* really long time */
                                if (!(dcd^sense)) {
                                        /* sanity check */
-                                       pr_warn("AIEEEE: %d %d %lx %lx %lx %lx\n",
-                                               dcd, sense,
-                                               tv.tv_sec, lasttv.tv_sec,
-                                               (unsigned long)tv.tv_usec,
-                                               (unsigned long)lasttv.tv_usec);
+                                       pr_warn("AIEEEE: %d %d %llx %llx\n",
+                                               dcd, sense, ktime_to_us(kt),
+                                               ktime_to_us(lastkt));
                                        /*
                                         * detecting pulse while this
                                         * MUST be a space!
                                        sense = sense ? 0 : 1;
                                }
                        } else
-                               data = (int) (deltv*1000000 +
-                                              tv.tv_usec -
-                                              lasttv.tv_usec);
+                               data = (int) ktime_to_us(delkt);
                        frbwrite(dcd^sense ? data : (data|PULSE_BIT));
-                       lasttv = tv;
+                       lastkt = kt;
                        last_dcd = dcd;
                        wake_up_interruptible(&rbuf.wait_poll);
                }
@@@ -781,7 -774,7 +765,7 @@@ static int lirc_serial_probe(struct pla
                dev_info(&dev->dev, "Manually using active %s receiver\n",
                         sense ? "low" : "high");
  
 -      dprintk("Interrupt %d, port %04x obtained\n", irq, io);
 +      dev_dbg(&dev->dev, "Interrupt %d, port %04x obtained\n", irq, io);
        return 0;
  }
  
@@@ -790,7 -783,7 +774,7 @@@ static int set_use_inc(void *data
        unsigned long flags;
  
        /* initialize timestamp */
-       do_gettimeofday(&lasttv);
+       lastkt = ktime_get();
  
        spin_lock_irqsave(&hardware[type].lock, flags);
  
@@@ -886,7 -879,7 +870,7 @@@ static long lirc_ioctl(struct file *fil
                return -ENOIOCTLCMD;
  
        case LIRC_SET_SEND_DUTY_CYCLE:
 -              dprintk("SET_SEND_DUTY_CYCLE\n");
 +              pr_debug("SET_SEND_DUTY_CYCLE\n");
                if (!(hardware[type].features&LIRC_CAN_SET_SEND_DUTY_CYCLE))
                        return -ENOIOCTLCMD;
  
                return init_timing_params(value, freq);
  
        case LIRC_SET_SEND_CARRIER:
 -              dprintk("SET_SEND_CARRIER\n");
 +              pr_debug("SET_SEND_CARRIER\n");
                if (!(hardware[type].features&LIRC_CAN_SET_SEND_CARRIER))
                        return -ENOIOCTLCMD;
  
@@@ -979,7 -972,7 +963,7 @@@ static int lirc_serial_resume(struct pl
  
        spin_lock_irqsave(&hardware[type].lock, flags);
        /* Enable Interrupt */
-       do_gettimeofday(&lasttv);
+       lastkt = ktime_get();
        soutp(UART_IER, sinp(UART_IER)|UART_IER_MSI);
        off();
  
@@@ -1093,7 -1086,7 +1077,7 @@@ static void __exit lirc_serial_exit_mod
  {
        lirc_unregister_driver(driver.minor);
        lirc_serial_exit();
 -      dprintk("cleaned up module\n");
 +      pr_debug("cleaned up module\n");
  }
  
  
@@@ -1144,3 -1137,6 +1128,3 @@@ MODULE_PARM_DESC(txsense, "Sense of tra
  
  module_param(softcarrier, bool, S_IRUGO);
  MODULE_PARM_DESC(softcarrier, "Software carrier (0 = off, 1 = on, default on)");
 -
 -module_param(debug, bool, S_IRUGO | S_IWUSR);
 -MODULE_PARM_DESC(debug, "Enable debugging messages");
diff --combined kernel/cpuset.c
index d7ccb87a6714b17cb5b4a86232428cb7b5253799,e414ae9c6b66a9faef2cececb67b9a3246d6d19e..c02d677c541c68067f76f0053864ed176ba39ccc
@@@ -51,6 -51,7 +51,7 @@@
  #include <linux/stat.h>
  #include <linux/string.h>
  #include <linux/time.h>
+ #include <linux/time64.h>
  #include <linux/backing-dev.h>
  #include <linux/sort.h>
  
@@@ -68,7 -69,7 +69,7 @@@ struct static_key cpusets_enabled_key _
  struct fmeter {
        int cnt;                /* unprocessed events count */
        int val;                /* most recent output value */
-       time_t time;            /* clock (secs) when val computed */
+       time64_t time;          /* clock (secs) when val computed */
        spinlock_t lock;        /* guards read or write of above */
  };
  
@@@ -473,8 -474,7 +474,8 @@@ static int validate_change(struct cpuse
  
        /* On legacy hiearchy, we must be a subset of our parent cpuset. */
        ret = -EACCES;
 -      if (!cgroup_on_dfl(cur->css.cgroup) && !is_cpuset_subset(trial, par))
 +      if (!cgroup_subsys_on_dfl(cpuset_cgrp_subsys) &&
 +          !is_cpuset_subset(trial, par))
                goto out;
  
        /*
         * be changed to have empty cpus_allowed or mems_allowed.
         */
        ret = -ENOSPC;
 -      if ((cgroup_has_tasks(cur->css.cgroup) || cur->attach_in_progress)) {
 +      if ((cgroup_is_populated(cur->css.cgroup) || cur->attach_in_progress)) {
                if (!cpumask_empty(cur->cpus_allowed) &&
                    cpumask_empty(trial->cpus_allowed))
                        goto out;
@@@ -880,8 -880,7 +881,8 @@@ static void update_cpumasks_hier(struc
                 * If it becomes empty, inherit the effective mask of the
                 * parent, which is guaranteed to have some CPUs.
                 */
 -              if (cgroup_on_dfl(cp->css.cgroup) && cpumask_empty(new_cpus))
 +              if (cgroup_subsys_on_dfl(cpuset_cgrp_subsys) &&
 +                  cpumask_empty(new_cpus))
                        cpumask_copy(new_cpus, parent->effective_cpus);
  
                /* Skip the whole subtree if the cpumask remains the same. */
                cpumask_copy(cp->effective_cpus, new_cpus);
                spin_unlock_irq(&callback_lock);
  
 -              WARN_ON(!cgroup_on_dfl(cp->css.cgroup) &&
 +              WARN_ON(!cgroup_subsys_on_dfl(cpuset_cgrp_subsys) &&
                        !cpumask_equal(cp->cpus_allowed, cp->effective_cpus));
  
                update_tasks_cpumask(cp);
@@@ -1137,8 -1136,7 +1138,8 @@@ static void update_nodemasks_hier(struc
                 * If it becomes empty, inherit the effective mask of the
                 * parent, which is guaranteed to have some MEMs.
                 */
 -              if (cgroup_on_dfl(cp->css.cgroup) && nodes_empty(*new_mems))
 +              if (cgroup_subsys_on_dfl(cpuset_cgrp_subsys) &&
 +                  nodes_empty(*new_mems))
                        *new_mems = parent->effective_mems;
  
                /* Skip the whole subtree if the nodemask remains the same. */
                cp->effective_mems = *new_mems;
                spin_unlock_irq(&callback_lock);
  
 -              WARN_ON(!cgroup_on_dfl(cp->css.cgroup) &&
 +              WARN_ON(!cgroup_subsys_on_dfl(cpuset_cgrp_subsys) &&
                        !nodes_equal(cp->mems_allowed, cp->effective_mems));
  
                update_tasks_nodemask(cp);
@@@ -1374,7 -1372,7 +1375,7 @@@ out
   */
  
  #define FM_COEF 933           /* coefficient for half-life of 10 secs */
- #define FM_MAXTICKS ((time_t)99) /* useless computing more ticks than this */
+ #define FM_MAXTICKS ((u32)99)   /* useless computing more ticks than this */
  #define FM_MAXCNT 1000000     /* limit cnt to avoid overflow */
  #define FM_SCALE 1000         /* faux fixed point scale */
  
@@@ -1390,8 -1388,11 +1391,11 @@@ static void fmeter_init(struct fmeter *
  /* Internal meter update - process cnt events and update value */
  static void fmeter_update(struct fmeter *fmp)
  {
-       time_t now = get_seconds();
-       time_t ticks = now - fmp->time;
+       time64_t now;
+       u32 ticks;
+       now = ktime_get_seconds();
+       ticks = now - fmp->time;
  
        if (ticks == 0)
                return;
@@@ -1443,7 -1444,7 +1447,7 @@@ static int cpuset_can_attach(struct cgr
  
        /* allow moving tasks into an empty cpuset if on default hierarchy */
        ret = -ENOSPC;
 -      if (!cgroup_on_dfl(css->cgroup) &&
 +      if (!cgroup_subsys_on_dfl(cpuset_cgrp_subsys) &&
            (cpumask_empty(cs->cpus_allowed) || nodes_empty(cs->mems_allowed)))
                goto out_unlock;
  
@@@ -1487,8 -1488,9 +1491,8 @@@ static void cpuset_attach(struct cgroup
  {
        /* static buf protected by cpuset_mutex */
        static nodemask_t cpuset_attach_nodemask_to;
 -      struct mm_struct *mm;
        struct task_struct *task;
 -      struct task_struct *leader = cgroup_taskset_first(tset);
 +      struct task_struct *leader;
        struct cpuset *cs = css_cs(css);
        struct cpuset *oldcs = cpuset_attach_old_cs;
  
        }
  
        /*
 -       * Change mm, possibly for multiple threads in a threadgroup. This is
 -       * expensive and may sleep.
 +       * Change mm for all threadgroup leaders. This is expensive and may
 +       * sleep and should be moved outside migration path proper.
         */
        cpuset_attach_nodemask_to = cs->effective_mems;
 -      mm = get_task_mm(leader);
 -      if (mm) {
 -              mpol_rebind_mm(mm, &cpuset_attach_nodemask_to);
 -
 -              /*
 -               * old_mems_allowed is the same with mems_allowed here, except
 -               * if this task is being moved automatically due to hotplug.
 -               * In that case @mems_allowed has been updated and is empty,
 -               * so @old_mems_allowed is the right nodesets that we migrate
 -               * mm from.
 -               */
 -              if (is_memory_migrate(cs)) {
 -                      cpuset_migrate_mm(mm, &oldcs->old_mems_allowed,
 -                                        &cpuset_attach_nodemask_to);
 +      cgroup_taskset_for_each_leader(leader, tset) {
 +              struct mm_struct *mm = get_task_mm(leader);
 +
 +              if (mm) {
 +                      mpol_rebind_mm(mm, &cpuset_attach_nodemask_to);
 +
 +                      /*
 +                       * old_mems_allowed is the same with mems_allowed
 +                       * here, except if this task is being moved
 +                       * automatically due to hotplug.  In that case
 +                       * @mems_allowed has been updated and is empty, so
 +                       * @old_mems_allowed is the right nodesets that we
 +                       * migrate mm from.
 +                       */
 +                      if (is_memory_migrate(cs)) {
 +                              cpuset_migrate_mm(mm, &oldcs->old_mems_allowed,
 +                                                &cpuset_attach_nodemask_to);
 +                      }
 +                      mmput(mm);
                }
 -              mmput(mm);
        }
  
        cs->old_mems_allowed = cpuset_attach_nodemask_to;
@@@ -1600,6 -1598,9 +1604,6 @@@ static int cpuset_write_u64(struct cgro
        case FILE_MEMORY_PRESSURE_ENABLED:
                cpuset_memory_pressure_enabled = !!val;
                break;
 -      case FILE_MEMORY_PRESSURE:
 -              retval = -EACCES;
 -              break;
        case FILE_SPREAD_PAGE:
                retval = update_flag(CS_SPREAD_PAGE, cs, val);
                break;
@@@ -1866,6 -1867,9 +1870,6 @@@ static struct cftype files[] = 
        {
                .name = "memory_pressure",
                .read_u64 = cpuset_read_u64,
 -              .write_u64 = cpuset_write_u64,
 -              .private = FILE_MEMORY_PRESSURE,
 -              .mode = S_IRUGO,
        },
  
        {
@@@ -1952,7 -1956,7 +1956,7 @@@ static int cpuset_css_online(struct cgr
        cpuset_inc();
  
        spin_lock_irq(&callback_lock);
 -      if (cgroup_on_dfl(cs->css.cgroup)) {
 +      if (cgroup_subsys_on_dfl(cpuset_cgrp_subsys)) {
                cpumask_copy(cs->effective_cpus, parent->effective_cpus);
                cs->effective_mems = parent->effective_mems;
        }
@@@ -2029,7 -2033,7 +2033,7 @@@ static void cpuset_bind(struct cgroup_s
        mutex_lock(&cpuset_mutex);
        spin_lock_irq(&callback_lock);
  
 -      if (cgroup_on_dfl(root_css->cgroup)) {
 +      if (cgroup_subsys_on_dfl(cpuset_cgrp_subsys)) {
                cpumask_copy(top_cpuset.cpus_allowed, cpu_possible_mask);
                top_cpuset.mems_allowed = node_possible_map;
        } else {
@@@ -2210,7 -2214,7 +2214,7 @@@ retry
        cpus_updated = !cpumask_equal(&new_cpus, cs->effective_cpus);
        mems_updated = !nodes_equal(new_mems, cs->effective_mems);
  
 -      if (cgroup_on_dfl(cs->css.cgroup))
 +      if (cgroup_subsys_on_dfl(cpuset_cgrp_subsys))
                hotplug_update_tasks(cs, &new_cpus, &new_mems,
                                     cpus_updated, mems_updated);
        else
@@@ -2241,7 -2245,7 +2245,7 @@@ static void cpuset_hotplug_workfn(struc
        static cpumask_t new_cpus;
        static nodemask_t new_mems;
        bool cpus_updated, mems_updated;
 -      bool on_dfl = cgroup_on_dfl(top_cpuset.css.cgroup);
 +      bool on_dfl = cgroup_subsys_on_dfl(cpuset_cgrp_subsys);
  
        mutex_lock(&cpuset_mutex);