Merge branch 'akpm' (patches from Andrew)
authorLinus Torvalds <torvalds@linux-foundation.org>
Sat, 8 Oct 2016 04:38:00 +0000 (21:38 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Sat, 8 Oct 2016 04:38:00 +0000 (21:38 -0700)
Merge updates from Andrew Morton:

 - fsnotify updates

 - ocfs2 updates

 - all of MM

* emailed patches from Andrew Morton <akpm@linux-foundation.org>: (127 commits)
  console: don't prefer first registered if DT specifies stdout-path
  cred: simpler, 1D supplementary groups
  CREDITS: update Pavel's information, add GPG key, remove snail mail address
  mailmap: add Johan Hovold
  .gitattributes: set git diff driver for C source code files
  uprobes: remove function declarations from arch/{mips,s390}
  spelling.txt: "modeled" is spelt correctly
  nmi_backtrace: generate one-line reports for idle cpus
  arch/tile: adopt the new nmi_backtrace framework
  nmi_backtrace: do a local dump_stack() instead of a self-NMI
  nmi_backtrace: add more trigger_*_cpu_backtrace() methods
  min/max: remove sparse warnings when they're nested
  Documentation/filesystems/proc.txt: add more description for maps/smaps
  mm, proc: fix region lost in /proc/self/smaps
  proc: fix timerslack_ns CAP_SYS_NICE check when adjusting self
  proc: add LSM hook checks to /proc/<tid>/timerslack_ns
  proc: relax /proc/<tid>/timerslack_ns capability requirements
  meminfo: break apart a very long seq_printf with #ifdefs
  seq/proc: modify seq_put_decimal_[u]ll to take a const char *, not char
  proc: faster /proc/*/status
  ...

12 files changed:
1  2 
arch/arm/Kconfig
arch/parisc/Kconfig
arch/parisc/kernel/vmlinux.lds.S
arch/powerpc/Kconfig
arch/powerpc/kernel/fadump.c
arch/powerpc/kernel/vmlinux.lds.S
fs/ext4/file.c
fs/nfs/internal.h
fs/xfs/xfs_file.c
lib/Kconfig
mm/shmem.c
net/ipv4/tcp.c

diff --combined arch/arm/Kconfig
@@@ -2,7 -2,6 +2,6 @@@ config AR
        bool
        default y
        select ARCH_CLOCKSOURCE_DATA
-       select ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE
        select ARCH_HAS_DEVMEM_IS_ALLOWED
        select ARCH_HAS_ELF_RANDOMIZE
        select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST
@@@ -279,9 -278,10 +278,9 @@@ config PHYS_OFFSE
                        ARCH_INTEGRATOR || \
                        ARCH_IOP13XX || \
                        ARCH_KS8695 || \
 -                      (ARCH_REALVIEW && !REALVIEW_HIGH_PHYS_OFFSET)
 +                      ARCH_REALVIEW
        default 0x10000000 if ARCH_OMAP1 || ARCH_RPC
        default 0x20000000 if ARCH_S5PV210
 -      default 0x70000000 if REALVIEW_HIGH_PHYS_OFFSET
        default 0xc0000000 if ARCH_SA1100
        help
          Please provide the physical address corresponding to the
@@@ -337,7 -337,6 +336,7 @@@ config ARCH_MULTIPLATFOR
        select GENERIC_CLOCKEVENTS
        select MIGHT_HAVE_PCI
        select MULTI_IRQ_HANDLER
 +      select PCI_DOMAINS if PCI
        select SPARSE_IRQ
        select USE_OF
  
diff --combined arch/parisc/Kconfig
@@@ -10,13 -10,11 +10,12 @@@ config PARIS
        select RTC_CLASS
        select RTC_DRV_GENERIC
        select INIT_ALL_POSSIBLE
 +      select HAVE_MEMBLOCK
 +      select NO_BOOTMEM
        select BUG
        select BUILDTIME_EXTABLE_SORT
        select HAVE_PERF_EVENTS
        select GENERIC_ATOMIC64 if !64BIT
-       select ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE
 -      select BROKEN_RODATA
        select GENERIC_IRQ_PROBE
        select GENERIC_PCI_IOMAP
        select ARCH_HAVE_NMI_SAFE_CMPXCHG
@@@ -25,7 -23,6 +24,7 @@@
        select SYSCTL_ARCH_UNALIGN_ALLOW
        select SYSCTL_EXCEPTION_TRACE
        select HAVE_MOD_ARCH_SPECIFIC
 +      select HAVE_ARCH_HARDENED_USERCOPY
        select VIRT_TO_BUS
        select MODULES_USE_ELF_RELA
        select CLONE_BACKWARDS
@@@ -69,6 -69,7 +69,7 @@@ SECTION
        .text ALIGN(PAGE_SIZE) : {
                TEXT_TEXT
                SCHED_TEXT
+               CPUIDLE_TEXT
                LOCK_TEXT
                KPROBES_TEXT
                IRQENTRY_TEXT
        /* BSS */
        BSS_SECTION(PAGE_SIZE, PAGE_SIZE, PAGE_SIZE)
  
 -      /* bootmap is allocated in setup_bootmem() directly behind bss. */
 -
        . = ALIGN(HUGEPAGE_SIZE);
        _end = . ;
  
diff --combined arch/powerpc/Kconfig
@@@ -12,6 -12,11 +12,6 @@@ config 64BI
        bool
        default y if PPC64
  
 -config WORD_SIZE
 -      int
 -      default 64 if PPC64
 -      default 32 if !PPC64
 -
  config ARCH_PHYS_ADDR_T_64BIT
         def_bool PPC64 || PHYS_64BIT
  
@@@ -96,7 -101,7 +96,7 @@@ config PP
        select VIRT_TO_BUS if !PPC64
        select HAVE_IDE
        select HAVE_IOREMAP_PROT
 -      select HAVE_EFFICIENT_UNALIGNED_ACCESS if !CPU_LITTLE_ENDIAN
 +      select HAVE_EFFICIENT_UNALIGNED_ACCESS if !(CPU_LITTLE_ENDIAN && POWER7_CPU)
        select HAVE_KPROBES
        select HAVE_ARCH_KGDB
        select HAVE_KRETPROBES
        select HAVE_DEBUG_KMEMLEAK
        select ARCH_HAS_SG_CHAIN
        select GENERIC_ATOMIC64 if PPC32
-       select ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE
        select HAVE_PERF_EVENTS
        select HAVE_PERF_REGS
        select HAVE_PERF_USER_STACK_DUMP
        select GENERIC_CPU_AUTOPROBE
        select HAVE_VIRT_CPU_ACCOUNTING
        select HAVE_ARCH_HARDENED_USERCOPY
 +      select HAVE_KERNEL_GZIP
  
  config GENERIC_CSUM
        def_bool CPU_LITTLE_ENDIAN
@@@ -633,7 -636,7 +632,7 @@@ config FORCE_MAX_ZONEORDE
        int "Maximum zone order"
        range 8 9 if PPC64 && PPC_64K_PAGES
        default "9" if PPC64 && PPC_64K_PAGES
 -      range 9 13 if PPC64 && !PPC_64K_PAGES
 +      range 13 13 if PPC64 && !PPC_64K_PAGES
        default "13" if PPC64 && !PPC_64K_PAGES
        range 9 64 if PPC32 && PPC_16K_PAGES
        default "9" if PPC32 && PPC_16K_PAGES
@@@ -333,6 -333,11 +333,11 @@@ int __init fadump_reserve_mem(void
        return 1;
  }
  
+ unsigned long __init arch_reserved_kernel_pages(void)
+ {
+       return memblock_reserved_size() / PAGE_SIZE;
+ }
  /* Look for fadump= cmdline option. */
  static int __init early_fadump_param(char *p)
  {
@@@ -778,11 -783,7 +783,11 @@@ static int fadump_init_elfcore_header(c
        elf->e_entry = 0;
        elf->e_phoff = sizeof(struct elfhdr);
        elf->e_shoff = 0;
 -      elf->e_flags = ELF_CORE_EFLAGS;
 +#if defined(_CALL_ELF)
 +      elf->e_flags = _CALL_ELF;
 +#else
 +      elf->e_flags = 0;
 +#endif
        elf->e_ehsize = sizeof(struct elfhdr);
        elf->e_phentsize = sizeof(struct elf_phdr);
        elf->e_phnum = 0;
@@@ -1108,9 -1109,7 +1113,9 @@@ static ssize_t fadump_release_memory_st
                 * Take away the '/proc/vmcore'. We are releasing the dump
                 * memory, hence it will not be valid anymore.
                 */
 +#ifdef CONFIG_PROC_VMCORE
                vmcore_cleanup();
 +#endif
                fadump_invalidate_release_mem();
  
        } else
@@@ -44,67 -44,19 +44,68 @@@ SECTION
   * Text, read only data and other permanent read-only sections
   */
  
 -      /* Text and gots */
 +      _text = .;
 +      _stext = .;
 +
 +      /*
 +       * Head text.
 +       * This needs to be in its own output section to avoid ld placing
 +       * branch trampoline stubs randomly throughout the fixed sections,
 +       * which it will do (even if the branch comes from another section)
 +       * in order to optimize stub generation.
 +       */
 +      .head.text : AT(ADDR(.head.text) - LOAD_OFFSET) {
 +#ifdef CONFIG_PPC64
 +              KEEP(*(.head.text.first_256B));
 +#ifdef CONFIG_PPC_BOOK3E
 +# define END_FIXED    0x100
 +#else
 +              KEEP(*(.head.text.real_vectors));
 +              *(.head.text.real_trampolines);
 +              KEEP(*(.head.text.virt_vectors));
 +              *(.head.text.virt_trampolines);
 +# if defined(CONFIG_PPC_PSERIES) || defined(CONFIG_PPC_POWERNV)
 +              KEEP(*(.head.data.fwnmi_page));
 +#  define END_FIXED   0x8000
 +# else
 +#  define END_FIXED   0x7000
 +# endif
 +#endif
 +              ASSERT((. == END_FIXED), "vmlinux.lds.S: fixed section overflow error");
 +#else /* !CONFIG_PPC64 */
 +              HEAD_TEXT
 +#endif
 +      } :kernel
 +
 +      /*
 +       * If the build dies here, it's likely code in head_64.S is referencing
 +       * labels it can't reach, and the linker inserting stubs without the
 +       * assembler's knowledge. To debug, remove the above assert and
 +       * rebuild. Look for branch stubs in the fixed section region.
 +       *
 +       * Linker stub generation could be allowed in "trampoline"
 +       * sections if absolutely necessary, but this would require
 +       * some rework of the fixed sections. Before resorting to this,
 +       * consider references that have sufficient addressing range,
 +       * (e.g., hand coded trampolines) so the linker does not have
 +       * to add stubs.
 +       *
 +       * Linker stubs at the top of the main text section are currently not
 +       * detected, and will result in a crash at boot due to offsets being
 +       * wrong.
 +       */
        .text : AT(ADDR(.text) - LOAD_OFFSET) {
                ALIGN_FUNCTION();
 -              HEAD_TEXT
 -              _text = .;
                /* careful! __ftr_alt_* sections need to be close to .text */
                *(.text .fixup __ftr_alt_* .ref.text)
                SCHED_TEXT
+               CPUIDLE_TEXT
                LOCK_TEXT
                KPROBES_TEXT
                IRQENTRY_TEXT
                SOFTIRQENTRY_TEXT
 +              MEM_KEEP(init.text)
 +              MEM_KEEP(exit.text)
  
  #ifdef CONFIG_PPC32
                *(.got1)
diff --combined fs/ext4/file.c
@@@ -91,7 -91,9 +91,7 @@@ ext4_unaligned_aio(struct inode *inode
  static ssize_t
  ext4_file_write_iter(struct kiocb *iocb, struct iov_iter *from)
  {
 -      struct file *file = iocb->ki_filp;
        struct inode *inode = file_inode(iocb->ki_filp);
 -      struct blk_plug plug;
        int o_direct = iocb->ki_flags & IOCB_DIRECT;
        int unaligned_aio = 0;
        int overwrite = 0;
        if (o_direct) {
                size_t length = iov_iter_count(from);
                loff_t pos = iocb->ki_pos;
 -              blk_start_plug(&plug);
  
                /* check whether we do a DIO overwrite or not */
                if (ext4_should_dioread_nolock(inode) && !unaligned_aio &&
 -                  !file->f_mapping->nrpages && pos + length <= i_size_read(inode)) {
 +                  pos + length <= i_size_read(inode)) {
                        struct ext4_map_blocks map;
                        unsigned int blkbits = inode->i_blkbits;
                        int err, len;
  
                        map.m_lblk = pos >> blkbits;
 -                      map.m_len = (EXT4_BLOCK_ALIGN(pos + length, blkbits) >> blkbits)
 -                              - map.m_lblk;
 +                      map.m_len = EXT4_MAX_BLOCKS(length, pos, blkbits);
                        len = map.m_len;
  
                        err = ext4_map_blocks(NULL, inode, &map, 0);
  
        if (ret > 0)
                ret = generic_write_sync(iocb, ret);
 -      if (o_direct)
 -              blk_finish_plug(&plug);
  
        return ret;
  
@@@ -697,6 -703,7 +697,7 @@@ const struct file_operations ext4_file_
        .open           = ext4_file_open,
        .release        = ext4_release_file,
        .fsync          = ext4_sync_file,
+       .get_unmapped_area = thp_get_unmapped_area,
        .splice_read    = generic_file_splice_read,
        .splice_write   = iter_file_splice_write,
        .fallocate      = ext4_fallocate,
diff --combined fs/nfs/internal.h
@@@ -365,6 -365,8 +365,6 @@@ int nfs_rename(struct inode *, struct d
  int nfs_file_fsync(struct file *file, loff_t start, loff_t end, int datasync);
  loff_t nfs_file_llseek(struct file *, loff_t, int);
  ssize_t nfs_file_read(struct kiocb *, struct iov_iter *);
 -ssize_t nfs_file_splice_read(struct file *, loff_t *, struct pipe_inode_info *,
 -                           size_t, unsigned int);
  int nfs_file_mmap(struct file *, struct vm_area_struct *);
  ssize_t nfs_file_write(struct kiocb *, struct iov_iter *);
  int nfs_file_release(struct inode *, struct file *);
@@@ -679,11 -681,11 +679,11 @@@ unsigned int nfs_page_length(struct pag
        loff_t i_size = i_size_read(page_file_mapping(page)->host);
  
        if (i_size > 0) {
-               pgoff_t page_index = page_file_index(page);
+               pgoff_t index = page_index(page);
                pgoff_t end_index = (i_size - 1) >> PAGE_SHIFT;
-               if (page_index < end_index)
+               if (index < end_index)
                        return PAGE_SIZE;
-               if (page_index == end_index)
+               if (index == end_index)
                        return ((i_size - 1) & ~PAGE_MASK) + 1;
        }
        return 0;
diff --combined fs/xfs/xfs_file.c
@@@ -393,6 -393,45 +393,6 @@@ xfs_file_read_iter
        return ret;
  }
  
 -STATIC ssize_t
 -xfs_file_splice_read(
 -      struct file             *infilp,
 -      loff_t                  *ppos,
 -      struct pipe_inode_info  *pipe,
 -      size_t                  count,
 -      unsigned int            flags)
 -{
 -      struct xfs_inode        *ip = XFS_I(infilp->f_mapping->host);
 -      ssize_t                 ret;
 -
 -      XFS_STATS_INC(ip->i_mount, xs_read_calls);
 -
 -      if (XFS_FORCED_SHUTDOWN(ip->i_mount))
 -              return -EIO;
 -
 -      trace_xfs_file_splice_read(ip, count, *ppos);
 -
 -      /*
 -       * DAX inodes cannot ues the page cache for splice, so we have to push
 -       * them through the VFS IO path. This means it goes through
 -       * ->read_iter, which for us takes the XFS_IOLOCK_SHARED. Hence we
 -       * cannot lock the splice operation at this level for DAX inodes.
 -       */
 -      if (IS_DAX(VFS_I(ip))) {
 -              ret = default_file_splice_read(infilp, ppos, pipe, count,
 -                                             flags);
 -              goto out;
 -      }
 -
 -      xfs_rw_ilock(ip, XFS_IOLOCK_SHARED);
 -      ret = generic_file_splice_read(infilp, ppos, pipe, count, flags);
 -      xfs_rw_iunlock(ip, XFS_IOLOCK_SHARED);
 -out:
 -      if (ret > 0)
 -              XFS_STATS_ADD(ip->i_mount, xs_read_bytes, ret);
 -      return ret;
 -}
 -
  /*
   * Zero any on disk space between the current EOF and the new, larger EOF.
   *
@@@ -1569,7 -1608,7 +1569,7 @@@ const struct file_operations xfs_file_o
        .llseek         = xfs_file_llseek,
        .read_iter      = xfs_file_read_iter,
        .write_iter     = xfs_file_write_iter,
 -      .splice_read    = xfs_file_splice_read,
 +      .splice_read    = generic_file_splice_read,
        .splice_write   = iter_file_splice_write,
        .unlocked_ioctl = xfs_file_ioctl,
  #ifdef CONFIG_COMPAT
        .open           = xfs_file_open,
        .release        = xfs_file_release,
        .fsync          = xfs_file_fsync,
+       .get_unmapped_area = thp_get_unmapped_area,
        .fallocate      = xfs_file_fallocate,
  };
  
diff --combined lib/Kconfig
@@@ -457,9 -457,6 +457,6 @@@ config NLATT
  config GENERIC_ATOMIC64
         bool
  
- config ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE
-       def_bool y if GENERIC_ATOMIC64
  config LRU_CACHE
        tristate
  
@@@ -550,7 -547,4 +547,7 @@@ config STACKDEPO
        bool
        select STACKTRACE
  
 +config SBITMAP
 +      bool
 +
  endmenu
diff --combined mm/shmem.c
@@@ -2311,6 -2311,119 +2311,6 @@@ static ssize_t shmem_file_read_iter(str
        return retval ? retval : error;
  }
  
 -static ssize_t shmem_file_splice_read(struct file *in, loff_t *ppos,
 -                              struct pipe_inode_info *pipe, size_t len,
 -                              unsigned int flags)
 -{
 -      struct address_space *mapping = in->f_mapping;
 -      struct inode *inode = mapping->host;
 -      unsigned int loff, nr_pages, req_pages;
 -      struct page *pages[PIPE_DEF_BUFFERS];
 -      struct partial_page partial[PIPE_DEF_BUFFERS];
 -      struct page *page;
 -      pgoff_t index, end_index;
 -      loff_t isize, left;
 -      int error, page_nr;
 -      struct splice_pipe_desc spd = {
 -              .pages = pages,
 -              .partial = partial,
 -              .nr_pages_max = PIPE_DEF_BUFFERS,
 -              .flags = flags,
 -              .ops = &page_cache_pipe_buf_ops,
 -              .spd_release = spd_release_page,
 -      };
 -
 -      isize = i_size_read(inode);
 -      if (unlikely(*ppos >= isize))
 -              return 0;
 -
 -      left = isize - *ppos;
 -      if (unlikely(left < len))
 -              len = left;
 -
 -      if (splice_grow_spd(pipe, &spd))
 -              return -ENOMEM;
 -
 -      index = *ppos >> PAGE_SHIFT;
 -      loff = *ppos & ~PAGE_MASK;
 -      req_pages = (len + loff + PAGE_SIZE - 1) >> PAGE_SHIFT;
 -      nr_pages = min(req_pages, spd.nr_pages_max);
 -
 -      spd.nr_pages = find_get_pages_contig(mapping, index,
 -                                              nr_pages, spd.pages);
 -      index += spd.nr_pages;
 -      error = 0;
 -
 -      while (spd.nr_pages < nr_pages) {
 -              error = shmem_getpage(inode, index, &page, SGP_CACHE);
 -              if (error)
 -                      break;
 -              unlock_page(page);
 -              spd.pages[spd.nr_pages++] = page;
 -              index++;
 -      }
 -
 -      index = *ppos >> PAGE_SHIFT;
 -      nr_pages = spd.nr_pages;
 -      spd.nr_pages = 0;
 -
 -      for (page_nr = 0; page_nr < nr_pages; page_nr++) {
 -              unsigned int this_len;
 -
 -              if (!len)
 -                      break;
 -
 -              this_len = min_t(unsigned long, len, PAGE_SIZE - loff);
 -              page = spd.pages[page_nr];
 -
 -              if (!PageUptodate(page) || page->mapping != mapping) {
 -                      error = shmem_getpage(inode, index, &page, SGP_CACHE);
 -                      if (error)
 -                              break;
 -                      unlock_page(page);
 -                      put_page(spd.pages[page_nr]);
 -                      spd.pages[page_nr] = page;
 -              }
 -
 -              isize = i_size_read(inode);
 -              end_index = (isize - 1) >> PAGE_SHIFT;
 -              if (unlikely(!isize || index > end_index))
 -                      break;
 -
 -              if (end_index == index) {
 -                      unsigned int plen;
 -
 -                      plen = ((isize - 1) & ~PAGE_MASK) + 1;
 -                      if (plen <= loff)
 -                              break;
 -
 -                      this_len = min(this_len, plen - loff);
 -                      len = this_len;
 -              }
 -
 -              spd.partial[page_nr].offset = loff;
 -              spd.partial[page_nr].len = this_len;
 -              len -= this_len;
 -              loff = 0;
 -              spd.nr_pages++;
 -              index++;
 -      }
 -
 -      while (page_nr < nr_pages)
 -              put_page(spd.pages[page_nr++]);
 -
 -      if (spd.nr_pages)
 -              error = splice_to_pipe(pipe, &spd);
 -
 -      splice_shrink_spd(&spd);
 -
 -      if (error > 0) {
 -              *ppos += error;
 -              file_accessed(in);
 -      }
 -      return error;
 -}
 -
  /*
   * llseek SEEK_DATA or SEEK_HOLE through the radix_tree.
   */
@@@ -3673,7 -3786,7 +3673,7 @@@ static const struct file_operations shm
        .read_iter      = shmem_file_read_iter,
        .write_iter     = generic_file_write_iter,
        .fsync          = noop_fsync,
 -      .splice_read    = shmem_file_splice_read,
 +      .splice_read    = generic_file_splice_read,
        .splice_write   = iter_file_splice_write,
        .fallocate      = shmem_fallocate,
  #endif
@@@ -3965,7 -4078,7 +3965,7 @@@ EXPORT_SYMBOL_GPL(shmem_truncate_range)
  
  /* common code */
  
- static struct dentry_operations anon_ops = {
+ static const struct dentry_operations anon_ops = {
        .d_dname = simple_dname
  };
  
diff --combined net/ipv4/tcp.c
@@@ -424,8 -424,6 +424,6 @@@ void tcp_init_sock(struct sock *sk
        sk->sk_rcvbuf = sysctl_tcp_rmem[1];
  
        local_bh_disable();
-       if (mem_cgroup_sockets_enabled)
-               sock_update_memcg(sk);
        sk_sockets_allocated_inc(sk);
        local_bh_enable();
  }
@@@ -691,7 -689,8 +689,7 @@@ static int tcp_splice_data_recv(read_de
        int ret;
  
        ret = skb_splice_bits(skb, skb->sk, offset, tss->pipe,
 -                            min(rd_desc->count, len), tss->flags,
 -                            skb_socket_splice);
 +                            min(rd_desc->count, len), tss->flags);
        if (ret > 0)
                rd_desc->count -= ret;
        return ret;