1. 30 Apr, 2013 32 commits
  2. 29 Apr, 2013 8 commits
    • Li Zefan's avatar
      memcg: take reference before releasing rcu_read_lock · ca0dde97
      Li Zefan authored
      The memcg is not referenced, so it can be destroyed at anytime right
      after we exit rcu read section, so it's not safe to access it.
      
      To fix this, we call css_tryget() to get a reference while we're still
      in rcu read section.
      
      This also removes a bogus comment above __memcg_create_cache_enqueue().
      Signed-off-by: default avatarLi Zefan <lizefan@huawei.com>
      Acked-by: default avatarGlauber Costa <glommer@parallels.com>
      Acked-by: default avatarMichal Hocko <mhocko@suse.cz>
      Acked-by: default avatarKAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
      Cc: Johannes Weiner <hannes@cmpxchg.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      ca0dde97
    • Yasuaki Ishimatsu's avatar
      mem hotunplug: fix kfree() of bootmem memory · ebff7d8f
      Yasuaki Ishimatsu authored
      When hot removing memory presented at boot time, following messages are shown:
      
        kernel BUG at mm/slub.c:3409!
        invalid opcode: 0000 [#1] SMP
        Modules linked in: ebtable_nat ebtables xt_CHECKSUM iptable_mangle bridge stp llc ipmi_devintf ipmi_msghandler sunrpc ipt_REJECT nf_conntrack_ipv4 nf_defrag_ipv4 iptable_filter ip_tables ip6t_REJECT nf_conntrack_ipv6 nf_defrag_ipv6 xt_state nf_conntrack ip6table_filter ip6_tables binfmt_misc vfat fat dm_mirror dm_region_hash dm_log dm_mod vhost_net macvtap macvlan tun uinput iTCO_wdt iTCO_vendor_support coretemp kvm_intel kvm crc32c_intel ghash_clmulni_intel microcode pcspkr sg i2c_i801 lpc_ich mfd_core igb i2c_algo_bit i2c_core e1000e ptp pps_core tpm_infineon ioatdma dca sr_mod cdrom sd_mod crc_t10dif usb_storage megaraid_sas lpfc scsi_transport_fc scsi_tgt scsi_mod
        CPU 0
        Pid: 5091, comm: kworker/0:2 Tainted: G        W    3.9.0-rc6+ #15
        RIP: kfree+0x232/0x240
        Process kworker/0:2 (pid: 5091, threadinfo ffff88084678c000, task ffff88083928ca80)
        Call Trace:
          __release_region+0xd4/0xe0
          __remove_pages+0x52/0x110
          arch_remove_memory+0x89/0xd0
          remove_memory+0xc4/0x100
          acpi_memory_device_remove+0x6d/0xb1
          acpi_device_remove+0x89/0xab
          __device_release_driver+0x7c/0xf0
          device_release_driver+0x2f/0x50
          acpi_bus_device_detach+0x6c/0x70
          acpi_ns_walk_namespace+0x11a/0x250
          acpi_walk_namespace+0xee/0x137
          acpi_bus_trim+0x33/0x7a
          acpi_bus_hot_remove_device+0xc4/0x1a1
          acpi_os_execute_deferred+0x27/0x34
          process_one_work+0x1f7/0x590
          worker_thread+0x11a/0x370
          kthread+0xee/0x100
          ret_from_fork+0x7c/0xb0
        RIP  [<ffffffff811c41d2>] kfree+0x232/0x240
         RSP <ffff88084678d968>
      
      The reason why the messages are shown is to release a resource
      structure, allocated by bootmem, by kfree().  So when we release a
      resource structure, we should check whether it is allocated by bootmem
      or not.
      
      But even if we know a resource structure is allocated by bootmem, we
      cannot release it since SLxB cannot treat it.  So for reusing a resource
      structure, this patch remembers it by using bootmem_resource as follows:
      
      When releasing a resource structure by free_resource(), free_resource()
      checks whether the resource structure is allocated by bootmem or not.
      If it is allocated by bootmem, free_resource() adds it to
      bootmem_resource.  If it is not allocated by bootmem, free_resource()
      release it by kfree().
      
      And when getting a new resource structure by get_resource(),
      get_resource() checks whether bootmem_resource has released resource
      structures or not.  If there is a released resource structure,
      get_resource() returns it.  If there is not a releaed resource
      structure, get_resource() returns new resource structure allocated by
      kzalloc().
      
      [akpm@linux-foundation.org: s/get_resource/alloc_resource/]
      Signed-off-by: default avatarYasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>
      Reviewed-by: default avatarToshi Kani <toshi.kani@hp.com>
      Cc: Johannes Weiner <hannes@cmpxchg.org>
      Cc: Ram Pai <linuxram@us.ibm.com>
      Cc: David Rientjes <rientjes@google.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      ebff7d8f
    • Vinayak Menon's avatar
      mmKconfig: add an option to disable bounce · 9ca24e2e
      Vinayak Menon authored
      There are times when HIGHMEM is enabled, but we don't prefer
      CONFIG_BOUNCE to be enabled.  CONFIG_BOUNCE can reduce the block device
      throughput, and this is not ideal for machines where we don't gain much
      by enabling it.  So provide an option to deselect CONFIG_BOUNCE.  The
      observation was made while measuring eMMC throughput using iozone on an
      ARM device with 1GB RAM.
      Signed-off-by: default avatarVinayak Menon <vinayakm.list@gmail.com>
      Cc: David Rientjes <rientjes@google.com>
      Cc: Jens Axboe <axboe@kernel.dk>
      Cc: Randy Dunlap <rdunlap@infradead.org>
      Cc: Russell King <rmk@arm.linux.org.uk>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      9ca24e2e
    • Joonsoo Kim's avatar
      mm, nobootmem: do memset() after memblock_reserve() · b476e295
      Joonsoo Kim authored
      Currently, we do memset() before reserving the area.  This may not cause
      any problem, but it is somewhat weird.  So change execution order.
      Signed-off-by: default avatarJoonsoo Kim <iamjoonsoo.kim@lge.com>
      Cc: Yinghai Lu <yinghai@kernel.org>
      Acked-by: default avatarJohannes Weiner <hannes@cmpxchg.org>
      Cc: Jiang Liu <liuj97@gmail.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      b476e295
    • Joonsoo Kim's avatar
      mm, nobootmem: clean-up of free_low_memory_core_early() · b4def350
      Joonsoo Kim authored
      Remove unused argument and make function static, because there is no user
      outside of nobootmem.c
      Signed-off-by: default avatarJoonsoo Kim <iamjoonsoo.kim@lge.com>
      Cc: Yinghai Lu <yinghai@kernel.org>
      Acked-by: default avatarJohannes Weiner <hannes@cmpxchg.org>
      Cc: Jiang Liu <liuj97@gmail.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      b4def350
    • majianpeng's avatar
      fs/buffer.c: remove unnecessary init operation after allocating buffer_head. · e7600409
      majianpeng authored
      bh allocation uses kmem_cache_zalloc() so we needn't call
      'init_buffer(bh, NULL, NULL)' and perform other set-zero-operations.
      Signed-off-by: default avatarJianpeng Ma <majianpeng@gmail.com>
      Cc: Jan Kara <jack@suse.cz>
      Cc: Theodore Ts'o <tytso@mit.edu>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      e7600409
    • Yasuaki Ishimatsu's avatar
      numa, cpu hotplug: change links of CPU and node when changing node number by onlining CPU · 34640468
      Yasuaki Ishimatsu authored
      When booting x86 system contains memoryless node, node numbers of CPUs
      on memoryless node were changed to nearest online node number by
      init_cpu_to_node() because the node is not online.
      
      In my system, node numbers of cpu#30-44 and 75-89 were changed from 2 to
      0 as follows:
      
        $ numactl --hardware
        available: 2 nodes (0-1)
        node 0 cpus: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 30 31 32 33 34 35 36 37 38 39 40
        41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 75 76 77 78 79 80 81 82
        83 84 85 86 87 88 89
        node 0 size: 32394 MB
        node 0 free: 27898 MB
        node 1 cpus: 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 60 61 62 63 64 65 66
        67 68 69 70 71 72 73 74
        node 1 size: 32768 MB
        node 1 free: 30335 MB
      
      If we hot add memory to memoryless node and offine/online all CPUs on
      the node, node numbers of these CPUs are changed to correct node numbers
      by srat_detect_node() because the node become online.
      
      In this case, node numbers of cpu#30-44 and 75-89 were changed from 0 to
      2 in my system as follows:
      
        $ numactl --hardware
        available: 3 nodes (0-2)
        node 0 cpus: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 45 46 47 48 49 50 51 52 53 54 55
        56 57 58 59
        node 0 size: 32394 MB
        node 0 free: 27218 MB
        node 1 cpus: 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 60 61 62 63 64 65 66
        67 68 69 70 71 72 73 74
        node 1 size: 32768 MB
        node 1 free: 30014 MB
        node 2 cpus: 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 75 76 77 78 79 80 81
        82 83 84 85 86 87 88 89
        node 2 size: 16384 MB
        node 2 free: 16384 MB
      
      But "cpu to node" and "node to cpu" links were not changed as follows:
      
        $ ls /sys/devices/system/cpu/cpu30/|grep node
        node0
        $ ls /sys/devices/system/node/node0/|grep cpu30
        cpu30
      
      "numactl --hardware" shows that cpu30 belongs to node 2.  But sysfs
      links does not change.
      
      This patch changes "cpu to node" and "node to cpu" links when node
      number changed by onlining CPU.
      Signed-off-by: default avatarYasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>
      Cc: KOSAKI Motohiro <kosaki.motohiro@gmail.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: "H. Peter Anvin" <hpa@zytor.com>
      Cc: "Srivatsa S. Bhat" <srivatsa.bhat@linux.vnet.ibm.com>
      Cc: Greg KH <greg@kroah.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      34640468
    • Randy Dunlap's avatar
      mm: fix memory_hotplug.c printk format warning · 349daa0f
      Randy Dunlap authored
      PFN_PHYS() is a phys_addr_t, which can be u32 or u64.
      Fix the build warning when phys_addr_t is u32.
      
        mm/memory_hotplug.c: warning: format '%llx' expects argument of type 'long long unsigned int', but argument 2 has type 'unsigned int' [-Wformat]:  => 1685:3
        mm/memory_hotplug.c: warning: format '%llx' expects argument of type 'long long unsigned int', but argument 3 has type 'unsigned int' [-Wformat]:  => 1685:3
      Signed-off-by: default avatarRandy Dunlap <rdunlap@infradead.org>
      Reported-by: default avatarGeert Uytterhoeven <geert@linux-m68k.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      349daa0f