History

Merge branch 'akpm' (Andrew's incoming)

Quoth Andrew: - Most of MM. Still waiting for the poweroc guys to get off their butts and review some threaded hugepages patches. - alpha - vfs bits - drivers/misc - a few core kerenl tweaks - printk() features - MAINTAINERS updates - backlight merge - leds merge - various lib/ updates - checkpatch updates * akpm: (127 commits) epoll: fix spurious lockdep warnings checkpatch: add a --strict check for utf-8 in commit logs kernel.h/checkpatch: mark strict_strto<foo> and simple_strto<foo> as obsolete llist-return-whether-list-is-empty-before-adding-in-llist_add-fix wireless: at76c50x: follow rename pack_hex_byte to hex_byte_pack fat: follow rename pack_hex_byte() to hex_byte_pack() security: follow rename pack_hex_byte() to hex_byte_pack() kgdb: follow rename pack_hex_byte() to hex_byte_pack() lib: rename pack_hex_byte() to hex_byte_pack() lib/string.c: fix strim() semantics for strings that have only blanks lib/idr.c: fix comment for ida_get_new_above() lib/percpu_counter.c: enclose hotplug only variables in hotplug ifdef lib/bitmap.c: quiet sparse noise about address space lib/spinlock_debug.c: print owner on spinlock lockup lib/kstrtox: common code between kstrto*() and simple_strto*() functions drivers/leds/leds-lp5521.c: check if reset is successful leds: turn the blink_timer off before starting to blink leds: save the delay values after a successful call to blink_set() drivers/leds/leds-gpio.c: use gpio_get_value_cansleep() when initializing drivers/leds/leds-lm3530.c: add __devexit_p where needed ...

Linus Torvalds committed 15 years ago

Commit 094803e2 parents 32087d4 d8805e6194 files · +2520 −1356Browse files

Unified · Split

194 files
  1. Documentation/kernel-parameters.txt +8 −0
  2. Documentation/sysctl/kernel.txt +8 −0
  3. Documentation/trace/postprocess/trace-vmscan-postprocess.pl +4 −4
  4. MAINTAINERS +6 −1
  5. arch/alpha/include/asm/unistd.h +3 −1
  6. arch/alpha/kernel/systbls.S +2 −0
  7. arch/arm/mach-imx/mach-mx27_3ds.c +2 −4
  8. arch/arm/mach-imx/mach-mx31_3ds.c +2 −4
  9. arch/cris/arch-v10/kernel/kgdb.c +3 −3
  10. arch/cris/arch-v32/kernel/kgdb.c +7 −7
  11. arch/frv/kernel/gdb-stub.c +22 −22
  12. arch/mn10300/kernel/gdb-stub.c +26 −26
  13. arch/powerpc/include/asm/systbl.h +2 −0
  14. arch/powerpc/include/asm/unistd.h +3 −1
  15. arch/x86/ia32/ia32entry.S +2 −0
  16. arch/x86/include/asm/unistd_32.h +3 −1
  17. arch/x86/include/asm/unistd_64.h +4 −0
  18. arch/x86/kernel/syscall_table_32.S +2 −0
  19. drivers/hwmon/hwmon.c +8 −24
  20. drivers/hwmon/ibmaem.c +8 −39
  21. drivers/infiniband/core/umem.c +3 −3
  22. drivers/infiniband/hw/ipath/ipath_user_pages.c +3 −3
  23. drivers/infiniband/hw/qib/qib_user_pages.c +2 −2
  24. drivers/isdn/hisax/callc.c +2 −2
  25. drivers/isdn/hisax/hisax.h +2 −2
  26. drivers/isdn/hisax/isdnl1.h +1 −1
  27. drivers/isdn/hisax/isdnl3.c +1 −1
  28. drivers/isdn/hisax/st5481_d.c +2 −2
  29. drivers/leds/Kconfig +12 −0
  30. drivers/leds/Makefile +1 −0
  31. drivers/leds/led-class.c +6 −1
  32. drivers/leds/led-triggers.c +4 −1
  33. drivers/leds/leds-gpio.c +1 −1
  34. drivers/leds/leds-lm3530.c +1 −2
  35. drivers/leds/leds-lp5521.c +21 −3
  36. drivers/leds/leds-renesas-tpu.c +357 −0
  37. drivers/misc/ad525x_dpot-i2c.c +1 −0
  38. drivers/misc/fsa9480.c +2 −1
  39. drivers/misc/lis3lv02d/lis3lv02d.c +220 −169
  40. drivers/misc/lis3lv02d/lis3lv02d.h +6 −3
  41. drivers/misc/lis3lv02d/lis3lv02d_i2c.c +20 −25
  42. drivers/misc/lis3lv02d/lis3lv02d_spi.c +1 −1
  43. drivers/net/ethernet/mellanox/mlx4/mlx4_en.h +2 −1
  44. drivers/net/wireless/at76c50x-usb.c +1 −1
  45. drivers/net/wireless/ath/ath.h +2 −3
  46. drivers/net/wireless/ath/ath5k/debug.h +2 −2
  47. drivers/net/wireless/ath/ath6kl/debug.h +2 −2
  48. drivers/net/wireless/b43/b43.h +4 −8
  49. drivers/net/wireless/b43legacy/b43legacy.h +8 −8
  50. drivers/platform/x86/hp_accel.c +6 −4
  51. drivers/staging/iio/trigger.h +1 −2
  52. drivers/video/backlight/adp8870_bl.c +0 −2
  53. drivers/video/backlight/generic_bl.c +2 −2
  54. drivers/video/backlight/l4f00242t03.c +23 −47
  55. fs/Kconfig +1 −1
  56. fs/aio.c +2 −2
  57. fs/buffer.c +4 −1
  58. fs/compat.c +4 −3
  59. fs/ecryptfs/ecryptfs_kernel.h +1 −1
  60. fs/eventpoll.c +18 −7
  61. fs/exec.c +0 −4
  62. fs/ext2/ext2.h +4 −4
  63. fs/ext4/ext4.h +22 −22
  64. fs/ext4/inode.c +5 −1
  65. fs/fat/dir.c +2 −2
  66. fs/fat/fat.h +4 −5
  67. fs/gfs2/glock.h +1 −1
  68. fs/hpfs/hpfs_fn.h +2 −2
  69. fs/logfs/logfs.h +0 −1
  70. fs/logfs/super.c +0 −22
  71. fs/nilfs2/nilfs.h +4 −4
  72. fs/ntfs/debug.h +9 −6
  73. fs/ocfs2/super.h +6 −8
  74. fs/partitions/ldm.c +9 −7
  75. fs/pipe.c +1 −0
  76. fs/proc/base.c +0 −13
  77. fs/proc/task_mmu.c +5 −0
  78. fs/read_write.c +5 −3
  79. fs/super.c +1 −1
  80. fs/udf/udfdecl.h +2 −2
  81. fs/ufs/ufs.h +6 −3
  82. fs/xfs/xfs_aops.c +4 −4
  83. fs/xfs/xfs_message.h +20 −22
  84. include/asm-generic/bug.h +6 −5
  85. include/asm-generic/dma-mapping-common.h +12 −2
  86. include/asm-generic/page.h +2 −2
  87. include/drm/drmP.h +5 −5
  88. include/linux/audit.h +5 −6
  89. include/linux/blktrace_api.h +1 −1
  90. include/linux/compaction.h +0 −8
  91. include/linux/compat.h +2 −1
  92. include/linux/device.h +51 −59
  93. include/linux/dmar.h +2 −0
  94. include/linux/dynamic_debug.h +9 −10
  95. include/linux/ext3_fs.h +8 −8
  96. include/linux/fs.h +6 −5
  97. include/linux/fscache-cache.h +4 −4
  98. include/linux/gameport.h +4 −4
  99. include/linux/huge_mm.h +5 −0
  100. include/linux/kallsyms.h +2 −3
  101. include/linux/kdb.h +3 −6
  102. include/linux/kernel.h +30 −25
  103. include/linux/kexec.h +2 −2
  104. include/linux/kmod.h +2 −2
  105. include/linux/kobject.h +12 −14
  106. include/linux/kthread.h +2 −2
  107. include/linux/libata.h +9 −9
  108. include/linux/lis3lv02d.h +0 −1
  109. include/linux/llist.h +1 −1
  110. include/linux/memblock.h +1 −0
  111. include/linux/memcontrol.h +2 −1
  112. include/linux/mm.h +2 −1
  113. include/linux/mm_types.h +9 −5
  114. include/linux/mmiotrace.h +2 −6
  115. include/linux/mmzone.h +13 −0
  116. include/linux/netdevice.h +17 −17
  117. include/linux/oom.h +1 −0
  118. include/linux/platform_data/leds-renesas-tpu.h +14 −0
  119. include/linux/printk.h +6 −6
  120. include/linux/quotaops.h +1 −1
  121. include/linux/seq_file.h +1 −2
  122. include/linux/shrinker.h +1 −0
  123. include/linux/spi/l4f00242t03.h +0 −2
  124. include/linux/string.h +1 −0
  125. include/linux/swap.h +1 −6
  126. include/linux/syscalls.h +13 −0
  127. include/linux/trace_seq.h +4 −4
  128. include/linux/vmalloc.h +1 −0
  129. include/net/bluetooth/bluetooth.h +1 −1
  130. include/net/netfilter/nf_log.h +2 −1
  131. include/net/sock.h +2 −2
  132. include/sound/core.h +2 −2
  133. include/sound/info.h +2 −2
  134. include/sound/seq_kernel.h +2 −2
  135. include/trace/events/vmscan.h +4 −4
  136. include/xen/hvc-console.h +2 −2
  137. include/xen/xenbus.h +6 −6
  138. ipc/mqueue.c +2 −2
  139. kernel/debug/gdbstub.c +6 −6
  140. kernel/events/core.c +3 −3
  141. kernel/exit.c +0 −2
  142. kernel/fork.c +1 −9
  143. kernel/printk.c +7 −3
  144. kernel/stop_machine.c +22 −0
  145. kernel/sys_ni.c +4 −0
  146. kernel/sysctl.c +9 −0
  147. kernel/watchdog.c +2 −2
  148. lib/Kconfig.debug +3 −2
  149. lib/bitmap.c +6 −4
  150. lib/idr.c +2 −2
  151. lib/kstrtox.c +53 −22
  152. lib/kstrtox.h +8 −0
  153. lib/percpu_counter.c +2 −0
  154. lib/radix-tree.c +2 −8
  155. lib/spinlock_debug.c +10 −9
  156. lib/string.c +55 −2
  157. lib/vsprintf.c +14 −33
  158. mm/Kconfig +3 −0
  159. mm/Makefile +2 −1
  160. mm/backing-dev.c +2 −3
  161. mm/compaction.c +11 −15
  162. mm/debug-pagealloc.c +16 −40
  163. mm/highmem.c +1 −1
  164. mm/huge_memory.c +51 −3
  165. mm/ksm.c +2 −1
  166. mm/memblock.c +9 −2
  167. mm/memcontrol.c +2 −1
  168. mm/memory-failure.c +6 −6
  169. mm/mempolicy.c +1 −1
  170. mm/migrate.c +40 −35
  171. mm/mlock.c +11 −2
  172. mm/mmap.c +3 −6
  173. mm/mremap.c +30 −12
  174. mm/oom_kill.c +32 −21
  175. mm/page-writeback.c +3 −1
  176. mm/page_alloc.c +12 −5
  177. mm/process_vm_access.c +496 −0
  178. mm/rmap.c +1 −1
  179. mm/shmem.c +6 −0
  180. mm/slub.c +2 −45
  181. mm/swapfile.c +1 −1
  182. mm/thrash.c +1 −1
  183. mm/vmalloc.c +58 −22
  184. mm/vmscan.c +177 −148
  185. mm/vmstat.c +2 −1
  186. net/nfc/nfc.h +1 −1
  187. net/rds/rds.h +4 −4
  188. net/sunrpc/svc.c +2 −3
  189. scripts/checkpatch.pl +29 −7
  190. security/keys/compat.c +1 −1
  191. security/keys/encrypted-keys/encrypted.c +1 −1
  192. security/keys/keyctl.c +1 −1
  193. security/keys/trusted.c +1 −1
  194. sound/firewire/cmp.c +1 −1
Documentation/kernel-parameters.txt+8−0
@@ -973,6 +973,9 @@ bytes respectively. Such letter suffixes can also be entirely omitted. · 972 unmodified lines
973973 ignore_loglevel [KNL]
974974 Ignore loglevel setting - this will print /all/
975975 kernel messages to the console. Useful for debugging.
976+ We also add it as printk module parameter, so users
977+ could change it dynamically, usually by
978+ /sys/module/printk/parameters/ignore_loglevel.
976979
977980 ihash_entries= [KNL]
978981 Set number of hash buckets for inode cache.
@@ -1666,6 +1669,11 @@ bytes respectively. Such letter suffixes can also be entirely omitted. · 687 unmodified lines
16661669 debugging driver suspend/resume hooks). This may
16671670 not work reliably with all consoles, but is known
16681671 to work with serial and VGA consoles.
1672+ To facilitate more flexible debugging, we also add
1673+ console_suspend, a printk module parameter to control
1674+ it. Users could use console_suspend (usually
1675+ /sys/module/printk/parameters/console_suspend) to
1676+ turn on/off it dynamically.
16691677
16701678 noaliencache [MM, NUMA, SLAB] Disables the allocation of alien
16711679 caches in the slab allocator. Saves per-node memory,
Documentation/sysctl/kernel.txt+8−0
@@ -24,6 +24,7 @@ show up in /proc/sys/kernel: · 23 unmodified lines
2424 - bootloader_type [ X86 only ]
2525 - bootloader_version [ X86 only ]
2626 - callhome [ S390 only ]
27+- cap_last_cap
2728 - core_pattern
2829 - core_pipe_limit
2930 - core_uses_pid
@@ -155,6 +156,13 @@ on has a service contract with IBM. · 125 unmodified lines
155156
156157 ==============================================================
157158
159+cap_last_cap
160+
161+Highest valid capability of the running kernel. Exports
162+CAP_LAST_CAP from the kernel.
163+
164+==============================================================
165+
158166 core_pattern:
159167
160168 core_pattern is used to specify a core dumpfile pattern name.
Documentation/trace/postprocess/trace-vmscan-postprocess.pl+4−4
@@ -379,10 +379,10 @@ EVENT_PROCESS: · 378 unmodified lines
379379
380380 # To closer match vmstat scanning statistics, only count isolate_both
381381 # and isolate_inactive as scanning. isolate_active is rotation
382− # isolate_inactive == 0
383− # isolate_active == 1
384− # isolate_both == 2
385− if ($isolate_mode != 1) {
382+ # isolate_inactive == 1
383+ # isolate_active == 2
384+ # isolate_both == 3
385+ if ($isolate_mode != 2) {
386386 $perprocesspid{$process_pid}->{HIGH_NR_SCANNED} += $nr_scanned;
387387 }
388388 $perprocesspid{$process_pid}->{HIGH_NR_CONTIG_DIRTY} += $nr_contig_dirty;
MAINTAINERS+6−1
@@ -316,6 +316,10 @@ W: http://wiki.analog.com/AD7879 · 315 unmodified lines
316316 S: Supported
317317 F: drivers/input/touchscreen/ad7879.c
318318
319+ADDRESS SPACE LAYOUT RANDOMIZATION (ASLR)
320+M: Jiri Kosina <jkosina@suse.cz>
321+S: Maintained
322+
319323 ADM1025 HARDWARE MONITOR DRIVER
320324 M: Jean Delvare <khali@linux-fr.org>
321325 L: lm-sensors@lm-sensors.org
@@ -4020,6 +4024,7 @@ M: Eric Piel <eric.piel@tremplin-utc.net> · 3698 unmodified lines
40204024 S: Maintained
40214025 F: Documentation/misc-devices/lis3lv02d
40224026 F: drivers/misc/lis3lv02d/
4027+F: drivers/platform/x86/hp_accel.c
40234028
40244029 LLC (802.2)
40254030 M: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
@@ -4974,7 +4979,7 @@ F: include/linux/i2c-algo-pca.h · 948 unmodified lines
49744979 F: include/linux/i2c-pca-platform.h
49754980
49764981 PCI ERROR RECOVERY
4977−M: Linas Vepstas <linas@austin.ibm.com>
4982+M: Linas Vepstas <linasvepstas@gmail.com>
49784983 L: linux-pci@vger.kernel.org
49794984 S: Supported
49804985 F: Documentation/PCI/pci-error-recovery.txt
arch/alpha/include/asm/unistd.h+3−1
@@ -457,10 +457,12 @@ · 456 unmodified lines
457457 #define __NR_clock_adjtime 499
458458 #define __NR_syncfs 500
459459 #define __NR_setns 501
460+#define __NR_accept4 502
461+#define __NR_sendmmsg 503
460462
461463 #ifdef __KERNEL__
462464
463−#define NR_SYSCALLS 502
465+#define NR_SYSCALLS 504
464466
465467 #define __ARCH_WANT_IPC_PARSE_VERSION
466468 #define __ARCH_WANT_OLD_READDIR
arch/alpha/kernel/systbls.S+2−0
@@ -520,6 +520,8 @@ sys_call_table: · 519 unmodified lines
520520 .quad sys_clock_adjtime
521521 .quad sys_syncfs /* 500 */
522522 .quad sys_setns
523+ .quad sys_accept4
524+ .quad sys_sendmmsg
523525
524526 .size sys_call_table, . - sys_call_table
525527 .type sys_call_table, @object
arch/arm/mach-imx/mach-mx27_3ds.c+2−4
@@ -241,7 +241,7 @@ static struct regulator_init_data gpo_init = { · 240 unmodified lines
241241 };
242242
243243 static struct regulator_consumer_supply vmmc1_consumers[] = {
244− REGULATOR_SUPPLY("lcd_2v8", NULL),
244+ REGULATOR_SUPPLY("vcore", "spi0.0"),
245245 };
246246
247247 static struct regulator_init_data vmmc1_init = {
@@ -257,7 +257,7 @@ static struct regulator_init_data vmmc1_init = { · 9 unmodified lines
257257 };
258258
259259 static struct regulator_consumer_supply vgen_consumers[] = {
260− REGULATOR_SUPPLY("vdd_lcdio", NULL),
260+ REGULATOR_SUPPLY("vdd", "spi0.0"),
261261 };
262262
263263 static struct regulator_init_data vgen_init = {
@@ -348,8 +348,6 @@ static const struct imx_fb_platform_data mx27_3ds_fb_data __initconst = { · 84 unmodified lines
348348 static struct l4f00242t03_pdata mx27_3ds_lcd_pdata = {
349349 .reset_gpio = LCD_RESET,
350350 .data_enable_gpio = LCD_ENABLE,
351− .core_supply = "lcd_2v8",
352− .io_supply = "vdd_lcdio",
353351 };
354352
355353 static struct spi_board_info mx27_3ds_spi_devs[] __initdata = {
arch/arm/mach-imx/mach-mx31_3ds.c+2−4
@@ -285,8 +285,6 @@ static struct mx3fb_platform_data mx3fb_pdata __initdata = { · 284 unmodified lines
285285 static struct l4f00242t03_pdata mx31_3ds_l4f00242t03_pdata = {
286286 .reset_gpio = IOMUX_TO_GPIO(MX31_PIN_LCS1),
287287 .data_enable_gpio = IOMUX_TO_GPIO(MX31_PIN_SER_RS),
288− .core_supply = "lcd_2v8",
289− .io_supply = "vdd_lcdio",
290288 };
291289
292290 /*
@@ -411,7 +409,7 @@ static struct regulator_init_data vmmc2_init = { · 118 unmodified lines
411409 };
412410
413411 static struct regulator_consumer_supply vmmc1_consumers[] = {
414− REGULATOR_SUPPLY("lcd_2v8", NULL),
412+ REGULATOR_SUPPLY("vcore", "spi0.0"),
415413 REGULATOR_SUPPLY("cmos_2v8", "soc-camera-pdrv.0"),
416414 };
417415
@@ -428,7 +426,7 @@ static struct regulator_init_data vmmc1_init = { · 10 unmodified lines
428426 };
429427
430428 static struct regulator_consumer_supply vgen_consumers[] = {
431− REGULATOR_SUPPLY("vdd_lcdio", NULL),
429+ REGULATOR_SUPPLY("vdd", "spi0.0"),
432430 };
433431
434432 static struct regulator_init_data vgen_init = {
arch/cris/arch-v10/kernel/kgdb.c+3−3
@@ -694,7 +694,7 @@ mem2hex(char *buf, unsigned char *mem, int count) · 693 unmodified lines
694694 /* Valid mem address. */
695695 for (i = 0; i < count; i++) {
696696 ch = *mem++;
697− buf = pack_hex_byte(buf, ch);
697+ buf = hex_byte_pack(buf, ch);
698698 }
699699 }
700700
@@ -868,7 +868,7 @@ stub_is_stopped(int sigval) · 167 unmodified lines
868868 /* Send trap type (converted to signal) */
869869
870870 *ptr++ = 'T';
871− ptr = pack_hex_byte(ptr, sigval);
871+ ptr = hex_byte_pack(ptr, sigval);
872872
873873 /* Send register contents. We probably only need to send the
874874 * PC, frame pointer and stack pointer here. Other registers will be
@@ -881,7 +881,7 @@ stub_is_stopped(int sigval) · 6 unmodified lines
881881 status = read_register (regno, &reg_cont);
882882
883883 if (status == SUCCESS) {
884− ptr = pack_hex_byte(ptr, regno);
884+ ptr = hex_byte_pack(ptr, regno);
885885 *ptr++ = ':';
886886
887887 ptr = mem2hex(ptr, (unsigned char *)&reg_cont,
arch/cris/arch-v32/kernel/kgdb.c+7−7
@@ -677,7 +677,7 @@ mem2hex(char *buf, unsigned char *mem, int count) · 676 unmodified lines
677677 /* Valid mem address. */
678678 for (i = 0; i < count; i++) {
679679 ch = *mem++;
680− buf = pack_hex_byte(buf, ch);
680+ buf = hex_byte_pack(buf, ch);
681681 }
682682 }
683683 /* Terminate properly. */
@@ -695,7 +695,7 @@ mem2hex_nbo(char *buf, unsigned char *mem, int count) · 11 unmodified lines
695695 mem += count - 1;
696696 for (i = 0; i < count; i++) {
697697 ch = *mem--;
698− buf = pack_hex_byte(buf, ch);
698+ buf = hex_byte_pack(buf, ch);
699699 }
700700
701701 /* Terminate properly. */
@@ -880,7 +880,7 @@ stub_is_stopped(int sigval) · 178 unmodified lines
880880 /* Send trap type (converted to signal) */
881881
882882 *ptr++ = 'T';
883− ptr = pack_hex_byte(ptr, sigval);
883+ ptr = hex_byte_pack(ptr, sigval);
884884
885885 if (((reg.exs & 0xff00) >> 8) == 0xc) {
886886
@@ -988,26 +988,26 @@ stub_is_stopped(int sigval) · 101 unmodified lines
988988 }
989989 /* Only send PC, frame and stack pointer. */
990990 read_register(PC, &reg_cont);
991− ptr = pack_hex_byte(ptr, PC);
991+ ptr = hex_byte_pack(ptr, PC);
992992 *ptr++ = ':';
993993 ptr = mem2hex(ptr, (unsigned char *)&reg_cont, register_size[PC]);
994994 *ptr++ = ';';
995995
996996 read_register(R8, &reg_cont);
997− ptr = pack_hex_byte(ptr, R8);
997+ ptr = hex_byte_pack(ptr, R8);
998998 *ptr++ = ':';
999999 ptr = mem2hex(ptr, (unsigned char *)&reg_cont, register_size[R8]);
10001000 *ptr++ = ';';
10011001
10021002 read_register(SP, &reg_cont);
1003− ptr = pack_hex_byte(ptr, SP);
1003+ ptr = hex_byte_pack(ptr, SP);
10041004 *ptr++ = ':';
10051005 ptr = mem2hex(ptr, (unsigned char *)&reg_cont, register_size[SP]);
10061006 *ptr++ = ';';
10071007
10081008 /* Send ERP as well; this will save us an entire register fetch in some cases. */
10091009 read_register(ERP, &reg_cont);
1010− ptr = pack_hex_byte(ptr, ERP);
1010+ ptr = hex_byte_pack(ptr, ERP);
10111011 *ptr++ = ':';
10121012 ptr = mem2hex(ptr, (unsigned char *)&reg_cont, register_size[ERP]);
10131013 *ptr++ = ';';
arch/frv/kernel/gdb-stub.c+22−22
@@ -672,7 +672,7 @@ static unsigned char *mem2hex(const void *_mem, char *buf, int count, int may_fa · 671 unmodified lines
672672 if ((uint32_t)mem&1 && count>=1) {
673673 if (!gdbstub_read_byte(mem,ch))
674674 return NULL;
675− buf = pack_hex_byte(buf, ch[0]);
675+ buf = hex_byte_pack(buf, ch[0]);
676676 mem++;
677677 count--;
678678 }
@@ -680,8 +680,8 @@ static unsigned char *mem2hex(const void *_mem, char *buf, int count, int may_fa · 1 unmodified line
680680 if ((uint32_t)mem&3 && count>=2) {
681681 if (!gdbstub_read_word(mem,(uint16_t *)ch))
682682 return NULL;
683− buf = pack_hex_byte(buf, ch[0]);
684− buf = pack_hex_byte(buf, ch[1]);
683+ buf = hex_byte_pack(buf, ch[0]);
684+ buf = hex_byte_pack(buf, ch[1]);
685685 mem += 2;
686686 count -= 2;
687687 }
@@ -689,10 +689,10 @@ static unsigned char *mem2hex(const void *_mem, char *buf, int count, int may_fa · 1 unmodified line
689689 while (count>=4) {
690690 if (!gdbstub_read_dword(mem,(uint32_t *)ch))
691691 return NULL;
692− buf = pack_hex_byte(buf, ch[0]);
693− buf = pack_hex_byte(buf, ch[1]);
694− buf = pack_hex_byte(buf, ch[2]);
695− buf = pack_hex_byte(buf, ch[3]);
692+ buf = hex_byte_pack(buf, ch[0]);
693+ buf = hex_byte_pack(buf, ch[1]);
694+ buf = hex_byte_pack(buf, ch[2]);
695+ buf = hex_byte_pack(buf, ch[3]);
696696 mem += 4;
697697 count -= 4;
698698 }
@@ -700,8 +700,8 @@ static unsigned char *mem2hex(const void *_mem, char *buf, int count, int may_fa · 1 unmodified line
700700 if (count>=2) {
701701 if (!gdbstub_read_word(mem,(uint16_t *)ch))
702702 return NULL;
703− buf = pack_hex_byte(buf, ch[0]);
704− buf = pack_hex_byte(buf, ch[1]);
703+ buf = hex_byte_pack(buf, ch[0]);
704+ buf = hex_byte_pack(buf, ch[1]);
705705 mem += 2;
706706 count -= 2;
707707 }
@@ -709,7 +709,7 @@ static unsigned char *mem2hex(const void *_mem, char *buf, int count, int may_fa · 1 unmodified line
709709 if (count>=1) {
710710 if (!gdbstub_read_byte(mem,ch))
711711 return NULL;
712− buf = pack_hex_byte(buf, ch[0]);
712+ buf = hex_byte_pack(buf, ch[0]);
713713 }
714714
715715 *buf = 0;
@@ -1498,21 +1498,21 @@ void gdbstub(int sigval) · 782 unmodified lines
14981498 ptr = mem2hex(title, ptr, sizeof(title) - 1,0);
14991499
15001500 hx = hex_asc_hi(brr >> 24);
1501− ptr = pack_hex_byte(ptr, hx);
1501+ ptr = hex_byte_pack(ptr, hx);
15021502 hx = hex_asc_lo(brr >> 24);
1503− ptr = pack_hex_byte(ptr, hx);
1503+ ptr = hex_byte_pack(ptr, hx);
15041504 hx = hex_asc_hi(brr >> 16);
1505− ptr = pack_hex_byte(ptr, hx);
1505+ ptr = hex_byte_pack(ptr, hx);
15061506 hx = hex_asc_lo(brr >> 16);
1507− ptr = pack_hex_byte(ptr, hx);
1507+ ptr = hex_byte_pack(ptr, hx);
15081508 hx = hex_asc_hi(brr >> 8);
1509− ptr = pack_hex_byte(ptr, hx);
1509+ ptr = hex_byte_pack(ptr, hx);
15101510 hx = hex_asc_lo(brr >> 8);
1511− ptr = pack_hex_byte(ptr, hx);
1511+ ptr = hex_byte_pack(ptr, hx);
15121512 hx = hex_asc_hi(brr);
1513− ptr = pack_hex_byte(ptr, hx);
1513+ ptr = hex_byte_pack(ptr, hx);
15141514 hx = hex_asc_lo(brr);
1515− ptr = pack_hex_byte(ptr, hx);
1515+ ptr = hex_byte_pack(ptr, hx);
15161516
15171517 ptr = mem2hex(crlf, ptr, sizeof(crlf) - 1, 0);
15181518 *ptr = 0;
@@ -1526,10 +1526,10 @@ void gdbstub(int sigval) · 7 unmodified lines
15261526
15271527 /* Send trap type (converted to signal) */
15281528 *ptr++ = 'T';
1529− ptr = pack_hex_byte(ptr, sigval);
1529+ ptr = hex_byte_pack(ptr, sigval);
15301530
15311531 /* Send Error PC */
1532− ptr = pack_hex_byte(ptr, GDB_REG_PC);
1532+ ptr = hex_byte_pack(ptr, GDB_REG_PC);
15331533 *ptr++ = ':';
15341534 ptr = mem2hex(&__debug_frame->pc, ptr, 4, 0);
15351535 *ptr++ = ';';
@@ -1537,7 +1537,7 @@ void gdbstub(int sigval) · 1 unmodified line
15371537 /*
15381538 * Send frame pointer
15391539 */
1540− ptr = pack_hex_byte(ptr, GDB_REG_FP);
1540+ ptr = hex_byte_pack(ptr, GDB_REG_FP);
15411541 *ptr++ = ':';
15421542 ptr = mem2hex(&__debug_frame->fp, ptr, 4, 0);
15431543 *ptr++ = ';';
@@ -1545,7 +1545,7 @@ void gdbstub(int sigval) · 1 unmodified line
15451545 /*
15461546 * Send stack pointer
15471547 */
1548− ptr = pack_hex_byte(ptr, GDB_REG_SP);
1548+ ptr = hex_byte_pack(ptr, GDB_REG_SP);
15491549 *ptr++ = ':';
15501550 ptr = mem2hex(&__debug_frame->sp, ptr, 4, 0);
15511551 *ptr++ = ';';
arch/mn10300/kernel/gdb-stub.c+26−26
@@ -798,7 +798,7 @@ unsigned char *mem2hex(const void *_mem, char *buf, int count, int may_fault) · 797 unmodified lines
798798 if ((u32) mem & 1 && count >= 1) {
799799 if (gdbstub_read_byte(mem, ch) != 0)
800800 return 0;
801− buf = pack_hex_byte(buf, ch[0]);
801+ buf = hex_byte_pack(buf, ch[0]);
802802 mem++;
803803 count--;
804804 }
@@ -806,8 +806,8 @@ unsigned char *mem2hex(const void *_mem, char *buf, int count, int may_fault) · 1 unmodified line
806806 if ((u32) mem & 3 && count >= 2) {
807807 if (gdbstub_read_word(mem, ch) != 0)
808808 return 0;
809− buf = pack_hex_byte(buf, ch[0]);
810− buf = pack_hex_byte(buf, ch[1]);
809+ buf = hex_byte_pack(buf, ch[0]);
810+ buf = hex_byte_pack(buf, ch[1]);
811811 mem += 2;
812812 count -= 2;
813813 }
@@ -815,10 +815,10 @@ unsigned char *mem2hex(const void *_mem, char *buf, int count, int may_fault) · 1 unmodified line
815815 while (count >= 4) {
816816 if (gdbstub_read_dword(mem, ch) != 0)
817817 return 0;
818− buf = pack_hex_byte(buf, ch[0]);
819− buf = pack_hex_byte(buf, ch[1]);
820− buf = pack_hex_byte(buf, ch[2]);
821− buf = pack_hex_byte(buf, ch[3]);
818+ buf = hex_byte_pack(buf, ch[0]);
819+ buf = hex_byte_pack(buf, ch[1]);
820+ buf = hex_byte_pack(buf, ch[2]);
821+ buf = hex_byte_pack(buf, ch[3]);
822822 mem += 4;
823823 count -= 4;
824824 }
@@ -826,8 +826,8 @@ unsigned char *mem2hex(const void *_mem, char *buf, int count, int may_fault) · 1 unmodified line
826826 if (count >= 2) {
827827 if (gdbstub_read_word(mem, ch) != 0)
828828 return 0;
829− buf = pack_hex_byte(buf, ch[0]);
830− buf = pack_hex_byte(buf, ch[1]);
829+ buf = hex_byte_pack(buf, ch[0]);
830+ buf = hex_byte_pack(buf, ch[1]);
831831 mem += 2;
832832 count -= 2;
833833 }
@@ -835,7 +835,7 @@ unsigned char *mem2hex(const void *_mem, char *buf, int count, int may_fault) · 1 unmodified line
835835 if (count >= 1) {
836836 if (gdbstub_read_byte(mem, ch) != 0)
837837 return 0;
838− buf = pack_hex_byte(buf, ch[0]);
838+ buf = hex_byte_pack(buf, ch[0]);
839839 }
840840
841841 *buf = 0;
@@ -1273,13 +1273,13 @@ static int gdbstub(struct pt_regs *regs, enum exception_code excep) · 431 unmodified lines
12731273 ptr = mem2hex(title, ptr, sizeof(title) - 1, 0);
12741274
12751275 hx = hex_asc_hi(excep >> 8);
1276− ptr = pack_hex_byte(ptr, hx);
1276+ ptr = hex_byte_pack(ptr, hx);
12771277 hx = hex_asc_lo(excep >> 8);
1278− ptr = pack_hex_byte(ptr, hx);
1278+ ptr = hex_byte_pack(ptr, hx);
12791279 hx = hex_asc_hi(excep);
1280− ptr = pack_hex_byte(ptr, hx);
1280+ ptr = hex_byte_pack(ptr, hx);
12811281 hx = hex_asc_lo(excep);
1282− ptr = pack_hex_byte(ptr, hx);
1282+ ptr = hex_byte_pack(ptr, hx);
12831283
12841284 ptr = mem2hex(crlf, ptr, sizeof(crlf) - 1, 0);
12851285 *ptr = 0;
@@ -1291,21 +1291,21 @@ static int gdbstub(struct pt_regs *regs, enum exception_code excep) · 5 unmodified lines
12911291 ptr = mem2hex(tbcberr, ptr, sizeof(tbcberr) - 1, 0);
12921292
12931293 hx = hex_asc_hi(bcberr >> 24);
1294− ptr = pack_hex_byte(ptr, hx);
1294+ ptr = hex_byte_pack(ptr, hx);
12951295 hx = hex_asc_lo(bcberr >> 24);
1296− ptr = pack_hex_byte(ptr, hx);
1296+ ptr = hex_byte_pack(ptr, hx);
12971297 hx = hex_asc_hi(bcberr >> 16);
1298− ptr = pack_hex_byte(ptr, hx);
1298+ ptr = hex_byte_pack(ptr, hx);
12991299 hx = hex_asc_lo(bcberr >> 16);
1300− ptr = pack_hex_byte(ptr, hx);
1300+ ptr = hex_byte_pack(ptr, hx);
13011301 hx = hex_asc_hi(bcberr >> 8);
1302− ptr = pack_hex_byte(ptr, hx);
1302+ ptr = hex_byte_pack(ptr, hx);
13031303 hx = hex_asc_lo(bcberr >> 8);
1304− ptr = pack_hex_byte(ptr, hx);
1304+ ptr = hex_byte_pack(ptr, hx);
13051305 hx = hex_asc_hi(bcberr);
1306− ptr = pack_hex_byte(ptr, hx);
1306+ ptr = hex_byte_pack(ptr, hx);
13071307 hx = hex_asc_lo(bcberr);
1308− ptr = pack_hex_byte(ptr, hx);
1308+ ptr = hex_byte_pack(ptr, hx);
13091309
13101310 ptr = mem2hex(crlf, ptr, sizeof(crlf) - 1, 0);
13111311 *ptr = 0;
@@ -1321,12 +1321,12 @@ static int gdbstub(struct pt_regs *regs, enum exception_code excep) · 9 unmodified lines
13211321 * Send trap type (converted to signal)
13221322 */
13231323 *ptr++ = 'T';
1324− ptr = pack_hex_byte(ptr, sigval);
1324+ ptr = hex_byte_pack(ptr, sigval);
13251325
13261326 /*
13271327 * Send Error PC
13281328 */
1329− ptr = pack_hex_byte(ptr, GDB_REGID_PC);
1329+ ptr = hex_byte_pack(ptr, GDB_REGID_PC);
13301330 *ptr++ = ':';
13311331 ptr = mem2hex(&regs->pc, ptr, 4, 0);
13321332 *ptr++ = ';';
@@ -1334,7 +1334,7 @@ static int gdbstub(struct pt_regs *regs, enum exception_code excep) · 1 unmodified line
13341334 /*
13351335 * Send frame pointer
13361336 */
1337− ptr = pack_hex_byte(ptr, GDB_REGID_FP);
1337+ ptr = hex_byte_pack(ptr, GDB_REGID_FP);
13381338 *ptr++ = ':';
13391339 ptr = mem2hex(&regs->a3, ptr, 4, 0);
13401340 *ptr++ = ';';
@@ -1343,7 +1343,7 @@ static int gdbstub(struct pt_regs *regs, enum exception_code excep) · 2 unmodified lines
13431343 * Send stack pointer
13441344 */
13451345 ssp = (unsigned long) (regs + 1);
1346− ptr = pack_hex_byte(ptr, GDB_REGID_SP);
1346+ ptr = hex_byte_pack(ptr, GDB_REGID_SP);
13471347 *ptr++ = ':';
13481348 ptr = mem2hex(&ssp, ptr, 4, 0);
13491349 *ptr++ = ';';
arch/powerpc/include/asm/systbl.h+2−0
@@ -354,3 +354,5 @@ COMPAT_SYS_SPU(clock_adjtime) · 353 unmodified lines
354354 SYSCALL_SPU(syncfs)
355355 COMPAT_SYS_SPU(sendmmsg)
356356 SYSCALL_SPU(setns)
357+COMPAT_SYS(process_vm_readv)
358+COMPAT_SYS(process_vm_writev)
arch/powerpc/include/asm/unistd.h+3−1
@@ -373,10 +373,12 @@ · 372 unmodified lines
373373 #define __NR_syncfs 348
374374 #define __NR_sendmmsg 349
375375 #define __NR_setns 350
376+#define __NR_process_vm_readv 351
377+#define __NR_process_vm_writev 352
376378
377379 #ifdef __KERNEL__
378380
379−#define __NR_syscalls 351
381+#define __NR_syscalls 353
380382
381383 #define __NR__exit __NR_exit
382384 #define NR_syscalls __NR_syscalls
arch/x86/ia32/ia32entry.S+2−0
@@ -850,4 +850,6 @@ ia32_sys_call_table: · 849 unmodified lines
850850 .quad sys_syncfs
851851 .quad compat_sys_sendmmsg /* 345 */
852852 .quad sys_setns
853+ .quad compat_sys_process_vm_readv
854+ .quad compat_sys_process_vm_writev
853855 ia32_syscall_end:
arch/x86/include/asm/unistd_32.h+3−1
@@ -352,10 +352,12 @@ · 351 unmodified lines
352352 #define __NR_syncfs 344
353353 #define __NR_sendmmsg 345
354354 #define __NR_setns 346
355+#define __NR_process_vm_readv 347
356+#define __NR_process_vm_writev 348
355357
356358 #ifdef __KERNEL__
357359
358−#define NR_syscalls 347
360+#define NR_syscalls 349
359361
360362 #define __ARCH_WANT_IPC_PARSE_VERSION
361363 #define __ARCH_WANT_OLD_READDIR
arch/x86/include/asm/unistd_64.h+4−0
@@ -682,6 +682,10 @@ __SYSCALL(__NR_sendmmsg, sys_sendmmsg) · 681 unmodified lines
682682 __SYSCALL(__NR_setns, sys_setns)
683683 #define __NR_getcpu 309
684684 __SYSCALL(__NR_getcpu, sys_getcpu)
685+#define __NR_process_vm_readv 310
686+__SYSCALL(__NR_process_vm_readv, sys_process_vm_readv)
687+#define __NR_process_vm_writev 311
688+__SYSCALL(__NR_process_vm_writev, sys_process_vm_writev)
685689
686690 #ifndef __NO_STUBS
687691 #define __ARCH_WANT_OLD_READDIR
arch/x86/kernel/syscall_table_32.S+2−0
@@ -346,3 +346,5 @@ ENTRY(sys_call_table) · 345 unmodified lines
346346 .long sys_syncfs
347347 .long sys_sendmmsg /* 345 */
348348 .long sys_setns
349+ .long sys_process_vm_readv
350+ .long sys_process_vm_writev
drivers/hwmon/hwmon.c+8−24
@@ -27,8 +27,7 @@ · 26 unmodified lines
2727
2828 static struct class *hwmon_class;
2929
30−static DEFINE_IDR(hwmon_idr);
31−static DEFINE_SPINLOCK(idr_lock);
30+static DEFINE_IDA(hwmon_ida);
3231
3332 /**
3433 * hwmon_device_register - register w/ hwmon
@@ -42,30 +41,17 @@ static DEFINE_SPINLOCK(idr_lock); · 7 unmodified lines
4241 struct device *hwmon_device_register(struct device *dev)
4342 {
4443 struct device *hwdev;
45− int id, err;
46−
47−again:
48− if (unlikely(idr_pre_get(&hwmon_idr, GFP_KERNEL) == 0))
49− return ERR_PTR(-ENOMEM);
50−
51− spin_lock(&idr_lock);
52− err = idr_get_new(&hwmon_idr, NULL, &id);
53− spin_unlock(&idr_lock);
44+ int id;
5445
55− if (unlikely(err == -EAGAIN))
56− goto again;
57− else if (unlikely(err))
58− return ERR_PTR(err);
46+ id = ida_simple_get(&hwmon_ida, 0, 0, GFP_KERNEL);
47+ if (id < 0)
48+ return ERR_PTR(id);
5949
60− id = id & MAX_ID_MASK;
6150 hwdev = device_create(hwmon_class, dev, MKDEV(0, 0), NULL,
6251 HWMON_ID_FORMAT, id);
6352
64− if (IS_ERR(hwdev)) {
65− spin_lock(&idr_lock);
66− idr_remove(&hwmon_idr, id);
67− spin_unlock(&idr_lock);
68− }
53+ if (IS_ERR(hwdev))
54+ ida_simple_remove(&hwmon_ida, id);
6955
7056 return hwdev;
7157 }
@@ -81,9 +67,7 @@ void hwmon_device_unregister(struct device *dev) · 9 unmodified lines
8167
8268 if (likely(sscanf(dev_name(dev), HWMON_ID_FORMAT, &id) == 1)) {
8369 device_unregister(dev);
84− spin_lock(&idr_lock);
85− idr_remove(&hwmon_idr, id);
86− spin_unlock(&idr_lock);
70+ ida_simple_remove(&hwmon_ida, id);
8771 } else
8872 dev_dbg(dev->parent,
8973 "hwmon_device_unregister() failed: bad class ID!\n");
drivers/hwmon/ibmaem.c+8−39
@@ -88,8 +88,7 @@ · 87 unmodified lines
8888 #define AEM_MIN_POWER_INTERVAL 200
8989 #define UJ_PER_MJ 1000L
9090
91−static DEFINE_IDR(aem_idr);
92−static DEFINE_SPINLOCK(aem_idr_lock);
91+static DEFINE_IDA(aem_ida);
9392
9493 static struct platform_driver aem_driver = {
9594 .driver = {
@@ -356,38 +355,6 @@ static void aem_msg_handler(struct ipmi_recv_msg *msg, void *user_msg_data) · 260 unmodified lines
356355 complete(&data->read_complete);
357356 }
358357
359−/* ID functions */
360−
361−/* Obtain an id */
362−static int aem_idr_get(int *id)
363−{
364− int i, err;
365−
366−again:
367− if (unlikely(!idr_pre_get(&aem_idr, GFP_KERNEL)))
368− return -ENOMEM;
369−
370− spin_lock(&aem_idr_lock);
371− err = idr_get_new(&aem_idr, NULL, &i);
372− spin_unlock(&aem_idr_lock);
373−
374− if (unlikely(err == -EAGAIN))
375− goto again;
376− else if (unlikely(err))
377− return err;
378−
379− *id = i & MAX_ID_MASK;
380− return 0;
381−}
382−
383−/* Release an object ID */
384−static void aem_idr_put(int id)
385−{
386− spin_lock(&aem_idr_lock);
387− idr_remove(&aem_idr, id);
388− spin_unlock(&aem_idr_lock);
389−}
390−
391358 /* Sensor support functions */
392359
393360 /* Read a sensor value */
@@ -530,7 +497,7 @@ static void aem_delete(struct aem_data *data) · 136 unmodified lines
530497 ipmi_destroy_user(data->ipmi.user);
531498 platform_set_drvdata(data->pdev, NULL);
532499 platform_device_unregister(data->pdev);
533− aem_idr_put(data->id);
500+ ida_simple_remove(&aem_ida, data->id);
534501 kfree(data);
535502 }
536503
@@ -587,7 +554,8 @@ static int aem_init_aem1_inst(struct aem_ipmi_data *probe, u8 module_handle) · 50 unmodified lines
587554 data->power_period[i] = AEM_DEFAULT_POWER_INTERVAL;
588555
589556 /* Create sub-device for this fw instance */
590− if (aem_idr_get(&data->id))
557+ data->id = ida_simple_get(&aem_ida, 0, 0, GFP_KERNEL);
558+ if (data->id < 0)
591559 goto id_err;
592560
593561 data->pdev = platform_device_alloc(DRVNAME, data->id);
@@ -638,7 +606,7 @@ ipmi_err: · 44 unmodified lines
638606 platform_set_drvdata(data->pdev, NULL);
639607 platform_device_unregister(data->pdev);
640608 dev_err:
641− aem_idr_put(data->id);
609+ ida_simple_remove(&aem_ida, data->id);
642610 id_err:
643611 kfree(data);
644612
@@ -720,7 +688,8 @@ static int aem_init_aem2_inst(struct aem_ipmi_data *probe, · 75 unmodified lines
720688 data->power_period[i] = AEM_DEFAULT_POWER_INTERVAL;
721689
722690 /* Create sub-device for this fw instance */
723− if (aem_idr_get(&data->id))
691+ data->id = ida_simple_get(&aem_ida, 0, 0, GFP_KERNEL);
692+ if (data->id < 0)
724693 goto id_err;
725694
726695 data->pdev = platform_device_alloc(DRVNAME, data->id);
@@ -771,7 +740,7 @@ ipmi_err: · 44 unmodified lines
771740 platform_set_drvdata(data->pdev, NULL);
772741 platform_device_unregister(data->pdev);
773742 dev_err:
774− aem_idr_put(data->id);
743+ ida_simple_remove(&aem_ida, data->id);
775744 id_err:
776745 kfree(data);
777746
drivers/infiniband/core/umem.c+3−3
@@ -136,7 +136,7 @@ struct ib_umem *ib_umem_get(struct ib_ucontext *context, unsigned long addr, · 135 unmodified lines
136136
137137 down_write(&current->mm->mmap_sem);
138138
139− locked = npages + current->mm->locked_vm;
139+ locked = npages + current->mm->pinned_vm;
140140 lock_limit = rlimit(RLIMIT_MEMLOCK) >> PAGE_SHIFT;
141141
142142 if ((locked > lock_limit) && !capable(CAP_IPC_LOCK)) {
@@ -206,7 +206,7 @@ out: · 63 unmodified lines
206206 __ib_umem_release(context->device, umem, 0);
207207 kfree(umem);
208208 } else
209− current->mm->locked_vm = locked;
209+ current->mm->pinned_vm = locked;
210210
211211 up_write(&current->mm->mmap_sem);
212212 if (vma_list)
@@ -222,7 +222,7 @@ static void ib_umem_account(struct work_struct *work) · 9 unmodified lines
222222 struct ib_umem *umem = container_of(work, struct ib_umem, work);
223223
224224 down_write(&umem->mm->mmap_sem);
225− umem->mm->locked_vm -= umem->diff;
225+ umem->mm->pinned_vm -= umem->diff;
226226 up_write(&umem->mm->mmap_sem);
227227 mmput(umem->mm);
228228 kfree(umem);
drivers/infiniband/hw/ipath/ipath_user_pages.c+3−3
@@ -79,7 +79,7 @@ static int __ipath_get_user_pages(unsigned long start_page, size_t num_pages, · 78 unmodified lines
7979 goto bail_release;
8080 }
8181
82− current->mm->locked_vm += num_pages;
82+ current->mm->pinned_vm += num_pages;
8383
8484 ret = 0;
8585 goto bail;
@@ -178,7 +178,7 @@ void ipath_release_user_pages(struct page **p, size_t num_pages) · 92 unmodified lines
178178
179179 __ipath_release_user_pages(p, num_pages, 1);
180180
181− current->mm->locked_vm -= num_pages;
181+ current->mm->pinned_vm -= num_pages;
182182
183183 up_write(&current->mm->mmap_sem);
184184 }
@@ -195,7 +195,7 @@ static void user_pages_account(struct work_struct *_work) · 10 unmodified lines
195195 container_of(_work, struct ipath_user_pages_work, work);
196196
197197 down_write(&work->mm->mmap_sem);
198− work->mm->locked_vm -= work->num_pages;
198+ work->mm->pinned_vm -= work->num_pages;
199199 up_write(&work->mm->mmap_sem);
200200 mmput(work->mm);
201201 kfree(work);
drivers/infiniband/hw/qib/qib_user_pages.c+2−2
@@ -74,7 +74,7 @@ static int __qib_get_user_pages(unsigned long start_page, size_t num_pages, · 73 unmodified lines
7474 goto bail_release;
7575 }
7676
77− current->mm->locked_vm += num_pages;
77+ current->mm->pinned_vm += num_pages;
7878
7979 ret = 0;
8080 goto bail;
@@ -151,7 +151,7 @@ void qib_release_user_pages(struct page **p, size_t num_pages) · 70 unmodified lines
151151 __qib_release_user_pages(p, num_pages, 1);
152152
153153 if (current->mm) {
154− current->mm->locked_vm -= num_pages;
154+ current->mm->pinned_vm -= num_pages;
155155 up_write(&current->mm->mmap_sem);
156156 }
157157 }
drivers/isdn/hisax/callc.c+2−2
@@ -65,7 +65,7 @@ hisax_findcard(int driverid) · 64 unmodified lines
6565 return (struct IsdnCardState *) 0;
6666 }
6767
68−static __attribute__((format(printf, 3, 4))) void
68+static __printf(3, 4) void
6969 link_debug(struct Channel *chanp, int direction, char *fmt, ...)
7070 {
7171 va_list args;
@@ -1068,7 +1068,7 @@ init_d_st(struct Channel *chanp) · 996 unmodified lines
10681068 return 0;
10691069 }
10701070
1071−static __attribute__((format(printf, 2, 3))) void
1071+static __printf(2, 3) void
10721072 callc_debug(struct FsmInst *fi, char *fmt, ...)
10731073 {
10741074 va_list args;
drivers/isdn/hisax/hisax.h+2−2
@@ -1287,9 +1287,9 @@ int jiftime(char *s, long mark); · 1286 unmodified lines
12871287
12881288 int HiSax_command(isdn_ctrl * ic);
12891289 int HiSax_writebuf_skb(int id, int chan, int ack, struct sk_buff *skb);
1290−__attribute__((format(printf, 3, 4)))
1290+__printf(3, 4)
12911291 void HiSax_putstatus(struct IsdnCardState *cs, char *head, char *fmt, ...);
1292−__attribute__((format(printf, 3, 0)))
1292+__printf(3, 0)
12931293 void VHiSax_putstatus(struct IsdnCardState *cs, char *head, char *fmt, va_list args);
12941294 void HiSax_reportcard(int cardnr, int sel);
12951295 int QuickHex(char *txt, u_char * p, int cnt);
drivers/isdn/hisax/isdnl1.h+1−1
@@ -21,7 +21,7 @@ · 20 unmodified lines
2121 #define B_XMTBUFREADY 1
2222 #define B_ACKPENDING 2
2323
24−__attribute__((format(printf, 2, 3)))
24+__printf(2, 3)
2525 void debugl1(struct IsdnCardState *cs, char *fmt, ...);
2626 void DChannel_proc_xmt(struct IsdnCardState *cs);
2727 void DChannel_proc_rcv(struct IsdnCardState *cs);
drivers/isdn/hisax/isdnl3.c+1−1
@@ -66,7 +66,7 @@ static char *strL3Event[] = · 65 unmodified lines
6666 "EV_TIMEOUT",
6767 };
6868
69−static __attribute__((format(printf, 2, 3))) void
69+static __printf(2, 3) void
7070 l3m_debug(struct FsmInst *fi, char *fmt, ...)
7171 {
7272 va_list args;
drivers/isdn/hisax/st5481_d.c+2−2
@@ -167,7 +167,7 @@ static struct FsmNode L1FnList[] __initdata = · 166 unmodified lines
167167 {ST_L1_F8, EV_IND_RSY, l1_ignore},
168168 };
169169
170−static __attribute__((format(printf, 2, 3)))
170+static __printf(2, 3)
171171 void l1m_debug(struct FsmInst *fi, char *fmt, ...)
172172 {
173173 va_list args;
@@ -270,7 +270,7 @@ static char *strDoutEvent[] = · 96 unmodified lines
270270 "EV_DOUT_UNDERRUN",
271271 };
272272
273−static __attribute__((format(printf, 2, 3)))
273+static __printf(2, 3)
274274 void dout_debug(struct FsmInst *fi, char *fmt, ...)
275275 {
276276 va_list args;
drivers/leds/Kconfig+12−0
@@ -375,6 +375,18 @@ config LEDS_ASIC3 · 374 unmodified lines
375375 cannot be used. This driver supports hardware blinking with an on+off
376376 period from 62ms to 125s. Say Y to enable LEDs on the HP iPAQ hx4700.
377377
378+config LEDS_RENESAS_TPU
379+ bool "LED support for Renesas TPU"
380+ depends on LEDS_CLASS && HAVE_CLK && GENERIC_GPIO
381+ help
382+ This option enables build of the LED TPU platform driver,
383+ suitable to drive any TPU channel on newer Renesas SoCs.
384+ The driver controls the GPIO pin connected to the LED via
385+ the GPIO framework and expects the LED to be connected to
386+ a pin that can be driven in both GPIO mode and using TPU
387+ pin function. The latter to support brightness control.
388+ Brightness control is supported but hardware blinking is not.
389+
378390 config LEDS_TRIGGERS
379391 bool "LED Trigger support"
380392 depends on LEDS_CLASS
drivers/leds/Makefile+1−0
@@ -42,6 +42,7 @@ obj-$(CONFIG_LEDS_MC13783) += leds-mc13783.o · 41 unmodified lines
4242 obj-$(CONFIG_LEDS_NS2) += leds-ns2.o
4343 obj-$(CONFIG_LEDS_NETXBIG) += leds-netxbig.o
4444 obj-$(CONFIG_LEDS_ASIC3) += leds-asic3.o
45+obj-$(CONFIG_LEDS_RENESAS_TPU) += leds-renesas-tpu.o
4546
4647 # LED SPI Drivers
4748 obj-$(CONFIG_LEDS_DAC124S085) += leds-dac124s085.o
drivers/leds/led-class.c+6−1
@@ -267,9 +267,14 @@ void led_blink_set(struct led_classdev *led_cdev, · 266 unmodified lines
267267 unsigned long *delay_on,
268268 unsigned long *delay_off)
269269 {
270+ del_timer_sync(&led_cdev->blink_timer);
271+
270272 if (led_cdev->blink_set &&
271− !led_cdev->blink_set(led_cdev, delay_on, delay_off))
273+ !led_cdev->blink_set(led_cdev, delay_on, delay_off)) {
274+ led_cdev->blink_delay_on = *delay_on;
275+ led_cdev->blink_delay_off = *delay_off;
272276 return;
277+ }
273278
274279 /* blink with 1 Hz as default if nothing specified */
275280 if (!*delay_on && !*delay_off)
drivers/leds/led-triggers.c+4−1
@@ -261,9 +261,12 @@ void led_trigger_register_simple(const char *name, struct led_trigger **tp) · 260 unmodified lines
261261 if (trigger) {
262262 trigger->name = name;
263263 err = led_trigger_register(trigger);
264− if (err < 0)
264+ if (err < 0) {
265+ kfree(trigger);
266+ trigger = NULL;
265267 printk(KERN_WARNING "LED trigger %s failed to register"
266268 " (%d)\n", name, err);
269+ }
267270 } else
268271 printk(KERN_WARNING "LED trigger %s failed to register"
269272 " (no memory)\n", name);
drivers/leds/leds-gpio.c+1−1
@@ -121,7 +121,7 @@ static int __devinit create_gpio_led(const struct gpio_led *template, · 120 unmodified lines
121121 }
122122 led_dat->cdev.brightness_set = gpio_led_set;
123123 if (template->default_state == LEDS_GPIO_DEFSTATE_KEEP)
124− state = !!gpio_get_value(led_dat->gpio) ^ led_dat->active_low;
124+ state = !!gpio_get_value_cansleep(led_dat->gpio) ^ led_dat->active_low;
125125 else
126126 state = (template->default_state == LEDS_GPIO_DEFSTATE_ON);
127127 led_dat->cdev.brightness = state ? LED_FULL : LED_OFF;
drivers/leds/leds-lm3530.c+1−2
@@ -421,7 +421,6 @@ err_class_register: · 420 unmodified lines
421421 err_reg_init:
422422 regulator_put(drvdata->regulator);
423423 err_regulator_get:
424− i2c_set_clientdata(client, NULL);
425424 kfree(drvdata);
426425 err_out:
427426 return err;
@@ -449,7 +448,7 @@ MODULE_DEVICE_TABLE(i2c, lm3530_id); · 21 unmodified lines
449448
450449 static struct i2c_driver lm3530_i2c_driver = {
451450 .probe = lm3530_probe,
452− .remove = lm3530_remove,
451+ .remove = __devexit_p(lm3530_remove),
453452 .id_table = lm3530_id,
454453 .driver = {
455454 .name = LM3530_NAME,
drivers/leds/leds-lp5521.c+21−3
@@ -97,6 +97,9 @@ · 96 unmodified lines
9797 /* Status */
9898 #define LP5521_EXT_CLK_USED 0x08
9999
100+/* default R channel current register value */
101+#define LP5521_REG_R_CURR_DEFAULT 0xAF
102+
100103 struct lp5521_engine {
101104 int id;
102105 u8 mode;
@@ -175,14 +178,14 @@ static int lp5521_set_engine_mode(struct lp5521_engine *engine, u8 mode) · 72 unmodified lines
175178 mode = LP5521_CMD_DIRECT;
176179
177180 ret = lp5521_read(client, LP5521_REG_OP_MODE, &engine_state);
181+ if (ret < 0)
182+ return ret;
178183
179184 /* set mode only for this engine */
180185 engine_state &= ~(engine->engine_mask);
181186 mode &= engine->engine_mask;
182187 engine_state |= mode;
183− ret |= lp5521_write(client, LP5521_REG_OP_MODE, engine_state);
184−
185− return ret;
188+ return lp5521_write(client, LP5521_REG_OP_MODE, engine_state);
186189 }
187190
188191 static int lp5521_load_program(struct lp5521_engine *eng, const u8 *pattern)
@@ -643,6 +646,7 @@ static int __devinit lp5521_probe(struct i2c_client *client, · 454 unmodified lines
643646 struct lp5521_chip *chip;
644647 struct lp5521_platform_data *pdata;
645648 int ret, i, led;
649+ u8 buf;
646650
647651 chip = kzalloc(sizeof(*chip), GFP_KERNEL);
648652 if (!chip)
@@ -681,6 +685,20 @@ static int __devinit lp5521_probe(struct i2c_client *client, · 32 unmodified lines
681685 * Exact value is not available. 10 - 20ms
682686 * appears to be enough for reset.
683687 */
688+
689+ /*
690+ * Make sure that the chip is reset by reading back the r channel
691+ * current reg. This is dummy read is required on some platforms -
692+ * otherwise further access to the R G B channels in the
693+ * LP5521_REG_ENABLE register will not have any effect - strange!
694+ */
695+ lp5521_read(client, LP5521_REG_R_CURRENT, &buf);
696+ if (buf != LP5521_REG_R_CURR_DEFAULT) {
697+ dev_err(&client->dev, "error in reseting chip\n");
698+ goto fail2;
699+ }
700+ usleep_range(10000, 20000);
701+
684702 ret = lp5521_detect(client);
685703
686704 if (ret) {
drivers/leds/leds-renesas-tpu.c+357−0
@@ -0,0 +1,357 @@
1+/*
2+ * LED control using Renesas TPU
3+ *
4+ * Copyright (C) 2011 Magnus Damm
5+ *
6+ * This program is free software; you can redistribute it and/or modify
7+ * it under the terms of the GNU General Public License as published by
8+ * the Free Software Foundation; either version 2 of the License
9+ *
10+ * This program is distributed in the hope that it will be useful,
11+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
12+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+ * GNU General Public License for more details.
14+ *
15+ * You should have received a copy of the GNU General Public License
16+ * along with this program; if not, write to the Free Software
17+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18+ */
19+
20+#include <linux/module.h>
21+#include <linux/init.h>
22+#include <linux/platform_device.h>
23+#include <linux/spinlock.h>
24+#include <linux/printk.h>
25+#include <linux/ioport.h>
26+#include <linux/io.h>
27+#include <linux/clk.h>
28+#include <linux/leds.h>
29+#include <linux/platform_data/leds-renesas-tpu.h>
30+#include <linux/gpio.h>
31+#include <linux/err.h>
32+#include <linux/slab.h>
33+#include <linux/pm_runtime.h>
34+#include <linux/workqueue.h>
35+
36+enum r_tpu_pin { R_TPU_PIN_UNUSED, R_TPU_PIN_GPIO, R_TPU_PIN_GPIO_FN };
37+enum r_tpu_timer { R_TPU_TIMER_UNUSED, R_TPU_TIMER_ON };
38+
39+struct r_tpu_priv {
40+ struct led_classdev ldev;
41+ void __iomem *mapbase;
42+ struct clk *clk;
43+ struct platform_device *pdev;
44+ enum r_tpu_pin pin_state;
45+ enum r_tpu_timer timer_state;
46+ unsigned long min_rate;
47+ unsigned int refresh_rate;
48+ struct work_struct work;
49+ enum led_brightness new_brightness;
50+};
51+
52+static DEFINE_SPINLOCK(r_tpu_lock);
53+
54+#define TSTR -1 /* Timer start register (shared register) */
55+#define TCR 0 /* Timer control register (+0x00) */
56+#define TMDR 1 /* Timer mode register (+0x04) */
57+#define TIOR 2 /* Timer I/O control register (+0x08) */
58+#define TIER 3 /* Timer interrupt enable register (+0x0c) */
59+#define TSR 4 /* Timer status register (+0x10) */
60+#define TCNT 5 /* Timer counter (+0x14) */
61+#define TGRA 6 /* Timer general register A (+0x18) */
62+#define TGRB 7 /* Timer general register B (+0x1c) */
63+#define TGRC 8 /* Timer general register C (+0x20) */
64+#define TGRD 9 /* Timer general register D (+0x24) */
65+
66+static inline unsigned short r_tpu_read(struct r_tpu_priv *p, int reg_nr)
67+{
68+ struct led_renesas_tpu_config *cfg = p->pdev->dev.platform_data;
69+ void __iomem *base = p->mapbase;
70+ unsigned long offs = reg_nr << 2;
71+
72+ if (reg_nr == TSTR)
73+ return ioread16(base - cfg->channel_offset);
74+
75+ return ioread16(base + offs);
76+}
77+
78+static inline void r_tpu_write(struct r_tpu_priv *p, int reg_nr,
79+ unsigned short value)
80+{
81+ struct led_renesas_tpu_config *cfg = p->pdev->dev.platform_data;
82+ void __iomem *base = p->mapbase;
83+ unsigned long offs = reg_nr << 2;
84+
85+ if (reg_nr == TSTR) {
86+ iowrite16(value, base - cfg->channel_offset);
87+ return;
88+ }
89+
90+ iowrite16(value, base + offs);
91+}
92+
93+static void r_tpu_start_stop_ch(struct r_tpu_priv *p, int start)
94+{
95+ struct led_renesas_tpu_config *cfg = p->pdev->dev.platform_data;
96+ unsigned long flags, value;
97+
98+ /* start stop register shared by multiple timer channels */
99+ spin_lock_irqsave(&r_tpu_lock, flags);
100+ value = r_tpu_read(p, TSTR);
101+
102+ if (start)
103+ value |= 1 << cfg->timer_bit;
104+ else
105+ value &= ~(1 << cfg->timer_bit);
106+
107+ r_tpu_write(p, TSTR, value);
108+ spin_unlock_irqrestore(&r_tpu_lock, flags);
109+}
110+
111+static int r_tpu_enable(struct r_tpu_priv *p, enum led_brightness brightness)
112+{
113+ struct led_renesas_tpu_config *cfg = p->pdev->dev.platform_data;
114+ int prescaler[] = { 1, 4, 16, 64 };
115+ int k, ret;
116+ unsigned long rate, tmp;
117+
118+ if (p->timer_state == R_TPU_TIMER_ON)
119+ return 0;
120+
121+ /* wake up device and enable clock */
122+ pm_runtime_get_sync(&p->pdev->dev);
123+ ret = clk_enable(p->clk);
124+ if (ret) {
125+ dev_err(&p->pdev->dev, "cannot enable clock\n");
126+ return ret;
127+ }
128+
129+ /* make sure channel is disabled */
130+ r_tpu_start_stop_ch(p, 0);
131+
132+ /* get clock rate after enabling it */
133+ rate = clk_get_rate(p->clk);
134+
135+ /* pick the lowest acceptable rate */
136+ for (k = 0; k < ARRAY_SIZE(prescaler); k++)
137+ if ((rate / prescaler[k]) < p->min_rate)
138+ break;
139+
140+ if (!k) {
141+ dev_err(&p->pdev->dev, "clock rate mismatch\n");
142+ goto err0;
143+ }
144+ dev_dbg(&p->pdev->dev, "rate = %lu, prescaler %u\n",
145+ rate, prescaler[k - 1]);
146+
147+ /* clear TCNT on TGRB match, count on rising edge, set prescaler */
148+ r_tpu_write(p, TCR, 0x0040 | (k - 1));
149+
150+ /* output 0 until TGRA, output 1 until TGRB */
151+ r_tpu_write(p, TIOR, 0x0002);
152+
153+ rate /= prescaler[k - 1] * p->refresh_rate;
154+ r_tpu_write(p, TGRB, rate);
155+ dev_dbg(&p->pdev->dev, "TRGB = 0x%04lx\n", rate);
156+
157+ tmp = (cfg->max_brightness - brightness) * rate;
158+ r_tpu_write(p, TGRA, tmp / cfg->max_brightness);
159+ dev_dbg(&p->pdev->dev, "TRGA = 0x%04lx\n", tmp / cfg->max_brightness);
160+
161+ /* PWM mode */
162+ r_tpu_write(p, TMDR, 0x0002);
163+
164+ /* enable channel */
165+ r_tpu_start_stop_ch(p, 1);
166+
167+ p->timer_state = R_TPU_TIMER_ON;
168+ return 0;
169+ err0:
170+ clk_disable(p->clk);
171+ pm_runtime_put_sync(&p->pdev->dev);
172+ return -ENOTSUPP;
173+}
174+
175+static void r_tpu_disable(struct r_tpu_priv *p)
176+{
177+ if (p->timer_state == R_TPU_TIMER_UNUSED)
178+ return;
179+
180+ /* disable channel */
181+ r_tpu_start_stop_ch(p, 0);
182+
183+ /* stop clock and mark device as idle */
184+ clk_disable(p->clk);
185+ pm_runtime_put_sync(&p->pdev->dev);
186+
187+ p->timer_state = R_TPU_TIMER_UNUSED;
188+}
189+
190+static void r_tpu_set_pin(struct r_tpu_priv *p, enum r_tpu_pin new_state,
191+ enum led_brightness brightness)
192+{
193+ struct led_renesas_tpu_config *cfg = p->pdev->dev.platform_data;
194+
195+ if (p->pin_state == new_state) {
196+ if (p->pin_state == R_TPU_PIN_GPIO)
197+ gpio_set_value(cfg->pin_gpio, brightness);
198+ return;
199+ }
200+
201+ if (p->pin_state == R_TPU_PIN_GPIO)
202+ gpio_free(cfg->pin_gpio);
203+
204+ if (p->pin_state == R_TPU_PIN_GPIO_FN)
205+ gpio_free(cfg->pin_gpio_fn);
206+
207+ if (new_state == R_TPU_PIN_GPIO) {
208+ gpio_request(cfg->pin_gpio, cfg->name);
209+ gpio_direction_output(cfg->pin_gpio, !!brightness);
210+ }
211+ if (new_state == R_TPU_PIN_GPIO_FN)
212+ gpio_request(cfg->pin_gpio_fn, cfg->name);
213+
214+ p->pin_state = new_state;
215+}
216+
217+static void r_tpu_work(struct work_struct *work)
218+{
219+ struct r_tpu_priv *p = container_of(work, struct r_tpu_priv, work);
220+ enum led_brightness brightness = p->new_brightness;
221+
222+ r_tpu_disable(p);
223+
224+ /* off and maximum are handled as GPIO pins, in between PWM */
225+ if ((brightness == 0) || (brightness == p->ldev.max_brightness))
226+ r_tpu_set_pin(p, R_TPU_PIN_GPIO, brightness);
227+ else {
228+ r_tpu_set_pin(p, R_TPU_PIN_GPIO_FN, 0);
229+ r_tpu_enable(p, brightness);
230+ }
231+}
232+
233+static void r_tpu_set_brightness(struct led_classdev *ldev,
234+ enum led_brightness brightness)
235+{
236+ struct r_tpu_priv *p = container_of(ldev, struct r_tpu_priv, ldev);
237+ p->new_brightness = brightness;
238+ schedule_work(&p->work);
239+}
240+
241+static int __devinit r_tpu_probe(struct platform_device *pdev)
242+{
243+ struct led_renesas_tpu_config *cfg = pdev->dev.platform_data;
244+ struct r_tpu_priv *p;
245+ struct resource *res;
246+ int ret = -ENXIO;
247+
248+ if (!cfg) {
249+ dev_err(&pdev->dev, "missing platform data\n");
250+ goto err0;
251+ }
252+
253+ p = kzalloc(sizeof(*p), GFP_KERNEL);
254+ if (p == NULL) {
255+ dev_err(&pdev->dev, "failed to allocate driver data\n");
256+ ret = -ENOMEM;
257+ goto err0;
258+ }
259+
260+ res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
261+ if (!res) {
262+ dev_err(&pdev->dev, "failed to get I/O memory\n");
263+ goto err1;
264+ }
265+
266+ /* map memory, let mapbase point to our channel */
267+ p->mapbase = ioremap_nocache(res->start, resource_size(res));
268+ if (p->mapbase == NULL) {
269+ dev_err(&pdev->dev, "failed to remap I/O memory\n");
270+ goto err1;
271+ }
272+
273+ /* get hold of clock */
274+ p->clk = clk_get(&pdev->dev, NULL);
275+ if (IS_ERR(p->clk)) {
276+ dev_err(&pdev->dev, "cannot get clock\n");
277+ ret = PTR_ERR(p->clk);
278+ goto err2;
279+ }
280+
281+ p->pdev = pdev;
282+ p->pin_state = R_TPU_PIN_UNUSED;
283+ p->timer_state = R_TPU_TIMER_UNUSED;
284+ p->refresh_rate = cfg->refresh_rate ? cfg->refresh_rate : 100;
285+ r_tpu_set_pin(p, R_TPU_PIN_GPIO, LED_OFF);
286+ platform_set_drvdata(pdev, p);
287+
288+ INIT_WORK(&p->work, r_tpu_work);
289+
290+ p->ldev.name = cfg->name;
291+ p->ldev.brightness = LED_OFF;
292+ p->ldev.max_brightness = cfg->max_brightness;
293+ p->ldev.brightness_set = r_tpu_set_brightness;
294+ p->ldev.flags |= LED_CORE_SUSPENDRESUME;
295+ ret = led_classdev_register(&pdev->dev, &p->ldev);
296+ if (ret < 0)
297+ goto err3;
298+
299+ /* max_brightness may be updated by the LED core code */
300+ p->min_rate = p->ldev.max_brightness * p->refresh_rate;
301+
302+ pm_runtime_enable(&pdev->dev);
303+ return 0;
304+
305+ err3:
306+ r_tpu_set_pin(p, R_TPU_PIN_UNUSED, LED_OFF);
307+ clk_put(p->clk);
308+ err2:
309+ iounmap(p->mapbase);
310+ err1:
311+ kfree(p);
312+ err0:
313+ return ret;
314+}
315+
316+static int __devexit r_tpu_remove(struct platform_device *pdev)
317+{
318+ struct r_tpu_priv *p = platform_get_drvdata(pdev);
319+
320+ r_tpu_set_brightness(&p->ldev, LED_OFF);
321+ led_classdev_unregister(&p->ldev);
322+ cancel_work_sync(&p->work);
323+ r_tpu_disable(p);
324+ r_tpu_set_pin(p, R_TPU_PIN_UNUSED, LED_OFF);
325+
326+ pm_runtime_disable(&pdev->dev);
327+ clk_put(p->clk);
328+
329+ iounmap(p->mapbase);
330+ kfree(p);
331+ return 0;
332+}
333+
334+static struct platform_driver r_tpu_device_driver = {
335+ .probe = r_tpu_probe,
336+ .remove = __devexit_p(r_tpu_remove),
337+ .driver = {
338+ .name = "leds-renesas-tpu",
339+ }
340+};
341+
342+static int __init r_tpu_init(void)
343+{
344+ return platform_driver_register(&r_tpu_device_driver);
345+}
346+
347+static void __exit r_tpu_exit(void)
348+{
349+ platform_driver_unregister(&r_tpu_device_driver);
350+}
351+
352+module_init(r_tpu_init);
353+module_exit(r_tpu_exit);
354+
355+MODULE_AUTHOR("Magnus Damm");
356+MODULE_DESCRIPTION("Renesas TPU LED Driver");
357+MODULE_LICENSE("GPL v2");
drivers/misc/ad525x_dpot-i2c.c+1−0
@@ -98,6 +98,7 @@ static const struct i2c_device_id ad_dpot_id[] = { · 97 unmodified lines
9898 {"ad5282", AD5282_ID},
9999 {"adn2860", ADN2860_ID},
100100 {"ad5273", AD5273_ID},
101+ {"ad5161", AD5161_ID},
101102 {"ad5171", AD5171_ID},
102103 {"ad5170", AD5170_ID},
103104 {"ad5172", AD5172_ID},
drivers/misc/fsa9480.c+2−1
@@ -400,7 +400,8 @@ static int fsa9480_irq_init(struct fsa9480_usbsw *usbsw) · 399 unmodified lines
400400 return ret;
401401 }
402402
403− device_init_wakeup(&client->dev, pdata->wakeup);
403+ if (pdata)
404+ device_init_wakeup(&client->dev, pdata->wakeup);
404405 }
405406
406407 return 0;
drivers/misc/lis3lv02d/lis3lv02d.c+220−169
@@ -163,7 +163,7 @@ static void lis3lv02d_get_xyz(struct lis3lv02d *lis3, int *x, int *y, int *z) · 162 unmodified lines
163163 int i;
164164
165165 if (lis3->blkread) {
166− if (lis3_dev.whoami == WAI_12B) {
166+ if (lis3->whoami == WAI_12B) {
167167 u16 data[3];
168168 lis3->blkread(lis3, OUTX_L, 6, (u8 *)data);
169169 for (i = 0; i < 3; i++)
@@ -195,18 +195,30 @@ static int lis3_8_rates[2] = {100, 400}; · 25 unmodified lines
195195 static int lis3_3dc_rates[16] = {0, 1, 10, 25, 50, 100, 200, 400, 1600, 5000};
196196
197197 /* ODR is Output Data Rate */
198−static int lis3lv02d_get_odr(void)
198+static int lis3lv02d_get_odr(struct lis3lv02d *lis3)
199199 {
200200 u8 ctrl;
201201 int shift;
202202
203− lis3_dev.read(&lis3_dev, CTRL_REG1, &ctrl);
204− ctrl &= lis3_dev.odr_mask;
205− shift = ffs(lis3_dev.odr_mask) - 1;
206− return lis3_dev.odrs[(ctrl >> shift)];
203+ lis3->read(lis3, CTRL_REG1, &ctrl);
204+ ctrl &= lis3->odr_mask;
205+ shift = ffs(lis3->odr_mask) - 1;
206+ return lis3->odrs[(ctrl >> shift)];
207207 }
208208
209−static int lis3lv02d_set_odr(int rate)
209+static int lis3lv02d_get_pwron_wait(struct lis3lv02d *lis3)
210+{
211+ int div = lis3lv02d_get_odr(lis3);
212+
213+ if (WARN_ONCE(div == 0, "device returned spurious data"))
214+ return -ENXIO;
215+
216+ /* LIS3 power on delay is quite long */
217+ msleep(lis3->pwron_delay / div);
218+ return 0;
219+}
220+
221+static int lis3lv02d_set_odr(struct lis3lv02d *lis3, int rate)
210222 {
211223 u8 ctrl;
212224 int i, len, shift;
@@ -214,14 +226,14 @@ static int lis3lv02d_set_odr(int rate) · 1 unmodified line
214226 if (!rate)
215227 return -EINVAL;
216228
217− lis3_dev.read(&lis3_dev, CTRL_REG1, &ctrl);
218− ctrl &= ~lis3_dev.odr_mask;
219− len = 1 << hweight_long(lis3_dev.odr_mask); /* # of possible values */
220− shift = ffs(lis3_dev.odr_mask) - 1;
229+ lis3->read(lis3, CTRL_REG1, &ctrl);
230+ ctrl &= ~lis3->odr_mask;
231+ len = 1 << hweight_long(lis3->odr_mask); /* # of possible values */
232+ shift = ffs(lis3->odr_mask) - 1;
221233
222234 for (i = 0; i < len; i++)
223− if (lis3_dev.odrs[i] == rate) {
224− lis3_dev.write(&lis3_dev, CTRL_REG1,
235+ if (lis3->odrs[i] == rate) {
236+ lis3->write(lis3, CTRL_REG1,
225237 ctrl | (i << shift));
226238 return 0;
227239 }
@@ -240,12 +252,12 @@ static int lis3lv02d_selftest(struct lis3lv02d *lis3, s16 results[3]) · 12 unmodified lines
240252 mutex_lock(&lis3->mutex);
241253
242254 irq_cfg = lis3->irq_cfg;
243− if (lis3_dev.whoami == WAI_8B) {
255+ if (lis3->whoami == WAI_8B) {
244256 lis3->data_ready_count[IRQ_LINE0] = 0;
245257 lis3->data_ready_count[IRQ_LINE1] = 0;
246258
247259 /* Change interrupt cfg to data ready for selftest */
248− atomic_inc(&lis3_dev.wake_thread);
260+ atomic_inc(&lis3->wake_thread);
249261 lis3->irq_cfg = LIS3_IRQ1_DATA_READY | LIS3_IRQ2_DATA_READY;
250262 lis3->read(lis3, CTRL_REG3, &ctrl_reg_data);
251263 lis3->write(lis3, CTRL_REG3, (ctrl_reg_data &
@@ -253,12 +265,12 @@ static int lis3lv02d_selftest(struct lis3lv02d *lis3, s16 results[3]) · 1 unmodified line
253265 (LIS3_IRQ1_DATA_READY | LIS3_IRQ2_DATA_READY));
254266 }
255267
256− if (lis3_dev.whoami == WAI_3DC) {
268+ if (lis3->whoami == WAI_3DC) {
257269 ctlreg = CTRL_REG4;
258270 selftest = CTRL4_ST0;
259271 } else {
260272 ctlreg = CTRL_REG1;
261− if (lis3_dev.whoami == WAI_12B)
273+ if (lis3->whoami == WAI_12B)
262274 selftest = CTRL1_ST;
263275 else
264276 selftest = CTRL1_STP;
@@ -266,7 +278,9 @@ static int lis3lv02d_selftest(struct lis3lv02d *lis3, s16 results[3]) · 1 unmodified line
266278
267279 lis3->read(lis3, ctlreg, &reg);
268280 lis3->write(lis3, ctlreg, (reg | selftest));
269− msleep(lis3->pwron_delay / lis3lv02d_get_odr());
281+ ret = lis3lv02d_get_pwron_wait(lis3);
282+ if (ret)
283+ goto fail;
270284
271285 /* Read directly to avoid axis remap */
272286 x = lis3->read_data(lis3, OUTX);
@@ -275,7 +289,9 @@ static int lis3lv02d_selftest(struct lis3lv02d *lis3, s16 results[3]) · 2 unmodified lines
275289
276290 /* back to normal settings */
277291 lis3->write(lis3, ctlreg, reg);
278− msleep(lis3->pwron_delay / lis3lv02d_get_odr());
292+ ret = lis3lv02d_get_pwron_wait(lis3);
293+ if (ret)
294+ goto fail;
279295
280296 results[0] = x - lis3->read_data(lis3, OUTX);
281297 results[1] = y - lis3->read_data(lis3, OUTY);
@@ -283,9 +299,9 @@ static int lis3lv02d_selftest(struct lis3lv02d *lis3, s16 results[3]) · 1 unmodified line
283299
284300 ret = 0;
285301
286− if (lis3_dev.whoami == WAI_8B) {
302+ if (lis3->whoami == WAI_8B) {
287303 /* Restore original interrupt configuration */
288− atomic_dec(&lis3_dev.wake_thread);
304+ atomic_dec(&lis3->wake_thread);
289305 lis3->write(lis3, CTRL_REG3, ctrl_reg_data);
290306 lis3->irq_cfg = irq_cfg;
291307
@@ -363,8 +379,9 @@ void lis3lv02d_poweroff(struct lis3lv02d *lis3) · 71 unmodified lines
363379 }
364380 EXPORT_SYMBOL_GPL(lis3lv02d_poweroff);
365381
366−void lis3lv02d_poweron(struct lis3lv02d *lis3)
382+int lis3lv02d_poweron(struct lis3lv02d *lis3)
367383 {
384+ int err;
368385 u8 reg;
369386
370387 lis3->init(lis3);
@@ -384,35 +401,41 @@ void lis3lv02d_poweron(struct lis3lv02d *lis3) · 13 unmodified lines
384401 lis3->write(lis3, CTRL_REG2, reg);
385402 }
386403
387− /* LIS3 power on delay is quite long */
388− msleep(lis3->pwron_delay / lis3lv02d_get_odr());
404+ err = lis3lv02d_get_pwron_wait(lis3);
405+ if (err)
406+ return err;
389407
390408 if (lis3->reg_ctrl)
391409 lis3_context_restore(lis3);
410+
411+ return 0;
392412 }
393413 EXPORT_SYMBOL_GPL(lis3lv02d_poweron);
394414
395415
396416 static void lis3lv02d_joystick_poll(struct input_polled_dev *pidev)
397417 {
418+ struct lis3lv02d *lis3 = pidev->private;
398419 int x, y, z;
399420
400− mutex_lock(&lis3_dev.mutex);
401− lis3lv02d_get_xyz(&lis3_dev, &x, &y, &z);
421+ mutex_lock(&lis3->mutex);
422+ lis3lv02d_get_xyz(lis3, &x, &y, &z);
402423 input_report_abs(pidev->input, ABS_X, x);
403424 input_report_abs(pidev->input, ABS_Y, y);
404425 input_report_abs(pidev->input, ABS_Z, z);
405426 input_sync(pidev->input);
406− mutex_unlock(&lis3_dev.mutex);
427+ mutex_unlock(&lis3->mutex);
407428 }
408429
409430 static void lis3lv02d_joystick_open(struct input_polled_dev *pidev)
410431 {
411− if (lis3_dev.pm_dev)
412− pm_runtime_get_sync(lis3_dev.pm_dev);
432+ struct lis3lv02d *lis3 = pidev->private;
413433
414− if (lis3_dev.pdata && lis3_dev.whoami == WAI_8B && lis3_dev.idev)
415− atomic_set(&lis3_dev.wake_thread, 1);
434+ if (lis3->pm_dev)
435+ pm_runtime_get_sync(lis3->pm_dev);
436+
437+ if (lis3->pdata && lis3->whoami == WAI_8B && lis3->idev)
438+ atomic_set(&lis3->wake_thread, 1);
416439 /*
417440 * Update coordinates for the case where poll interval is 0 and
418441 * the chip in running purely under interrupt control
@@ -422,14 +445,18 @@ static void lis3lv02d_joystick_open(struct input_polled_dev *pidev) · 3 unmodified lines
422445
423446 static void lis3lv02d_joystick_close(struct input_polled_dev *pidev)
424447 {
425− atomic_set(&lis3_dev.wake_thread, 0);
426− if (lis3_dev.pm_dev)
427− pm_runtime_put(lis3_dev.pm_dev);
448+ struct lis3lv02d *lis3 = pidev->private;
449+
450+ atomic_set(&lis3->wake_thread, 0);
451+ if (lis3->pm_dev)
452+ pm_runtime_put(lis3->pm_dev);
428453 }
429454
430−static irqreturn_t lis302dl_interrupt(int irq, void *dummy)
455+static irqreturn_t lis302dl_interrupt(int irq, void *data)
431456 {
432− if (!test_bit(0, &lis3_dev.misc_opened))
457+ struct lis3lv02d *lis3 = data;
458+
459+ if (!test_bit(0, &lis3->misc_opened))
433460 goto out;
434461
435462 /*
@@ -437,12 +464,12 @@ static irqreturn_t lis302dl_interrupt(int irq, void *dummy) · 1 unmodified line
437464 * the lid is closed. This leads to interrupts as soon as a little move
438465 * is done.
439466 */
440− atomic_inc(&lis3_dev.count);
467+ atomic_inc(&lis3->count);
441468
442− wake_up_interruptible(&lis3_dev.misc_wait);
443− kill_fasync(&lis3_dev.async_queue, SIGIO, POLL_IN);
469+ wake_up_interruptible(&lis3->misc_wait);
470+ kill_fasync(&lis3->async_queue, SIGIO, POLL_IN);
444471 out:
445− if (atomic_read(&lis3_dev.wake_thread))
472+ if (atomic_read(&lis3->wake_thread))
446473 return IRQ_WAKE_THREAD;
447474 return IRQ_HANDLED;
448475 }
@@ -514,28 +541,37 @@ static irqreturn_t lis302dl_interrupt_thread2_8b(int irq, void *data) · 65 unmodified lines
514541
515542 static int lis3lv02d_misc_open(struct inode *inode, struct file *file)
516543 {
517− if (test_and_set_bit(0, &lis3_dev.misc_opened))
544+ struct lis3lv02d *lis3 = container_of(file->private_data,
545+ struct lis3lv02d, miscdev);
546+
547+ if (test_and_set_bit(0, &lis3->misc_opened))
518548 return -EBUSY; /* already open */
519549
520− if (lis3_dev.pm_dev)
521− pm_runtime_get_sync(lis3_dev.pm_dev);
550+ if (lis3->pm_dev)
551+ pm_runtime_get_sync(lis3->pm_dev);
522552
523− atomic_set(&lis3_dev.count, 0);
553+ atomic_set(&lis3->count, 0);
524554 return 0;
525555 }
526556
527557 static int lis3lv02d_misc_release(struct inode *inode, struct file *file)
528558 {
529− fasync_helper(-1, file, 0, &lis3_dev.async_queue);
530− clear_bit(0, &lis3_dev.misc_opened); /* release the device */
531− if (lis3_dev.pm_dev)
532− pm_runtime_put(lis3_dev.pm_dev);
559+ struct lis3lv02d *lis3 = container_of(file->private_data,
560+ struct lis3lv02d, miscdev);
561+
562+ fasync_helper(-1, file, 0, &lis3->async_queue);
563+ clear_bit(0, &lis3->misc_opened); /* release the device */
564+ if (lis3->pm_dev)
565+ pm_runtime_put(lis3->pm_dev);
533566 return 0;
534567 }
535568
536569 static ssize_t lis3lv02d_misc_read(struct file *file, char __user *buf,
537570 size_t count, loff_t *pos)
538571 {
572+ struct lis3lv02d *lis3 = container_of(file->private_data,
573+ struct lis3lv02d, miscdev);
574+
539575 DECLARE_WAITQUEUE(wait, current);
540576 u32 data;
541577 unsigned char byte_data;
@@ -544,10 +580,10 @@ static ssize_t lis3lv02d_misc_read(struct file *file, char __user *buf, · 2 unmodified lines
544580 if (count < 1)
545581 return -EINVAL;
546582
547− add_wait_queue(&lis3_dev.misc_wait, &wait);
583+ add_wait_queue(&lis3->misc_wait, &wait);
548584 while (true) {
549585 set_current_state(TASK_INTERRUPTIBLE);
550− data = atomic_xchg(&lis3_dev.count, 0);
586+ data = atomic_xchg(&lis3->count, 0);
551587 if (data)
552588 break;
553589
@@ -577,22 +613,28 @@ static ssize_t lis3lv02d_misc_read(struct file *file, char __user *buf, · 23 unmodified lines
577613
578614 out:
579615 __set_current_state(TASK_RUNNING);
580− remove_wait_queue(&lis3_dev.misc_wait, &wait);
616+ remove_wait_queue(&lis3->misc_wait, &wait);
581617
582618 return retval;
583619 }
584620
585621 static unsigned int lis3lv02d_misc_poll(struct file *file, poll_table *wait)
586622 {
587− poll_wait(file, &lis3_dev.misc_wait, wait);
588− if (atomic_read(&lis3_dev.count))
623+ struct lis3lv02d *lis3 = container_of(file->private_data,
624+ struct lis3lv02d, miscdev);
625+
626+ poll_wait(file, &lis3->misc_wait, wait);
627+ if (atomic_read(&lis3->count))
589628 return POLLIN | POLLRDNORM;
590629 return 0;
591630 }
592631
593632 static int lis3lv02d_misc_fasync(int fd, struct file *file, int on)
594633 {
595− return fasync_helper(fd, file, on, &lis3_dev.async_queue);
634+ struct lis3lv02d *lis3 = container_of(file->private_data,
635+ struct lis3lv02d, miscdev);
636+
637+ return fasync_helper(fd, file, on, &lis3->async_queue);
596638 }
597639
598640 static const struct file_operations lis3lv02d_misc_fops = {
@@ -605,85 +647,80 @@ static const struct file_operations lis3lv02d_misc_fops = { · 6 unmodified lines
605647 .fasync = lis3lv02d_misc_fasync,
606648 };
607649
608−static struct miscdevice lis3lv02d_misc_device = {
609− .minor = MISC_DYNAMIC_MINOR,
610− .name = "freefall",
611− .fops = &lis3lv02d_misc_fops,
612−};
613−
614−int lis3lv02d_joystick_enable(void)
650+int lis3lv02d_joystick_enable(struct lis3lv02d *lis3)
615651 {
616652 struct input_dev *input_dev;
617653 int err;
618654 int max_val, fuzz, flat;
619655 int btns[] = {BTN_X, BTN_Y, BTN_Z};
620656
621− if (lis3_dev.idev)
657+ if (lis3->idev)
622658 return -EINVAL;
623659
624− lis3_dev.idev = input_allocate_polled_device();
625− if (!lis3_dev.idev)
660+ lis3->idev = input_allocate_polled_device();
661+ if (!lis3->idev)
626662 return -ENOMEM;
627663
628− lis3_dev.idev->poll = lis3lv02d_joystick_poll;
629− lis3_dev.idev->open = lis3lv02d_joystick_open;
630− lis3_dev.idev->close = lis3lv02d_joystick_close;
631− lis3_dev.idev->poll_interval = MDPS_POLL_INTERVAL;
632− lis3_dev.idev->poll_interval_min = MDPS_POLL_MIN;
633− lis3_dev.idev->poll_interval_max = MDPS_POLL_MAX;
634− input_dev = lis3_dev.idev->input;
664+ lis3->idev->poll = lis3lv02d_joystick_poll;
665+ lis3->idev->open = lis3lv02d_joystick_open;
666+ lis3->idev->close = lis3lv02d_joystick_close;
667+ lis3->idev->poll_interval = MDPS_POLL_INTERVAL;
668+ lis3->idev->poll_interval_min = MDPS_POLL_MIN;
669+ lis3->idev->poll_interval_max = MDPS_POLL_MAX;
670+ lis3->idev->private = lis3;
671+ input_dev = lis3->idev->input;
635672
636673 input_dev->name = "ST LIS3LV02DL Accelerometer";
637674 input_dev->phys = DRIVER_NAME "/input0";
638675 input_dev->id.bustype = BUS_HOST;
639676 input_dev->id.vendor = 0;
640− input_dev->dev.parent = &lis3_dev.pdev->dev;
677+ input_dev->dev.parent = &lis3->pdev->dev;
641678
642679 set_bit(EV_ABS, input_dev->evbit);
643− max_val = (lis3_dev.mdps_max_val * lis3_dev.scale) / LIS3_ACCURACY;
644− if (lis3_dev.whoami == WAI_12B) {
680+ max_val = (lis3->mdps_max_val * lis3->scale) / LIS3_ACCURACY;
681+ if (lis3->whoami == WAI_12B) {
645682 fuzz = LIS3_DEFAULT_FUZZ_12B;
646683 flat = LIS3_DEFAULT_FLAT_12B;
647684 } else {
648685 fuzz = LIS3_DEFAULT_FUZZ_8B;
649686 flat = LIS3_DEFAULT_FLAT_8B;
650687 }
651− fuzz = (fuzz * lis3_dev.scale) / LIS3_ACCURACY;
652− flat = (flat * lis3_dev.scale) / LIS3_ACCURACY;
688+ fuzz = (fuzz * lis3->scale) / LIS3_ACCURACY;
689+ flat = (flat * lis3->scale) / LIS3_ACCURACY;
653690
654691 input_set_abs_params(input_dev, ABS_X, -max_val, max_val, fuzz, flat);
655692 input_set_abs_params(input_dev, ABS_Y, -max_val, max_val, fuzz, flat);
656693 input_set_abs_params(input_dev, ABS_Z, -max_val, max_val, fuzz, flat);
657694
658− lis3_dev.mapped_btns[0] = lis3lv02d_get_axis(abs(lis3_dev.ac.x), btns);
659− lis3_dev.mapped_btns[1] = lis3lv02d_get_axis(abs(lis3_dev.ac.y), btns);
660− lis3_dev.mapped_btns[2] = lis3lv02d_get_axis(abs(lis3_dev.ac.z), btns);
695+ lis3->mapped_btns[0] = lis3lv02d_get_axis(abs(lis3->ac.x), btns);
696+ lis3->mapped_btns[1] = lis3lv02d_get_axis(abs(lis3->ac.y), btns);
697+ lis3->mapped_btns[2] = lis3lv02d_get_axis(abs(lis3->ac.z), btns);
661698
662− err = input_register_polled_device(lis3_dev.idev);
699+ err = input_register_polled_device(lis3->idev);
663700 if (err) {
664− input_free_polled_device(lis3_dev.idev);
665− lis3_dev.idev = NULL;
701+ input_free_polled_device(lis3->idev);
702+ lis3->idev = NULL;
666703 }
667704
668705 return err;
669706 }
670707 EXPORT_SYMBOL_GPL(lis3lv02d_joystick_enable);
671708
672−void lis3lv02d_joystick_disable(void)
709+void lis3lv02d_joystick_disable(struct lis3lv02d *lis3)
673710 {
674− if (lis3_dev.irq)
675− free_irq(lis3_dev.irq, &lis3_dev);
676− if (lis3_dev.pdata && lis3_dev.pdata->irq2)
677− free_irq(lis3_dev.pdata->irq2, &lis3_dev);
711+ if (lis3->irq)
712+ free_irq(lis3->irq, lis3);
713+ if (lis3->pdata && lis3->pdata->irq2)
714+ free_irq(lis3->pdata->irq2, lis3);
678715
679− if (!lis3_dev.idev)
716+ if (!lis3->idev)
680717 return;
681718
682− if (lis3_dev.irq)
683− misc_deregister(&lis3lv02d_misc_device);
684− input_unregister_polled_device(lis3_dev.idev);
685− input_free_polled_device(lis3_dev.idev);
686− lis3_dev.idev = NULL;
719+ if (lis3->irq)
720+ misc_deregister(&lis3->miscdev);
721+ input_unregister_polled_device(lis3->idev);
722+ input_free_polled_device(lis3->idev);
723+ lis3->idev = NULL;
687724 }
688725 EXPORT_SYMBOL_GPL(lis3lv02d_joystick_disable);
689726
@@ -708,6 +745,7 @@ static void lis3lv02d_sysfs_poweron(struct lis3lv02d *lis3) · 18 unmodified lines
708745 static ssize_t lis3lv02d_selftest_show(struct device *dev,
709746 struct device_attribute *attr, char *buf)
710747 {
748+ struct lis3lv02d *lis3 = dev_get_drvdata(dev);
711749 s16 values[3];
712750
713751 static const char ok[] = "OK";
@@ -715,8 +753,8 @@ static ssize_t lis3lv02d_selftest_show(struct device *dev, · 1 unmodified line
715753 static const char irq[] = "FAIL_IRQ";
716754 const char *res;
717755
718− lis3lv02d_sysfs_poweron(&lis3_dev);
719− switch (lis3lv02d_selftest(&lis3_dev, values)) {
756+ lis3lv02d_sysfs_poweron(lis3);
757+ switch (lis3lv02d_selftest(lis3, values)) {
720758 case SELFTEST_FAIL:
721759 res = fail;
722760 break;
@@ -735,33 +773,37 @@ static ssize_t lis3lv02d_selftest_show(struct device *dev, · 12 unmodified lines
735773 static ssize_t lis3lv02d_position_show(struct device *dev,
736774 struct device_attribute *attr, char *buf)
737775 {
776+ struct lis3lv02d *lis3 = dev_get_drvdata(dev);
738777 int x, y, z;
739778
740− lis3lv02d_sysfs_poweron(&lis3_dev);
741− mutex_lock(&lis3_dev.mutex);
742− lis3lv02d_get_xyz(&lis3_dev, &x, &y, &z);
743− mutex_unlock(&lis3_dev.mutex);
779+ lis3lv02d_sysfs_poweron(lis3);
780+ mutex_lock(&lis3->mutex);
781+ lis3lv02d_get_xyz(lis3, &x, &y, &z);
782+ mutex_unlock(&lis3->mutex);
744783 return sprintf(buf, "(%d,%d,%d)\n", x, y, z);
745784 }
746785
747786 static ssize_t lis3lv02d_rate_show(struct device *dev,
748787 struct device_attribute *attr, char *buf)
749788 {
750− lis3lv02d_sysfs_poweron(&lis3_dev);
751− return sprintf(buf, "%d\n", lis3lv02d_get_odr());
789+ struct lis3lv02d *lis3 = dev_get_drvdata(dev);
790+
791+ lis3lv02d_sysfs_poweron(lis3);
792+ return sprintf(buf, "%d\n", lis3lv02d_get_odr(lis3));
752793 }
753794
754795 static ssize_t lis3lv02d_rate_set(struct device *dev,
755796 struct device_attribute *attr, const char *buf,
756797 size_t count)
757798 {
799+ struct lis3lv02d *lis3 = dev_get_drvdata(dev);
758800 unsigned long rate;
759801
760802 if (strict_strtoul(buf, 0, &rate))
761803 return -EINVAL;
762804
763− lis3lv02d_sysfs_poweron(&lis3_dev);
764− if (lis3lv02d_set_odr(rate))
805+ lis3lv02d_sysfs_poweron(lis3);
806+ if (lis3lv02d_set_odr(lis3, rate))
765807 return -EINVAL;
766808
767809 return count;
@@ -790,6 +832,7 @@ static int lis3lv02d_add_fs(struct lis3lv02d *lis3) · 22 unmodified lines
790832 if (IS_ERR(lis3->pdev))
791833 return PTR_ERR(lis3->pdev);
792834
835+ platform_set_drvdata(lis3->pdev, lis3);
793836 return sysfs_create_group(&lis3->pdev->dev.kobj, &lis3lv02d_attribute_group);
794837 }
795838
@@ -803,7 +846,7 @@ int lis3lv02d_remove_fs(struct lis3lv02d *lis3) · 7 unmodified lines
803846
804847 /* SYSFS may have left chip running. Turn off if necessary */
805848 if (!pm_runtime_suspended(lis3->pm_dev))
806− lis3lv02d_poweroff(&lis3_dev);
849+ lis3lv02d_poweroff(lis3);
807850
808851 pm_runtime_disable(lis3->pm_dev);
809852 pm_runtime_set_suspended(lis3->pm_dev);
@@ -813,24 +856,24 @@ int lis3lv02d_remove_fs(struct lis3lv02d *lis3) · 3 unmodified lines
813856 }
814857 EXPORT_SYMBOL_GPL(lis3lv02d_remove_fs);
815858
816−static void lis3lv02d_8b_configure(struct lis3lv02d *dev,
859+static void lis3lv02d_8b_configure(struct lis3lv02d *lis3,
817860 struct lis3lv02d_platform_data *p)
818861 {
819862 int err;
820863 int ctrl2 = p->hipass_ctrl;
821864
822865 if (p->click_flags) {
823− dev->write(dev, CLICK_CFG, p->click_flags);
824− dev->write(dev, CLICK_TIMELIMIT, p->click_time_limit);
825− dev->write(dev, CLICK_LATENCY, p->click_latency);
826− dev->write(dev, CLICK_WINDOW, p->click_window);
827− dev->write(dev, CLICK_THSZ, p->click_thresh_z & 0xf);
828− dev->write(dev, CLICK_THSY_X,
866+ lis3->write(lis3, CLICK_CFG, p->click_flags);
867+ lis3->write(lis3, CLICK_TIMELIMIT, p->click_time_limit);
868+ lis3->write(lis3, CLICK_LATENCY, p->click_latency);
869+ lis3->write(lis3, CLICK_WINDOW, p->click_window);
870+ lis3->write(lis3, CLICK_THSZ, p->click_thresh_z & 0xf);
871+ lis3->write(lis3, CLICK_THSY_X,
829872 (p->click_thresh_x & 0xf) |
830873 (p->click_thresh_y << 4));
831874
832− if (dev->idev) {
833− struct input_dev *input_dev = lis3_dev.idev->input;
875+ if (lis3->idev) {
876+ struct input_dev *input_dev = lis3->idev->input;
834877 input_set_capability(input_dev, EV_KEY, BTN_X);
835878 input_set_capability(input_dev, EV_KEY, BTN_Y);
836879 input_set_capability(input_dev, EV_KEY, BTN_Z);
@@ -838,22 +881,22 @@ static void lis3lv02d_8b_configure(struct lis3lv02d *dev, · 1 unmodified line
838881 }
839882
840883 if (p->wakeup_flags) {
841− dev->write(dev, FF_WU_CFG_1, p->wakeup_flags);
842− dev->write(dev, FF_WU_THS_1, p->wakeup_thresh & 0x7f);
884+ lis3->write(lis3, FF_WU_CFG_1, p->wakeup_flags);
885+ lis3->write(lis3, FF_WU_THS_1, p->wakeup_thresh & 0x7f);
843886 /* pdata value + 1 to keep this backward compatible*/
844− dev->write(dev, FF_WU_DURATION_1, p->duration1 + 1);
887+ lis3->write(lis3, FF_WU_DURATION_1, p->duration1 + 1);
845888 ctrl2 ^= HP_FF_WU1; /* Xor to keep compatible with old pdata*/
846889 }
847890
848891 if (p->wakeup_flags2) {
849− dev->write(dev, FF_WU_CFG_2, p->wakeup_flags2);
850− dev->write(dev, FF_WU_THS_2, p->wakeup_thresh2 & 0x7f);
892+ lis3->write(lis3, FF_WU_CFG_2, p->wakeup_flags2);
893+ lis3->write(lis3, FF_WU_THS_2, p->wakeup_thresh2 & 0x7f);
851894 /* pdata value + 1 to keep this backward compatible*/
852− dev->write(dev, FF_WU_DURATION_2, p->duration2 + 1);
895+ lis3->write(lis3, FF_WU_DURATION_2, p->duration2 + 1);
853896 ctrl2 ^= HP_FF_WU2; /* Xor to keep compatible with old pdata*/
854897 }
855898 /* Configure hipass filters */
856− dev->write(dev, CTRL_REG2, ctrl2);
899+ lis3->write(lis3, CTRL_REG2, ctrl2);
857900
858901 if (p->irq2) {
859902 err = request_threaded_irq(p->irq2,
@@ -861,7 +904,7 @@ static void lis3lv02d_8b_configure(struct lis3lv02d *dev, · 1 unmodified line
861904 lis302dl_interrupt_thread2_8b,
862905 IRQF_TRIGGER_RISING | IRQF_ONESHOT |
863906 (p->irq_flags2 & IRQF_TRIGGER_MASK),
864− DRIVER_NAME, &lis3_dev);
907+ DRIVER_NAME, lis3);
865908 if (err < 0)
866909 pr_err("No second IRQ. Limited functionality\n");
867910 }
@@ -871,93 +914,97 @@ static void lis3lv02d_8b_configure(struct lis3lv02d *dev, · 3 unmodified lines
871914 * Initialise the accelerometer and the various subsystems.
872915 * Should be rather independent of the bus system.
873916 */
874−int lis3lv02d_init_device(struct lis3lv02d *dev)
917+int lis3lv02d_init_device(struct lis3lv02d *lis3)
875918 {
876919 int err;
877920 irq_handler_t thread_fn;
878921 int irq_flags = 0;
879922
880− dev->whoami = lis3lv02d_read_8(dev, WHO_AM_I);
923+ lis3->whoami = lis3lv02d_read_8(lis3, WHO_AM_I);
881924
882− switch (dev->whoami) {
925+ switch (lis3->whoami) {
883926 case WAI_12B:
884927 pr_info("12 bits sensor found\n");
885− dev->read_data = lis3lv02d_read_12;
886− dev->mdps_max_val = 2048;
887− dev->pwron_delay = LIS3_PWRON_DELAY_WAI_12B;
888− dev->odrs = lis3_12_rates;
889− dev->odr_mask = CTRL1_DF0 | CTRL1_DF1;
890− dev->scale = LIS3_SENSITIVITY_12B;
891− dev->regs = lis3_wai12_regs;
892− dev->regs_size = ARRAY_SIZE(lis3_wai12_regs);
928+ lis3->read_data = lis3lv02d_read_12;
929+ lis3->mdps_max_val = 2048;
930+ lis3->pwron_delay = LIS3_PWRON_DELAY_WAI_12B;
931+ lis3->odrs = lis3_12_rates;
932+ lis3->odr_mask = CTRL1_DF0 | CTRL1_DF1;
933+ lis3->scale = LIS3_SENSITIVITY_12B;
934+ lis3->regs = lis3_wai12_regs;
935+ lis3->regs_size = ARRAY_SIZE(lis3_wai12_regs);
893936 break;
894937 case WAI_8B:
895938 pr_info("8 bits sensor found\n");
896− dev->read_data = lis3lv02d_read_8;
897− dev->mdps_max_val = 128;
898− dev->pwron_delay = LIS3_PWRON_DELAY_WAI_8B;
899− dev->odrs = lis3_8_rates;
900− dev->odr_mask = CTRL1_DR;
901− dev->scale = LIS3_SENSITIVITY_8B;
902− dev->regs = lis3_wai8_regs;
903− dev->regs_size = ARRAY_SIZE(lis3_wai8_regs);
939+ lis3->read_data = lis3lv02d_read_8;
940+ lis3->mdps_max_val = 128;
941+ lis3->pwron_delay = LIS3_PWRON_DELAY_WAI_8B;
942+ lis3->odrs = lis3_8_rates;
943+ lis3->odr_mask = CTRL1_DR;
944+ lis3->scale = LIS3_SENSITIVITY_8B;
945+ lis3->regs = lis3_wai8_regs;
946+ lis3->regs_size = ARRAY_SIZE(lis3_wai8_regs);
904947 break;
905948 case WAI_3DC:
906949 pr_info("8 bits 3DC sensor found\n");
907− dev->read_data = lis3lv02d_read_8;
908− dev->mdps_max_val = 128;
909− dev->pwron_delay = LIS3_PWRON_DELAY_WAI_8B;
910− dev->odrs = lis3_3dc_rates;
911− dev->odr_mask = CTRL1_ODR0|CTRL1_ODR1|CTRL1_ODR2|CTRL1_ODR3;
912− dev->scale = LIS3_SENSITIVITY_8B;
950+ lis3->read_data = lis3lv02d_read_8;
951+ lis3->mdps_max_val = 128;
952+ lis3->pwron_delay = LIS3_PWRON_DELAY_WAI_8B;
953+ lis3->odrs = lis3_3dc_rates;
954+ lis3->odr_mask = CTRL1_ODR0|CTRL1_ODR1|CTRL1_ODR2|CTRL1_ODR3;
955+ lis3->scale = LIS3_SENSITIVITY_8B;
913956 break;
914957 default:
915− pr_err("unknown sensor type 0x%X\n", dev->whoami);
958+ pr_err("unknown sensor type 0x%X\n", lis3->whoami);
916959 return -EINVAL;
917960 }
918961
919− dev->reg_cache = kzalloc(max(sizeof(lis3_wai8_regs),
962+ lis3->reg_cache = kzalloc(max(sizeof(lis3_wai8_regs),
920963 sizeof(lis3_wai12_regs)), GFP_KERNEL);
921964
922− if (dev->reg_cache == NULL) {
965+ if (lis3->reg_cache == NULL) {
923966 printk(KERN_ERR DRIVER_NAME "out of memory\n");
924967 return -ENOMEM;
925968 }
926969
927− mutex_init(&dev->mutex);
928− atomic_set(&dev->wake_thread, 0);
970+ mutex_init(&lis3->mutex);
971+ atomic_set(&lis3->wake_thread, 0);
929972
930− lis3lv02d_add_fs(dev);
931− lis3lv02d_poweron(dev);
973+ lis3lv02d_add_fs(lis3);
974+ err = lis3lv02d_poweron(lis3);
975+ if (err) {
976+ lis3lv02d_remove_fs(lis3);
977+ return err;
978+ }
932979
933− if (dev->pm_dev) {
934− pm_runtime_set_active(dev->pm_dev);
935− pm_runtime_enable(dev->pm_dev);
980+ if (lis3->pm_dev) {
981+ pm_runtime_set_active(lis3->pm_dev);
982+ pm_runtime_enable(lis3->pm_dev);
936983 }
937984
938− if (lis3lv02d_joystick_enable())
985+ if (lis3lv02d_joystick_enable(lis3))
939986 pr_err("joystick initialization failed\n");
940987
941988 /* passing in platform specific data is purely optional and only
942989 * used by the SPI transport layer at the moment */
943− if (dev->pdata) {
944− struct lis3lv02d_platform_data *p = dev->pdata;
990+ if (lis3->pdata) {
991+ struct lis3lv02d_platform_data *p = lis3->pdata;
945992
946− if (dev->whoami == WAI_8B)
947− lis3lv02d_8b_configure(dev, p);
993+ if (lis3->whoami == WAI_8B)
994+ lis3lv02d_8b_configure(lis3, p);
948995
949996 irq_flags = p->irq_flags1 & IRQF_TRIGGER_MASK;
950997
951− dev->irq_cfg = p->irq_cfg;
998+ lis3->irq_cfg = p->irq_cfg;
952999 if (p->irq_cfg)
953− dev->write(dev, CTRL_REG3, p->irq_cfg);
1000+ lis3->write(lis3, CTRL_REG3, p->irq_cfg);
9541001
9551002 if (p->default_rate)
956− lis3lv02d_set_odr(p->default_rate);
1003+ lis3lv02d_set_odr(lis3, p->default_rate);
9571004 }
9581005
9591006 /* bail if we did not get an IRQ from the bus layer */
960− if (!dev->irq) {
1007+ if (!lis3->irq) {
9611008 pr_debug("No IRQ. Disabling /dev/freefall\n");
9621009 goto out;
9631010 }
@@ -973,23 +1020,27 @@ int lis3lv02d_init_device(struct lis3lv02d *dev) · 9 unmodified lines
9731020 * io-apic is not configurable (and generates a warning) but I keep it
9741021 * in case of support for other hardware.
9751022 */
976− if (dev->pdata && dev->whoami == WAI_8B)
1023+ if (lis3->pdata && lis3->whoami == WAI_8B)
9771024 thread_fn = lis302dl_interrupt_thread1_8b;
9781025 else
9791026 thread_fn = NULL;
9801027
981− err = request_threaded_irq(dev->irq, lis302dl_interrupt,
1028+ err = request_threaded_irq(lis3->irq, lis302dl_interrupt,
9821029 thread_fn,
9831030 IRQF_TRIGGER_RISING | IRQF_ONESHOT |
9841031 irq_flags,
985− DRIVER_NAME, &lis3_dev);
1032+ DRIVER_NAME, lis3);
9861033
9871034 if (err < 0) {
9881035 pr_err("Cannot get IRQ\n");
9891036 goto out;
9901037 }
9911038
992− if (misc_register(&lis3lv02d_misc_device))
1039+ lis3->miscdev.minor = MISC_DYNAMIC_MINOR;
1040+ lis3->miscdev.name = "freefall";
1041+ lis3->miscdev.fops = &lis3lv02d_misc_fops;
1042+
1043+ if (misc_register(&lis3->miscdev))
9931044 pr_err("misc_register failed\n");
9941045 out:
9951046 return 0;
drivers/misc/lis3lv02d/lis3lv02d.h+6−3
@@ -21,6 +21,7 @@ · 20 unmodified lines
2121 #include <linux/platform_device.h>
2222 #include <linux/input-polldev.h>
2323 #include <linux/regulator/consumer.h>
24+#include <linux/miscdevice.h>
2425
2526 /*
2627 * This driver tries to support the "digital" accelerometer chips from
@@ -273,6 +274,8 @@ struct lis3lv02d { · 246 unmodified lines
273274 struct fasync_struct *async_queue; /* queue for the misc device */
274275 wait_queue_head_t misc_wait; /* Wait queue for the misc device */
275276 unsigned long misc_opened; /* bit0: whether the device is open */
277+ struct miscdevice miscdev;
278+
276279 int data_ready_count[2];
277280 atomic_t wake_thread;
278281 unsigned char irq_cfg;
@@ -282,10 +285,10 @@ struct lis3lv02d { · 3 unmodified lines
282285 };
283286
284287 int lis3lv02d_init_device(struct lis3lv02d *lis3);
285−int lis3lv02d_joystick_enable(void);
286−void lis3lv02d_joystick_disable(void);
288+int lis3lv02d_joystick_enable(struct lis3lv02d *lis3);
289+void lis3lv02d_joystick_disable(struct lis3lv02d *lis3);
287290 void lis3lv02d_poweroff(struct lis3lv02d *lis3);
288−void lis3lv02d_poweron(struct lis3lv02d *lis3);
291+int lis3lv02d_poweron(struct lis3lv02d *lis3);
289292 int lis3lv02d_remove_fs(struct lis3lv02d *lis3);
290293
291294 extern struct lis3lv02d lis3_dev;
drivers/misc/lis3lv02d/lis3lv02d_i2c.c+20−25
@@ -79,8 +79,7 @@ static int lis3_i2c_init(struct lis3lv02d *lis3) · 78 unmodified lines
7979 u8 reg;
8080 int ret;
8181
82− if (lis3->reg_ctrl)
83− lis3_reg_ctrl(lis3, LIS3_REG_ON);
82+ lis3_reg_ctrl(lis3, LIS3_REG_ON);
8483
8584 lis3->read(lis3, WHO_AM_I, &reg);
8685 if (reg != lis3->whoami)
@@ -106,10 +105,6 @@ static int __devinit lis3lv02d_i2c_probe(struct i2c_client *client, · 19 unmodified lines
106105 struct lis3lv02d_platform_data *pdata = client->dev.platform_data;
107106
108107 if (pdata) {
109− /* Regulator control is optional */
110− if (pdata->driver_features & LIS3_USE_REGULATOR_CTRL)
111− lis3_dev.reg_ctrl = lis3_reg_ctrl;
112−
113108 if ((pdata->driver_features & LIS3_USE_BLOCK_READ) &&
114109 (i2c_check_functionality(client->adapter,
115110 I2C_FUNC_SMBUS_I2C_BLOCK)))
@@ -131,15 +126,13 @@ static int __devinit lis3lv02d_i2c_probe(struct i2c_client *client, · 15 unmodified lines
131126 goto fail;
132127 }
133128
134− if (lis3_dev.reg_ctrl) {
135− lis3_dev.regulators[0].supply = reg_vdd;
136− lis3_dev.regulators[1].supply = reg_vdd_io;
137− ret = regulator_bulk_get(&client->dev,
138− ARRAY_SIZE(lis3_dev.regulators),
139− lis3_dev.regulators);
140− if (ret < 0)
141− goto fail;
142− }
129+ lis3_dev.regulators[0].supply = reg_vdd;
130+ lis3_dev.regulators[1].supply = reg_vdd_io;
131+ ret = regulator_bulk_get(&client->dev,
132+ ARRAY_SIZE(lis3_dev.regulators),
133+ lis3_dev.regulators);
134+ if (ret < 0)
135+ goto fail;
143136
144137 lis3_dev.pdata = pdata;
145138 lis3_dev.bus_priv = client;
@@ -153,16 +146,19 @@ static int __devinit lis3lv02d_i2c_probe(struct i2c_client *client, · 7 unmodified lines
153146 i2c_set_clientdata(client, &lis3_dev);
154147
155148 /* Provide power over the init call */
156− if (lis3_dev.reg_ctrl)
157− lis3_reg_ctrl(&lis3_dev, LIS3_REG_ON);
149+ lis3_reg_ctrl(&lis3_dev, LIS3_REG_ON);
158150
159151 ret = lis3lv02d_init_device(&lis3_dev);
160152
161− if (lis3_dev.reg_ctrl)
162− lis3_reg_ctrl(&lis3_dev, LIS3_REG_OFF);
153+ lis3_reg_ctrl(&lis3_dev, LIS3_REG_OFF);
163154
164− if (ret == 0)
165− return 0;
155+ if (ret)
156+ goto fail2;
157+ return 0;
158+
159+fail2:
160+ regulator_bulk_free(ARRAY_SIZE(lis3_dev.regulators),
161+ lis3_dev.regulators);
166162 fail:
167163 if (pdata && pdata->release_resources)
168164 pdata->release_resources();
@@ -177,12 +173,11 @@ static int __devexit lis3lv02d_i2c_remove(struct i2c_client *client) · 8 unmodified lines
177173 if (pdata && pdata->release_resources)
178174 pdata->release_resources();
179175
180− lis3lv02d_joystick_disable();
176+ lis3lv02d_joystick_disable(lis3);
181177 lis3lv02d_remove_fs(&lis3_dev);
182178
183− if (lis3_dev.reg_ctrl)
184− regulator_bulk_free(ARRAY_SIZE(lis3->regulators),
185− lis3_dev.regulators);
179+ regulator_bulk_free(ARRAY_SIZE(lis3->regulators),
180+ lis3_dev.regulators);
186181 return 0;
187182 }
188183
drivers/misc/lis3lv02d/lis3lv02d_spi.c+1−1
@@ -83,7 +83,7 @@ static int __devinit lis302dl_spi_probe(struct spi_device *spi) · 82 unmodified lines
8383 static int __devexit lis302dl_spi_remove(struct spi_device *spi)
8484 {
8585 struct lis3lv02d *lis3 = spi_get_drvdata(spi);
86− lis3lv02d_joystick_disable();
86+ lis3lv02d_joystick_disable(lis3);
8787 lis3lv02d_poweroff(lis3);
8888
8989 return lis3lv02d_remove_fs(&lis3_dev);
drivers/net/ethernet/mellanox/mlx4/mlx4_en.h+2−1
@@ -581,8 +581,9 @@ extern const struct ethtool_ops mlx4_en_ethtool_ops; · 580 unmodified lines
581581 * printk / logging functions
582582 */
583583
584+__printf(3, 4)
584585 int en_print(const char *level, const struct mlx4_en_priv *priv,
585− const char *format, ...) __attribute__ ((format (printf, 3, 4)));
586+ const char *format, ...);
586587
587588 #define en_dbg(mlevel, priv, format, arg...) \
588589 do { \
drivers/net/wireless/at76c50x-usb.c+1−1
@@ -517,7 +517,7 @@ static char *hex2str(void *buf, size_t len) · 516 unmodified lines
517517 goto exit;
518518
519519 while (len--) {
520− obuf = pack_hex_byte(obuf, *ibuf++);
520+ obuf = hex_byte_pack(obuf, *ibuf++);
521521 *obuf++ = '-';
522522 }
523523 obuf--;
drivers/net/wireless/ath/ath.h+2−3
@@ -173,8 +173,7 @@ bool ath_hw_keyreset(struct ath_common *common, u16 entry); · 172 unmodified lines
173173 void ath_hw_cycle_counters_update(struct ath_common *common);
174174 int32_t ath_hw_get_listen_time(struct ath_common *common);
175175
176−extern __attribute__((format (printf, 2, 3)))
177−void ath_printk(const char *level, const char *fmt, ...);
176+extern __printf(2, 3) void ath_printk(const char *level, const char *fmt, ...);
178177
179178 #define _ath_printk(level, common, fmt, ...) \
180179 do { \
@@ -258,7 +257,7 @@ do { \ · 77 unmodified lines
258257
259258 #else
260259
261−static inline __attribute__((format (printf, 3, 4)))
260+static inline __attribute__ ((format (printf, 3, 4)))
262261 void ath_dbg(struct ath_common *common, enum ATH_DEBUG dbg_mask,
263262 const char *fmt, ...)
264263 {
drivers/net/wireless/ath/ath5k/debug.h+2−2
@@ -141,10 +141,10 @@ ath5k_debug_printtxbuf(struct ath5k_hw *ah, struct ath5k_buf *bf); · 140 unmodified lines
141141
142142 #include <linux/compiler.h>
143143
144−static inline void __attribute__ ((format (printf, 3, 4)))
144+static inline __printf(3, 4) void
145145 ATH5K_DBG(struct ath5k_hw *ah, unsigned int m, const char *fmt, ...) {}
146146
147−static inline void __attribute__ ((format (printf, 3, 4)))
147+static inline __printf(3, 4) void
148148 ATH5K_DBG_UNLIMIT(struct ath5k_hw *ah, unsigned int m, const char *fmt, ...)
149149 {}
150150
drivers/net/wireless/ath/ath6kl/debug.h+2−2
@@ -44,8 +44,8 @@ enum ATH6K_DEBUG_MASK { · 43 unmodified lines
4444 };
4545
4646 extern unsigned int debug_mask;
47−extern int ath6kl_printk(const char *level, const char *fmt, ...)
48− __attribute__ ((format (printf, 2, 3)));
47+extern __printf(2, 3)
48+int ath6kl_printk(const char *level, const char *fmt, ...);
4949
5050 #define ath6kl_info(fmt, ...) \
5151 ath6kl_printk(KERN_INFO, fmt, ##__VA_ARGS__)
drivers/net/wireless/b43/b43.h+4−8
@@ -1011,14 +1011,10 @@ static inline bool b43_using_pio_transfers(struct b43_wldev *dev) · 1010 unmodified lines
10111011 }
10121012
10131013 /* Message printing */
1014−void b43info(struct b43_wl *wl, const char *fmt, ...)
1015− __attribute__ ((format(printf, 2, 3)));
1016−void b43err(struct b43_wl *wl, const char *fmt, ...)
1017− __attribute__ ((format(printf, 2, 3)));
1018−void b43warn(struct b43_wl *wl, const char *fmt, ...)
1019− __attribute__ ((format(printf, 2, 3)));
1020−void b43dbg(struct b43_wl *wl, const char *fmt, ...)
1021− __attribute__ ((format(printf, 2, 3)));
1014+__printf(2, 3) void b43info(struct b43_wl *wl, const char *fmt, ...);
1015+__printf(2, 3) void b43err(struct b43_wl *wl, const char *fmt, ...);
1016+__printf(2, 3) void b43warn(struct b43_wl *wl, const char *fmt, ...);
1017+__printf(2, 3) void b43dbg(struct b43_wl *wl, const char *fmt, ...);
10221018
10231019
10241020 /* A WARN_ON variant that vanishes when b43 debugging is disabled.
drivers/net/wireless/b43legacy/b43legacy.h+8−8
@@ -810,15 +810,15 @@ struct b43legacy_lopair *b43legacy_get_lopair(struct b43legacy_phy *phy, · 809 unmodified lines
810810
811811
812812 /* Message printing */
813−void b43legacyinfo(struct b43legacy_wl *wl, const char *fmt, ...)
814− __attribute__((format(printf, 2, 3)));
815−void b43legacyerr(struct b43legacy_wl *wl, const char *fmt, ...)
816− __attribute__((format(printf, 2, 3)));
817−void b43legacywarn(struct b43legacy_wl *wl, const char *fmt, ...)
818− __attribute__((format(printf, 2, 3)));
813+__printf(2, 3)
814+void b43legacyinfo(struct b43legacy_wl *wl, const char *fmt, ...);
815+__printf(2, 3)
816+void b43legacyerr(struct b43legacy_wl *wl, const char *fmt, ...);
817+__printf(2, 3)
818+void b43legacywarn(struct b43legacy_wl *wl, const char *fmt, ...);
819819 #if B43legacy_DEBUG
820−void b43legacydbg(struct b43legacy_wl *wl, const char *fmt, ...)
821− __attribute__((format(printf, 2, 3)));
820+__printf(2, 3)
821+void b43legacydbg(struct b43legacy_wl *wl, const char *fmt, ...);
822822 #else /* DEBUG */
823823 # define b43legacydbg(wl, fmt...) do { /* nothing */ } while (0)
824824 #endif /* DEBUG */
drivers/platform/x86/hp_accel.c+6−4
@@ -210,6 +210,8 @@ static struct dmi_system_id lis3lv02d_dmi_ids[] = { · 209 unmodified lines
210210 AXIS_DMI_MATCH("NC6715x", "HP Compaq 6715", y_inverted),
211211 AXIS_DMI_MATCH("NC693xx", "HP EliteBook 693", xy_rotated_right),
212212 AXIS_DMI_MATCH("NC693xx", "HP EliteBook 853", xy_swap),
213+ AXIS_DMI_MATCH("NC854xx", "HP EliteBook 854", y_inverted),
214+ AXIS_DMI_MATCH("NC273xx", "HP EliteBook 273", y_inverted),
213215 /* Intel-based HP Pavilion dv5 */
214216 AXIS_DMI_MATCH2("HPDV5_I",
215217 PRODUCT_NAME, "HP Pavilion dv5",
@@ -228,6 +230,7 @@ static struct dmi_system_id lis3lv02d_dmi_ids[] = { · 12 unmodified lines
228230 AXIS_DMI_MATCH("HPB452x", "HP ProBook 452", y_inverted),
229231 AXIS_DMI_MATCH("HPB522x", "HP ProBook 522", xy_swap),
230232 AXIS_DMI_MATCH("HPB532x", "HP ProBook 532", y_inverted),
233+ AXIS_DMI_MATCH("HPB655x", "HP ProBook 655", xy_swap_inverted),
231234 AXIS_DMI_MATCH("Mini510x", "HP Mini 510", xy_rotated_left_usd),
232235 AXIS_DMI_MATCH("HPB63xx", "HP ProBook 63", xy_swap),
233236 AXIS_DMI_MATCH("HPB64xx", "HP ProBook 64", xy_swap),
@@ -325,7 +328,7 @@ static int lis3lv02d_add(struct acpi_device *device) · 91 unmodified lines
325328 INIT_WORK(&hpled_led.work, delayed_set_status_worker);
326329 ret = led_classdev_register(NULL, &hpled_led.led_classdev);
327330 if (ret) {
328− lis3lv02d_joystick_disable();
331+ lis3lv02d_joystick_disable(&lis3_dev);
329332 lis3lv02d_poweroff(&lis3_dev);
330333 flush_work(&hpled_led.work);
331334 return ret;
@@ -339,7 +342,7 @@ static int lis3lv02d_remove(struct acpi_device *device, int type) · 7 unmodified lines
339342 if (!device)
340343 return -EINVAL;
341344
342− lis3lv02d_joystick_disable();
345+ lis3lv02d_joystick_disable(&lis3_dev);
343346 lis3lv02d_poweroff(&lis3_dev);
344347
345348 led_classdev_unregister(&hpled_led.led_classdev);
@@ -359,8 +362,7 @@ static int lis3lv02d_suspend(struct acpi_device *device, pm_message_t state) · 13 unmodified lines
359362
360363 static int lis3lv02d_resume(struct acpi_device *device)
361364 {
362− lis3lv02d_poweron(&lis3_dev);
363− return 0;
365+ return lis3lv02d_poweron(&lis3_dev);
364366 }
365367 #else
366368 #define lis3lv02d_suspend NULL
drivers/staging/iio/trigger.h+1−2
@@ -115,8 +115,7 @@ void iio_trigger_poll_chained(struct iio_trigger *trig, s64 time); · 114 unmodified lines
115115
116116 irqreturn_t iio_trigger_generic_data_rdy_poll(int irq, void *private);
117117
118−struct iio_trigger *iio_allocate_trigger(const char *fmt, ...)
119− __attribute__((format(printf, 1, 2)));
118+__printf(1, 2) struct iio_trigger *iio_allocate_trigger(const char *fmt, ...);
120119 void iio_free_trigger(struct iio_trigger *trig);
121120
122121 #endif /* _IIO_TRIGGER_H_ */
drivers/video/backlight/adp8870_bl.c+0−2
@@ -931,7 +931,6 @@ out: · 930 unmodified lines
931931 out1:
932932 backlight_device_unregister(bl);
933933 out2:
934− i2c_set_clientdata(client, NULL);
935934 kfree(data);
936935
937936 return ret;
@@ -951,7 +950,6 @@ static int __devexit adp8870_remove(struct i2c_client *client) · 13 unmodified lines
951950 &adp8870_bl_attr_group);
952951
953952 backlight_device_unregister(data->bl);
954− i2c_set_clientdata(client, NULL);
955953 kfree(data);
956954
957955 return 0;
drivers/video/backlight/generic_bl.c+2−2
@@ -56,7 +56,7 @@ static int genericbl_get_intensity(struct backlight_device *bd) · 55 unmodified lines
5656 * Called when the battery is low to limit the backlight intensity.
5757 * If limit==0 clear any limit, otherwise limit the intensity
5858 */
59−void corgibl_limit_intensity(int limit)
59+void genericbl_limit_intensity(int limit)
6060 {
6161 struct backlight_device *bd = generic_backlight_device;
6262
@@ -68,7 +68,7 @@ void corgibl_limit_intensity(int limit) · 5 unmodified lines
6868 backlight_update_status(generic_backlight_device);
6969 mutex_unlock(&bd->ops_lock);
7070 }
71−EXPORT_SYMBOL(corgibl_limit_intensity);
71+EXPORT_SYMBOL(genericbl_limit_intensity);
7272
7373 static const struct backlight_ops genericbl_ops = {
7474 .options = BL_CORE_SUSPENDRESUME,
drivers/video/backlight/l4f00242t03.c+23−47
@@ -52,15 +52,11 @@ static void l4f00242t03_lcd_init(struct spi_device *spi) · 51 unmodified lines
5252
5353 dev_dbg(&spi->dev, "initializing LCD\n");
5454
55− if (priv->io_reg) {
56− regulator_set_voltage(priv->io_reg, 1800000, 1800000);
57− regulator_enable(priv->io_reg);
58− }
55+ regulator_set_voltage(priv->io_reg, 1800000, 1800000);
56+ regulator_enable(priv->io_reg);
5957
60− if (priv->core_reg) {
61− regulator_set_voltage(priv->core_reg, 2800000, 2800000);
62− regulator_enable(priv->core_reg);
63− }
58+ regulator_set_voltage(priv->core_reg, 2800000, 2800000);
59+ regulator_enable(priv->core_reg);
6460
6561 l4f00242t03_reset(pdata->reset_gpio);
6662
@@ -78,11 +74,8 @@ static void l4f00242t03_lcd_powerdown(struct spi_device *spi) · 11 unmodified lines
7874
7975 gpio_set_value(pdata->data_enable_gpio, 0);
8076
81− if (priv->io_reg)
82− regulator_disable(priv->io_reg);
83−
84− if (priv->core_reg)
85− regulator_disable(priv->core_reg);
77+ regulator_disable(priv->io_reg);
78+ regulator_disable(priv->core_reg);
8679 }
8780
8881 static int l4f00242t03_lcd_power_get(struct lcd_device *ld)
@@ -178,47 +171,34 @@ static int __devinit l4f00242t03_probe(struct spi_device *spi) · 89 unmodified lines
178171
179172 priv->spi = spi;
180173
181− ret = gpio_request(pdata->reset_gpio, "lcd l4f00242t03 reset");
174+ ret = gpio_request_one(pdata->reset_gpio, GPIOF_OUT_INIT_HIGH,
175+ "lcd l4f00242t03 reset");
182176 if (ret) {
183177 dev_err(&spi->dev,
184178 "Unable to get the lcd l4f00242t03 reset gpio.\n");
185179 goto err;
186180 }
187181
188− ret = gpio_direction_output(pdata->reset_gpio, 1);
189− if (ret)
190− goto err2;
191−
192− ret = gpio_request(pdata->data_enable_gpio,
193− "lcd l4f00242t03 data enable");
182+ ret = gpio_request_one(pdata->data_enable_gpio, GPIOF_OUT_INIT_LOW,
183+ "lcd l4f00242t03 data enable");
194184 if (ret) {
195185 dev_err(&spi->dev,
196186 "Unable to get the lcd l4f00242t03 data en gpio.\n");
197187 goto err2;
198188 }
199189
200− ret = gpio_direction_output(pdata->data_enable_gpio, 0);
201− if (ret)
190+ priv->io_reg = regulator_get(&spi->dev, "vdd");
191+ if (IS_ERR(priv->io_reg)) {
192+ dev_err(&spi->dev, "%s: Unable to get the IO regulator\n",
193+ __func__);
202194 goto err3;
203−
204− if (pdata->io_supply) {
205− priv->io_reg = regulator_get(NULL, pdata->io_supply);
206−
207− if (IS_ERR(priv->io_reg)) {
208− pr_err("%s: Unable to get the IO regulator\n",
209− __func__);
210− goto err3;
211− }
212195 }
213196
214− if (pdata->core_supply) {
215− priv->core_reg = regulator_get(NULL, pdata->core_supply);
216−
217− if (IS_ERR(priv->core_reg)) {
218− pr_err("%s: Unable to get the core regulator\n",
219− __func__);
220− goto err4;
221− }
197+ priv->core_reg = regulator_get(&spi->dev, "vcore");
198+ if (IS_ERR(priv->core_reg)) {
199+ dev_err(&spi->dev, "%s: Unable to get the core regulator\n",
200+ __func__);
201+ goto err4;
222202 }
223203
224204 priv->ld = lcd_device_register("l4f00242t03",
@@ -238,11 +218,9 @@ static int __devinit l4f00242t03_probe(struct spi_device *spi) · 13 unmodified lines
238218 return 0;
239219
240220 err5:
241− if (priv->core_reg)
242− regulator_put(priv->core_reg);
221+ regulator_put(priv->core_reg);
243222 err4:
244− if (priv->io_reg)
245− regulator_put(priv->io_reg);
223+ regulator_put(priv->io_reg);
246224 err3:
247225 gpio_free(pdata->data_enable_gpio);
248226 err2:
@@ -266,10 +244,8 @@ static int __devexit l4f00242t03_remove(struct spi_device *spi) · 17 unmodified lines
266244 gpio_free(pdata->data_enable_gpio);
267245 gpio_free(pdata->reset_gpio);
268246
269− if (priv->io_reg)
270− regulator_put(priv->io_reg);
271− if (priv->core_reg)
272− regulator_put(priv->core_reg);
247+ regulator_put(priv->io_reg);
248+ regulator_put(priv->core_reg);
273249
274250 kfree(priv);
275251
fs/Kconfig+1−1
@@ -109,7 +109,7 @@ source "fs/proc/Kconfig" · 108 unmodified lines
109109 source "fs/sysfs/Kconfig"
110110
111111 config TMPFS
112− bool "Virtual memory file system support (former shm fs)"
112+ bool "Tmpfs virtual memory file system support (former shm fs)"
113113 depends on SHMEM
114114 help
115115 Tmpfs is a file system which keeps all files in virtual memory.
fs/aio.c+2−2
@@ -1387,13 +1387,13 @@ static ssize_t aio_setup_vectored_rw(int type, struct kiocb *kiocb, bool compat) · 1386 unmodified lines
13871387 ret = compat_rw_copy_check_uvector(type,
13881388 (struct compat_iovec __user *)kiocb->ki_buf,
13891389 kiocb->ki_nbytes, 1, &kiocb->ki_inline_vec,
1390− &kiocb->ki_iovec);
1390+ &kiocb->ki_iovec, 1);
13911391 else
13921392 #endif
13931393 ret = rw_copy_check_uvector(type,
13941394 (struct iovec __user *)kiocb->ki_buf,
13951395 kiocb->ki_nbytes, 1, &kiocb->ki_inline_vec,
1396− &kiocb->ki_iovec);
1396+ &kiocb->ki_iovec, 1);
13971397 if (ret < 0)
13981398 goto out;
13991399
fs/buffer.c+4−1
@@ -213,13 +213,16 @@ __find_get_block_slow(struct block_device *bdev, sector_t block) · 212 unmodified lines
213213 * elsewhere, don't buffer_error if we had some unmapped buffers
214214 */
215215 if (all_mapped) {
216+ char b[BDEVNAME_SIZE];
217+
216218 printk("__find_get_block_slow() failed. "
217219 "block=%llu, b_blocknr=%llu\n",
218220 (unsigned long long)block,
219221 (unsigned long long)bh->b_blocknr);
220222 printk("b_state=0x%08lx, b_size=%zu\n",
221223 bh->b_state, bh->b_size);
222− printk("device blocksize: %d\n", 1 << bd_inode->i_blkbits);
224+ printk("device %s blocksize: %d\n", bdevname(bdev, b),
225+ 1 << bd_inode->i_blkbits);
223226 }
224227 out_unlock:
225228 spin_unlock(&bd_mapping->private_lock);
fs/compat.c+4−3
@@ -546,7 +546,7 @@ out: · 545 unmodified lines
546546 ssize_t compat_rw_copy_check_uvector(int type,
547547 const struct compat_iovec __user *uvector, unsigned long nr_segs,
548548 unsigned long fast_segs, struct iovec *fast_pointer,
549− struct iovec **ret_pointer)
549+ struct iovec **ret_pointer, int check_access)
550550 {
551551 compat_ssize_t tot_len;
552552 struct iovec *iov = *ret_pointer = fast_pointer;
@@ -593,7 +593,8 @@ ssize_t compat_rw_copy_check_uvector(int type, · 40 unmodified lines
593593 }
594594 if (len < 0) /* size_t not fitting in compat_ssize_t .. */
595595 goto out;
596− if (!access_ok(vrfy_dir(type), compat_ptr(buf), len)) {
596+ if (check_access &&
597+ !access_ok(vrfy_dir(type), compat_ptr(buf), len)) {
597598 ret = -EFAULT;
598599 goto out;
599600 }
@@ -1107,7 +1108,7 @@ static ssize_t compat_do_readv_writev(int type, struct file *file, · 507 unmodified lines
11071108 goto out;
11081109
11091110 tot_len = compat_rw_copy_check_uvector(type, uvector, nr_segs,
1110− UIO_FASTIOV, iovstack, &iov);
1111+ UIO_FASTIOV, iovstack, &iov, 1);
11111112 if (tot_len == 0) {
11121113 ret = 0;
11131114 goto out;
fs/ecryptfs/ecryptfs_kernel.h+1−1
@@ -514,7 +514,7 @@ ecryptfs_set_dentry_lower_mnt(struct dentry *dentry, struct vfsmount *lower_mnt) · 513 unmodified lines
514514
515515 #define ecryptfs_printk(type, fmt, arg...) \
516516 __ecryptfs_printk(type "%s: " fmt, __func__, ## arg);
517−__attribute__ ((format(printf, 1, 2)))
517+__printf(1, 2)
518518 void __ecryptfs_printk(const char *fmt, ...);
519519
520520 extern const struct file_operations ecryptfs_main_fops;
fs/eventpoll.c+18−7
@@ -70,6 +70,15 @@ · 69 unmodified lines
7070 * simultaneous inserts (A into B and B into A) from racing and
7171 * constructing a cycle without either insert observing that it is
7272 * going to.
73+ * It is necessary to acquire multiple "ep->mtx"es at once in the
74+ * case when one epoll fd is added to another. In this case, we
75+ * always acquire the locks in the order of nesting (i.e. after
76+ * epoll_ctl(e1, EPOLL_CTL_ADD, e2), e1->mtx will always be acquired
77+ * before e2->mtx). Since we disallow cycles of epoll file
78+ * descriptors, this ensures that the mutexes are well-ordered. In
79+ * order to communicate this nesting to lockdep, when walking a tree
80+ * of epoll file descriptors, we use the current recursion depth as
81+ * the lockdep subkey.
7382 * It is possible to drop the "ep->mtx" and to use the global
7483 * mutex "epmutex" (together with "ep->lock") to have it working,
7584 * but having "ep->mtx" will make the interface more scalable.
@@ -464,13 +473,15 @@ static void ep_unregister_pollwait(struct eventpoll *ep, struct epitem *epi) · 388 unmodified lines
464473 * @ep: Pointer to the epoll private data structure.
465474 * @sproc: Pointer to the scan callback.
466475 * @priv: Private opaque data passed to the @sproc callback.
476+ * @depth: The current depth of recursive f_op->poll calls.
467477 *
468478 * Returns: The same integer error code returned by the @sproc callback.
469479 */
470480 static int ep_scan_ready_list(struct eventpoll *ep,
471481 int (*sproc)(struct eventpoll *,
472482 struct list_head *, void *),
473− void *priv)
483+ void *priv,
484+ int depth)
474485 {
475486 int error, pwake = 0;
476487 unsigned long flags;
@@ -481,7 +492,7 @@ static int ep_scan_ready_list(struct eventpoll *ep, · 4 unmodified lines
481492 * We need to lock this because we could be hit by
482493 * eventpoll_release_file() and epoll_ctl().
483494 */
484− mutex_lock(&ep->mtx);
495+ mutex_lock_nested(&ep->mtx, depth);
485496
486497 /*
487498 * Steal the ready list, and re-init the original one to the
@@ -670,7 +681,7 @@ static int ep_read_events_proc(struct eventpoll *ep, struct list_head *head, · 182 unmodified lines
670681
671682 static int ep_poll_readyevents_proc(void *priv, void *cookie, int call_nests)
672683 {
673− return ep_scan_ready_list(priv, ep_read_events_proc, NULL);
684+ return ep_scan_ready_list(priv, ep_read_events_proc, NULL, call_nests + 1);
674685 }
675686
676687 static unsigned int ep_eventpoll_poll(struct file *file, poll_table *wait)
@@ -737,7 +748,7 @@ void eventpoll_release_file(struct file *file) · 60 unmodified lines
737748
738749 ep = epi->ep;
739750 list_del_init(&epi->fllink);
740− mutex_lock(&ep->mtx);
751+ mutex_lock_nested(&ep->mtx, 0);
741752 ep_remove(ep, epi);
742753 mutex_unlock(&ep->mtx);
743754 }
@@ -1134,7 +1145,7 @@ static int ep_send_events(struct eventpoll *ep, · 390 unmodified lines
11341145 esed.maxevents = maxevents;
11351146 esed.events = events;
11361147
1137− return ep_scan_ready_list(ep, ep_send_events_proc, &esed);
1148+ return ep_scan_ready_list(ep, ep_send_events_proc, &esed, 0);
11381149 }
11391150
11401151 static inline struct timespec ep_set_mstimeout(long ms)
@@ -1267,7 +1278,7 @@ static int ep_loop_check_proc(void *priv, void *cookie, int call_nests) · 126 unmodified lines
12671278 struct rb_node *rbp;
12681279 struct epitem *epi;
12691280
1270− mutex_lock(&ep->mtx);
1281+ mutex_lock_nested(&ep->mtx, call_nests + 1);
12711282 for (rbp = rb_first(&ep->rbr); rbp; rbp = rb_next(rbp)) {
12721283 epi = rb_entry(rbp, struct epitem, rbn);
12731284 if (unlikely(is_file_epoll(epi->ffd.file))) {
@@ -1409,7 +1420,7 @@ SYSCALL_DEFINE4(epoll_ctl, int, epfd, int, op, int, fd, · 135 unmodified lines
14091420 }
14101421
14111422
1412− mutex_lock(&ep->mtx);
1423+ mutex_lock_nested(&ep->mtx, 0);
14131424
14141425 /*
14151426 * Try to lookup the file inside our RB tree, Since we grabbed "mtx"
fs/exec.c+0−4
@@ -841,10 +841,6 @@ static int exec_mmap(struct mm_struct *mm) · 840 unmodified lines
841841 tsk->mm = mm;
842842 tsk->active_mm = mm;
843843 activate_mm(active_mm, mm);
844− if (old_mm && tsk->signal->oom_score_adj == OOM_SCORE_ADJ_MIN) {
845− atomic_dec(&old_mm->oom_disable_count);
846− atomic_inc(&tsk->mm->oom_disable_count);
847− }
848844 task_unlock(tsk);
849845 arch_pick_mmap_layout(mm);
850846 if (old_mm) {
fs/ext2/ext2.h+4−4
@@ -135,10 +135,10 @@ extern long ext2_compat_ioctl(struct file *, unsigned int, unsigned long); · 134 unmodified lines
135135 struct dentry *ext2_get_parent(struct dentry *child);
136136
137137 /* super.c */
138−extern void ext2_error (struct super_block *, const char *, const char *, ...)
139− __attribute__ ((format (printf, 3, 4)));
140−extern void ext2_msg(struct super_block *, const char *, const char *, ...)
141− __attribute__ ((format (printf, 3, 4)));
138+extern __printf(3, 4)
139+void ext2_error(struct super_block *, const char *, const char *, ...);
140+extern __printf(3, 4)
141+void ext2_msg(struct super_block *, const char *, const char *, ...);
142142 extern void ext2_update_dynamic_rev (struct super_block *sb);
143143 extern void ext2_write_super (struct super_block *);
144144
fs/ext4/ext4.h+22−22
@@ -1878,40 +1878,40 @@ extern int ext4_group_extend(struct super_block *sb, · 1877 unmodified lines
18781878 extern void *ext4_kvmalloc(size_t size, gfp_t flags);
18791879 extern void *ext4_kvzalloc(size_t size, gfp_t flags);
18801880 extern void ext4_kvfree(void *ptr);
1881−extern void __ext4_error(struct super_block *, const char *, unsigned int,
1882− const char *, ...)
1883− __attribute__ ((format (printf, 4, 5)));
1881+extern __printf(4, 5)
1882+void __ext4_error(struct super_block *, const char *, unsigned int,
1883+ const char *, ...);
18841884 #define ext4_error(sb, message...) __ext4_error(sb, __func__, \
18851885 __LINE__, ## message)
1886−extern void ext4_error_inode(struct inode *, const char *, unsigned int,
1887− ext4_fsblk_t, const char *, ...)
1888− __attribute__ ((format (printf, 5, 6)));
1889−extern void ext4_error_file(struct file *, const char *, unsigned int,
1890− ext4_fsblk_t, const char *, ...)
1891− __attribute__ ((format (printf, 5, 6)));
1886+extern __printf(5, 6)
1887+void ext4_error_inode(struct inode *, const char *, unsigned int, ext4_fsblk_t,
1888+ const char *, ...);
1889+extern __printf(5, 6)
1890+void ext4_error_file(struct file *, const char *, unsigned int, ext4_fsblk_t,
1891+ const char *, ...);
18921892 extern void __ext4_std_error(struct super_block *, const char *,
18931893 unsigned int, int);
1894−extern void __ext4_abort(struct super_block *, const char *, unsigned int,
1895− const char *, ...)
1896− __attribute__ ((format (printf, 4, 5)));
1894+extern __printf(4, 5)
1895+void __ext4_abort(struct super_block *, const char *, unsigned int,
1896+ const char *, ...);
18971897 #define ext4_abort(sb, message...) __ext4_abort(sb, __func__, \
18981898 __LINE__, ## message)
1899−extern void __ext4_warning(struct super_block *, const char *, unsigned int,
1900− const char *, ...)
1901− __attribute__ ((format (printf, 4, 5)));
1899+extern __printf(4, 5)
1900+void __ext4_warning(struct super_block *, const char *, unsigned int,
1901+ const char *, ...);
19021902 #define ext4_warning(sb, message...) __ext4_warning(sb, __func__, \
19031903 __LINE__, ## message)
1904−extern void ext4_msg(struct super_block *, const char *, const char *, ...)
1905− __attribute__ ((format (printf, 3, 4)));
1904+extern __printf(3, 4)
1905+void ext4_msg(struct super_block *, const char *, const char *, ...);
19061906 extern void __dump_mmp_msg(struct super_block *, struct mmp_struct *mmp,
19071907 const char *, unsigned int, const char *);
19081908 #define dump_mmp_msg(sb, mmp, msg) __dump_mmp_msg(sb, mmp, __func__, \
19091909 __LINE__, msg)
1910−extern void __ext4_grp_locked_error(const char *, unsigned int, \
1911− struct super_block *, ext4_group_t, \
1912− unsigned long, ext4_fsblk_t, \
1913− const char *, ...)
1914− __attribute__ ((format (printf, 7, 8)));
1910+extern __printf(7, 8)
1911+void __ext4_grp_locked_error(const char *, unsigned int,
1912+ struct super_block *, ext4_group_t,
1913+ unsigned long, ext4_fsblk_t,
1914+ const char *, ...);
19151915 #define ext4_grp_locked_error(sb, grp, message...) \
19161916 __ext4_grp_locked_error(__func__, __LINE__, (sb), (grp), ## message)
19171917 extern void ext4_update_dynamic_rev(struct super_block *sb);
fs/ext4/inode.c+5−1
@@ -1811,8 +1811,12 @@ static int ext4_writepage(struct page *page, · 1810 unmodified lines
18111811 * We don't want to do block allocation, so redirty
18121812 * the page and return. We may reach here when we do
18131813 * a journal commit via journal_submit_inode_data_buffers.
1814− * We can also reach here via shrink_page_list
1814+ * We can also reach here via shrink_page_list but it
1815+ * should never be for direct reclaim so warn if that
1816+ * happens
18151817 */
1818+ WARN_ON_ONCE((current->flags & (PF_MEMALLOC|PF_KSWAPD)) ==
1819+ PF_MEMALLOC);
18161820 goto redirty_page;
18171821 }
18181822 if (commit_write)
fs/fat/dir.c+2−2
@@ -156,8 +156,8 @@ static int uni16_to_x8(struct super_block *sb, unsigned char *ascii, · 155 unmodified lines
156156 } else {
157157 if (uni_xlate == 1) {
158158 *op++ = ':';
159− op = pack_hex_byte(op, ec >> 8);
160− op = pack_hex_byte(op, ec);
159+ op = hex_byte_pack(op, ec >> 8);
160+ op = hex_byte_pack(op, ec);
161161 len -= 5;
162162 } else {
163163 *op++ = '?';
fs/fat/fat.h+4−5
@@ -326,15 +326,14 @@ extern int fat_fill_super(struct super_block *sb, void *data, int silent, · 325 unmodified lines
326326 extern int fat_flush_inodes(struct super_block *sb, struct inode *i1,
327327 struct inode *i2);
328328 /* fat/misc.c */
329−extern void
330−__fat_fs_error(struct super_block *sb, int report, const char *fmt, ...)
331− __attribute__ ((format (printf, 3, 4))) __cold;
329+extern __printf(3, 4) __cold
330+void __fat_fs_error(struct super_block *sb, int report, const char *fmt, ...);
332331 #define fat_fs_error(sb, fmt, args...) \
333332 __fat_fs_error(sb, 1, fmt , ## args)
334333 #define fat_fs_error_ratelimit(sb, fmt, args...) \
335334 __fat_fs_error(sb, __ratelimit(&MSDOS_SB(sb)->ratelimit), fmt , ## args)
336−void fat_msg(struct super_block *sb, const char *level, const char *fmt, ...)
337− __attribute__ ((format (printf, 3, 4))) __cold;
335+__printf(3, 4) __cold
336+void fat_msg(struct super_block *sb, const char *level, const char *fmt, ...);
338337 extern int fat_clusters_flush(struct super_block *sb);
339338 extern int fat_chain_add(struct inode *inode, int new_dclus, int nr_cluster);
340339 extern void fat_time_fat2unix(struct msdos_sb_info *sbi, struct timespec *ts,
fs/gfs2/glock.h+1−1
@@ -201,7 +201,7 @@ int gfs2_glock_nq_m(unsigned int num_gh, struct gfs2_holder *ghs); · 200 unmodified lines
201201 void gfs2_glock_dq_m(unsigned int num_gh, struct gfs2_holder *ghs);
202202 void gfs2_glock_dq_uninit_m(unsigned int num_gh, struct gfs2_holder *ghs);
203203
204−__attribute__ ((format(printf, 2, 3)))
204+__printf(2, 3)
205205 void gfs2_print_dbg(struct seq_file *seq, const char *fmt, ...);
206206
207207 /**
fs/hpfs/hpfs_fn.h+2−2
@@ -311,8 +311,8 @@ static inline struct hpfs_sb_info *hpfs_sb(struct super_block *sb) · 310 unmodified lines
311311
312312 /* super.c */
313313
314−void hpfs_error(struct super_block *, const char *, ...)
315− __attribute__((format (printf, 2, 3)));
314+__printf(2, 3)
315+void hpfs_error(struct super_block *, const char *, ...);
316316 int hpfs_stop_cycles(struct super_block *, int, int *, int *, char *);
317317 unsigned hpfs_count_one_bitmap(struct super_block *, secno);
318318
fs/logfs/logfs.h+0−1
@@ -618,7 +618,6 @@ static inline int logfs_buf_recover(struct logfs_area *area, u64 ofs, · 617 unmodified lines
618618 struct page *emergency_read_begin(struct address_space *mapping, pgoff_t index);
619619 void emergency_read_end(struct page *page);
620620 void logfs_crash_dump(struct super_block *sb);
621−void *memchr_inv(const void *s, int c, size_t n);
622621 int logfs_statfs(struct dentry *dentry, struct kstatfs *stats);
623622 int logfs_check_ds(struct logfs_disk_super *ds);
624623 int logfs_write_sb(struct super_block *sb);
fs/logfs/super.c+0−22
@@ -90,28 +90,6 @@ void logfs_crash_dump(struct super_block *sb) · 89 unmodified lines
9090 dump_segfile(sb);
9191 }
9292
93−/*
94− * TODO: move to lib/string.c
95− */
96−/**
97− * memchr_inv - Find a character in an area of memory.
98− * @s: The memory area
99− * @c: The byte to search for
100− * @n: The size of the area.
101− *
102− * returns the address of the first character other than @c, or %NULL
103− * if the whole buffer contains just @c.
104− */
105−void *memchr_inv(const void *s, int c, size_t n)
106−{
107− const unsigned char *p = s;
108− while (n-- != 0)
109− if ((unsigned char)c != *p++)
110− return (void *)(p - 1);
111−
112− return NULL;
113−}
114−
11593 /*
11694 * FIXME: There should be a reserve for root, similar to ext2.
11795 */
fs/nilfs2/nilfs.h+4−4
@@ -276,10 +276,10 @@ int nilfs_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo, · 275 unmodified lines
276276 /* super.c */
277277 extern struct inode *nilfs_alloc_inode(struct super_block *);
278278 extern void nilfs_destroy_inode(struct inode *);
279−extern void nilfs_error(struct super_block *, const char *, const char *, ...)
280− __attribute__ ((format (printf, 3, 4)));
281−extern void nilfs_warning(struct super_block *, const char *, const char *, ...)
282− __attribute__ ((format (printf, 3, 4)));
279+extern __printf(3, 4)
280+void nilfs_error(struct super_block *, const char *, const char *, ...);
281+extern __printf(3, 4)
282+void nilfs_warning(struct super_block *, const char *, const char *, ...);
283283 extern struct nilfs_super_block *
284284 nilfs_read_super_block(struct super_block *, u64, int, struct buffer_head **);
285285 extern int nilfs_store_magic_and_option(struct super_block *,
fs/ntfs/debug.h+9−6
@@ -30,8 +30,9 @@ · 29 unmodified lines
3030
3131 extern int debug_msgs;
3232
33−extern void __ntfs_debug(const char *file, int line, const char *function,
34− const char *format, ...) __attribute__ ((format (printf, 4, 5)));
33+extern __printf(4, 5)
34+void __ntfs_debug(const char *file, int line, const char *function,
35+ const char *format, ...);
3536 /**
3637 * ntfs_debug - write a debug level message to syslog
3738 * @f: a printf format string containing the message
@@ -52,12 +53,14 @@ extern void ntfs_debug_dump_runlist(const runlist_element *rl); · 14 unmodified lines
5253
5354 #endif /* !DEBUG */
5455
55−extern void __ntfs_warning(const char *function, const struct super_block *sb,
56− const char *fmt, ...) __attribute__ ((format (printf, 3, 4)));
56+extern __printf(3, 4)
57+void __ntfs_warning(const char *function, const struct super_block *sb,
58+ const char *fmt, ...);
5759 #define ntfs_warning(sb, f, a...) __ntfs_warning(__func__, sb, f, ##a)
5860
59−extern void __ntfs_error(const char *function, const struct super_block *sb,
60− const char *fmt, ...) __attribute__ ((format (printf, 3, 4)));
61+extern __printf(3, 4)
62+void __ntfs_error(const char *function, const struct super_block *sb,
63+ const char *fmt, ...);
6164 #define ntfs_error(sb, f, a...) __ntfs_error(__func__, sb, f, ##a)
6265
6366 #endif /* _LINUX_NTFS_DEBUG_H */
fs/ocfs2/super.h+6−8
@@ -31,17 +31,15 @@ extern struct workqueue_struct *ocfs2_wq; · 30 unmodified lines
3131 int ocfs2_publish_get_mount_state(struct ocfs2_super *osb,
3232 int node_num);
3333
34−void __ocfs2_error(struct super_block *sb,
35− const char *function,
36− const char *fmt, ...)
37− __attribute__ ((format (printf, 3, 4)));
34+__printf(3, 4)
35+void __ocfs2_error(struct super_block *sb, const char *function,
36+ const char *fmt, ...);
3837
3938 #define ocfs2_error(sb, fmt, args...) __ocfs2_error(sb, __PRETTY_FUNCTION__, fmt, ##args)
4039
41−void __ocfs2_abort(struct super_block *sb,
42− const char *function,
43− const char *fmt, ...)
44− __attribute__ ((format (printf, 3, 4)));
40+__printf(3, 4)
41+void __ocfs2_abort(struct super_block *sb, const char *function,
42+ const char *fmt, ...);
4543
4644 #define ocfs2_abort(sb, fmt, args...) __ocfs2_abort(sb, __PRETTY_FUNCTION__, fmt, ##args)
4745
fs/partitions/ldm.c+9−7
@@ -49,18 +49,20 @@ · 48 unmodified lines
4949 #define ldm_error(f, a...) _ldm_printk (KERN_ERR, __func__, f, ##a)
5050 #define ldm_info(f, a...) _ldm_printk (KERN_INFO, __func__, f, ##a)
5151
52−__attribute__ ((format (printf, 3, 4)))
53−static void _ldm_printk (const char *level, const char *function,
54− const char *fmt, ...)
52+static __printf(3, 4)
53+void _ldm_printk(const char *level, const char *function, const char *fmt, ...)
5554 {
56− static char buf[128];
55+ struct va_format vaf;
5756 va_list args;
5857
5958 va_start (args, fmt);
60− vsnprintf (buf, sizeof (buf), fmt, args);
61− va_end (args);
6259
63− printk ("%s%s(): %s\n", level, function, buf);
60+ vaf.fmt = fmt;
61+ vaf.va = &args;
62+
63+ printk("%s%s(): %pV\n", level, function, &vaf);
64+
65+ va_end(args);
6466 }
6567
6668 /**
fs/pipe.c+1−0
@@ -1254,6 +1254,7 @@ out: · 1253 unmodified lines
12541254
12551255 static const struct super_operations pipefs_ops = {
12561256 .destroy_inode = free_inode_nonrcu,
1257+ .statfs = simple_statfs,
12571258 };
12581259
12591260 /*
fs/proc/base.c+0−13
@@ -1107,13 +1107,6 @@ static ssize_t oom_adjust_write(struct file *file, const char __user *buf, · 1106 unmodified lines
11071107 goto err_sighand;
11081108 }
11091109
1110− if (oom_adjust != task->signal->oom_adj) {
1111− if (oom_adjust == OOM_DISABLE)
1112− atomic_inc(&task->mm->oom_disable_count);
1113− if (task->signal->oom_adj == OOM_DISABLE)
1114− atomic_dec(&task->mm->oom_disable_count);
1115− }
1116−
11171110 /*
11181111 * Warn that /proc/pid/oom_adj is deprecated, see
11191112 * Documentation/feature-removal-schedule.txt.
@@ -1215,12 +1208,6 @@ static ssize_t oom_score_adj_write(struct file *file, const char __user *buf, · 95 unmodified lines
12151208 goto err_sighand;
12161209 }
12171210
1218− if (oom_score_adj != task->signal->oom_score_adj) {
1219− if (oom_score_adj == OOM_SCORE_ADJ_MIN)
1220− atomic_inc(&task->mm->oom_disable_count);
1221− if (task->signal->oom_score_adj == OOM_SCORE_ADJ_MIN)
1222− atomic_dec(&task->mm->oom_disable_count);
1223− }
12241211 task->signal->oom_score_adj = oom_score_adj;
12251212 if (has_capability_noaudit(current, CAP_SYS_RESOURCE))
12261213 task->signal->oom_score_adj_min = oom_score_adj;
fs/proc/task_mmu.c+5−0
@@ -44,6 +44,7 @@ void task_mem(struct seq_file *m, struct mm_struct *mm) · 43 unmodified lines
4444 "VmPeak:\t%8lu kB\n"
4545 "VmSize:\t%8lu kB\n"
4646 "VmLck:\t%8lu kB\n"
47+ "VmPin:\t%8lu kB\n"
4748 "VmHWM:\t%8lu kB\n"
4849 "VmRSS:\t%8lu kB\n"
4950 "VmData:\t%8lu kB\n"
@@ -55,6 +56,7 @@ void task_mem(struct seq_file *m, struct mm_struct *mm) · 5 unmodified lines
5556 hiwater_vm << (PAGE_SHIFT-10),
5657 (total_vm - mm->reserved_vm) << (PAGE_SHIFT-10),
5758 mm->locked_vm << (PAGE_SHIFT-10),
59+ mm->pinned_vm << (PAGE_SHIFT-10),
5860 hiwater_rss << (PAGE_SHIFT-10),
5961 total_rss << (PAGE_SHIFT-10),
6062 data << (PAGE_SHIFT-10),
@@ -1039,6 +1041,9 @@ static int show_numa_map(struct seq_file *m, void *v) · 978 unmodified lines
10391041 seq_printf(m, " stack");
10401042 }
10411043
1044+ if (is_vm_hugetlb_page(vma))
1045+ seq_printf(m, " huge");
1046+
10421047 walk_page_range(vma->vm_start, vma->vm_end, &walk);
10431048
10441049 if (!md->pages)
fs/read_write.c+5−3
@@ -633,7 +633,8 @@ ssize_t do_loop_readv_writev(struct file *filp, struct iovec *iov, · 632 unmodified lines
633633 ssize_t rw_copy_check_uvector(int type, const struct iovec __user * uvector,
634634 unsigned long nr_segs, unsigned long fast_segs,
635635 struct iovec *fast_pointer,
636− struct iovec **ret_pointer)
636+ struct iovec **ret_pointer,
637+ int check_access)
637638 {
638639 unsigned long seg;
639640 ssize_t ret;
@@ -689,7 +690,8 @@ ssize_t rw_copy_check_uvector(int type, const struct iovec __user * uvector, · 49 unmodified lines
689690 ret = -EINVAL;
690691 goto out;
691692 }
692− if (unlikely(!access_ok(vrfy_dir(type), buf, len))) {
693+ if (check_access
694+ && unlikely(!access_ok(vrfy_dir(type), buf, len))) {
693695 ret = -EFAULT;
694696 goto out;
695697 }
@@ -721,7 +723,7 @@ static ssize_t do_readv_writev(int type, struct file *file, · 25 unmodified lines
721723 }
722724
723725 ret = rw_copy_check_uvector(type, uvector, nr_segs,
724− ARRAY_SIZE(iovstack), iovstack, &iov);
726+ ARRAY_SIZE(iovstack), iovstack, &iov, 1);
725727 if (ret <= 0)
726728 goto out;
727729
fs/super.c+1−1
@@ -61,7 +61,7 @@ static int prune_super(struct shrinker *shrink, struct shrink_control *sc) · 60 unmodified lines
6161 return -1;
6262
6363 if (!grab_super_passive(sb))
64− return -1;
64+ return !sc->nr_to_scan ? 0 : -1;
6565
6666 if (sb->s_op && sb->s_op->nr_cached_objects)
6767 fs_objects = sb->s_op->nr_cached_objects(sb);
fs/udf/udfdecl.h+2−2
@@ -112,8 +112,8 @@ struct extent_position { · 111 unmodified lines
112112
113113 /* super.c */
114114
115−__attribute__((format(printf, 3, 4)))
116−extern void udf_warning(struct super_block *, const char *, const char *, ...);
115+extern __printf(3, 4) void udf_warning(struct super_block *, const char *,
116+ const char *, ...);
117117 static inline void udf_updated_lvid(struct super_block *sb)
118118 {
119119 struct buffer_head *bh = UDF_SB(sb)->s_lvid_bh;
fs/ufs/ufs.h+6−3
@@ -117,9 +117,12 @@ extern int ufs_getfrag_block (struct inode *inode, sector_t fragment, struct buf · 116 unmodified lines
117117 extern const struct file_operations ufs_dir_operations;
118118
119119 /* super.c */
120−extern void ufs_warning (struct super_block *, const char *, const char *, ...) __attribute__ ((format (printf, 3, 4)));
121−extern void ufs_error (struct super_block *, const char *, const char *, ...) __attribute__ ((format (printf, 3, 4)));
122−extern void ufs_panic (struct super_block *, const char *, const char *, ...) __attribute__ ((format (printf, 3, 4)));
120+extern __printf(3, 4)
121+void ufs_warning(struct super_block *, const char *, const char *, ...);
122+extern __printf(3, 4)
123+void ufs_error(struct super_block *, const char *, const char *, ...);
124+extern __printf(3, 4)
125+void ufs_panic(struct super_block *, const char *, const char *, ...);
123126
124127 /* symlink.c */
125128 extern const struct inode_operations ufs_fast_symlink_inode_operations;
fs/xfs/xfs_aops.c+4−4
@@ -902,11 +902,11 @@ xfs_vm_writepage( · 901 unmodified lines
902902 * random callers for direct reclaim or memcg reclaim. We explicitly
903903 * allow reclaim from kswapd as the stack usage there is relatively low.
904904 *
905− * This should really be done by the core VM, but until that happens
906− * filesystems like XFS, btrfs and ext4 have to take care of this
907− * by themselves.
905+ * This should never happen except in the case of a VM regression so
906+ * warn about it.
908907 */
909− if ((current->flags & (PF_MEMALLOC|PF_KSWAPD)) == PF_MEMALLOC)
908+ if (WARN_ON_ONCE((current->flags & (PF_MEMALLOC|PF_KSWAPD)) ==
909+ PF_MEMALLOC))
910910 goto redirty;
911911
912912 /*
fs/xfs/xfs_message.h+20−22
@@ -3,31 +3,29 @@ · 2 unmodified lines
33
44 struct xfs_mount;
55
6−extern void xfs_emerg(const struct xfs_mount *mp, const char *fmt, ...)
7− __attribute__ ((format (printf, 2, 3)));
8−extern void xfs_alert(const struct xfs_mount *mp, const char *fmt, ...)
9− __attribute__ ((format (printf, 2, 3)));
10−extern void xfs_alert_tag(const struct xfs_mount *mp, int tag,
11− const char *fmt, ...)
12− __attribute__ ((format (printf, 3, 4)));
13−extern void xfs_crit(const struct xfs_mount *mp, const char *fmt, ...)
14− __attribute__ ((format (printf, 2, 3)));
15−extern void xfs_err(const struct xfs_mount *mp, const char *fmt, ...)
16− __attribute__ ((format (printf, 2, 3)));
17−extern void xfs_warn(const struct xfs_mount *mp, const char *fmt, ...)
18− __attribute__ ((format (printf, 2, 3)));
19−extern void xfs_notice(const struct xfs_mount *mp, const char *fmt, ...)
20− __attribute__ ((format (printf, 2, 3)));
21−extern void xfs_info(const struct xfs_mount *mp, const char *fmt, ...)
22− __attribute__ ((format (printf, 2, 3)));
6+extern __printf(2, 3)
7+void xfs_emerg(const struct xfs_mount *mp, const char *fmt, ...);
8+extern __printf(2, 3)
9+void xfs_alert(const struct xfs_mount *mp, const char *fmt, ...);
10+extern __printf(3, 4)
11+void xfs_alert_tag(const struct xfs_mount *mp, int tag, const char *fmt, ...);
12+extern __printf(2, 3)
13+void xfs_crit(const struct xfs_mount *mp, const char *fmt, ...);
14+extern __printf(2, 3)
15+void xfs_err(const struct xfs_mount *mp, const char *fmt, ...);
16+extern __printf(2, 3)
17+void xfs_warn(const struct xfs_mount *mp, const char *fmt, ...);
18+extern __printf(2, 3)
19+void xfs_notice(const struct xfs_mount *mp, const char *fmt, ...);
20+extern __printf(2, 3)
21+void xfs_info(const struct xfs_mount *mp, const char *fmt, ...);
2322
2423 #ifdef DEBUG
25−extern void xfs_debug(const struct xfs_mount *mp, const char *fmt, ...)
26− __attribute__ ((format (printf, 2, 3)));
24+extern __printf(2, 3)
25+void xfs_debug(const struct xfs_mount *mp, const char *fmt, ...);
2726 #else
28−static inline void
29−__attribute__ ((format (printf, 2, 3)))
30−xfs_debug(const struct xfs_mount *mp, const char *fmt, ...)
27+static inline __printf(2, 3)
28+void xfs_debug(const struct xfs_mount *mp, const char *fmt, ...)
3129 {
3230 }
3331 #endif
include/asm-generic/bug.h+6−5
@@ -61,11 +61,12 @@ struct bug_entry { · 60 unmodified lines
6161 */
6262 #ifndef __WARN_TAINT
6363 #ifndef __ASSEMBLY__
64−extern void warn_slowpath_fmt(const char *file, const int line,
65− const char *fmt, ...) __attribute__((format(printf, 3, 4)));
66−extern void warn_slowpath_fmt_taint(const char *file, const int line,
67− unsigned taint, const char *fmt, ...)
68− __attribute__((format(printf, 4, 5)));
64+extern __printf(3, 4)
65+void warn_slowpath_fmt(const char *file, const int line,
66+ const char *fmt, ...);
67+extern __printf(4, 5)
68+void warn_slowpath_fmt_taint(const char *file, const int line, unsigned taint,
69+ const char *fmt, ...);
6970 extern void warn_slowpath_null(const char *file, const int line);
7071 #define WANT_WARN_ON_SLOWPATH
7172 #endif
include/asm-generic/dma-mapping-common.h+12−2
@@ -123,7 +123,12 @@ static inline void dma_sync_single_range_for_cpu(struct device *dev, · 122 unmodified lines
123123 size_t size,
124124 enum dma_data_direction dir)
125125 {
126− dma_sync_single_for_cpu(dev, addr + offset, size, dir);
126+ const struct dma_map_ops *ops = get_dma_ops(dev);
127+
128+ BUG_ON(!valid_dma_direction(dir));
129+ if (ops->sync_single_for_cpu)
130+ ops->sync_single_for_cpu(dev, addr + offset, size, dir);
131+ debug_dma_sync_single_range_for_cpu(dev, addr, offset, size, dir);
127132 }
128133
129134 static inline void dma_sync_single_range_for_device(struct device *dev,
@@ -132,7 +137,12 @@ static inline void dma_sync_single_range_for_device(struct device *dev, · 2 unmodified lines
132137 size_t size,
133138 enum dma_data_direction dir)
134139 {
135− dma_sync_single_for_device(dev, addr + offset, size, dir);
140+ const struct dma_map_ops *ops = get_dma_ops(dev);
141+
142+ BUG_ON(!valid_dma_direction(dir));
143+ if (ops->sync_single_for_device)
144+ ops->sync_single_for_device(dev, addr + offset, size, dir);
145+ debug_dma_sync_single_range_for_device(dev, addr, offset, size, dir);
136146 }
137147
138148 static inline void
include/asm-generic/page.h+2−2
@@ -79,8 +79,8 @@ extern unsigned long memory_end; · 78 unmodified lines
7979 #define virt_to_pfn(kaddr) (__pa(kaddr) >> PAGE_SHIFT)
8080 #define pfn_to_virt(pfn) __va((pfn) << PAGE_SHIFT)
8181
82−#define virt_to_page(addr) (mem_map + (((unsigned long)(addr)-PAGE_OFFSET) >> PAGE_SHIFT))
83−#define page_to_virt(page) ((((page) - mem_map) << PAGE_SHIFT) + PAGE_OFFSET)
82+#define virt_to_page(addr) pfn_to_page(virt_to_pfn(addr))
83+#define page_to_virt(page) pfn_to_virt(page_to_pfn(page))
8484
8585 #ifndef page_to_phys
8686 #define page_to_phys(page) ((dma_addr_t)page_to_pfn(page) << PAGE_SHIFT)
include/drm/drmP.h+5−5
@@ -122,12 +122,12 @@ struct drm_device; · 121 unmodified lines
122122 * using the DRM_DEBUG_KMS and DRM_DEBUG.
123123 */
124124
125−extern __attribute__((format (printf, 4, 5)))
125+extern __printf(4, 5)
126126 void drm_ut_debug_printk(unsigned int request_level,
127− const char *prefix,
128− const char *function_name,
129− const char *format, ...);
130−extern __attribute__((format (printf, 2, 3)))
127+ const char *prefix,
128+ const char *function_name,
129+ const char *format, ...);
130+extern __printf(2, 3)
131131 int drm_err(const char *func, const char *format, ...);
132132
133133 /***********************************************************************/
include/linux/audit.h+5−6
@@ -584,14 +584,13 @@ extern int audit_signals; · 583 unmodified lines
584584 #ifdef CONFIG_AUDIT
585585 /* These are defined in audit.c */
586586 /* Public API */
587−extern void audit_log(struct audit_context *ctx, gfp_t gfp_mask,
588− int type, const char *fmt, ...)
589− __attribute__((format(printf,4,5)));
587+extern __printf(4, 5)
588+void audit_log(struct audit_context *ctx, gfp_t gfp_mask, int type,
589+ const char *fmt, ...);
590590
591591 extern struct audit_buffer *audit_log_start(struct audit_context *ctx, gfp_t gfp_mask, int type);
592−extern void audit_log_format(struct audit_buffer *ab,
593− const char *fmt, ...)
594− __attribute__((format(printf,2,3)));
592+extern __printf(2, 3)
593+void audit_log_format(struct audit_buffer *ab, const char *fmt, ...);
595594 extern void audit_log_end(struct audit_buffer *ab);
596595 extern int audit_string_contains_control(const char *string,
597596 size_t len);
include/linux/blktrace_api.h+1−1
@@ -170,7 +170,7 @@ extern void blk_trace_shutdown(struct request_queue *); · 169 unmodified lines
170170 extern int do_blk_trace_setup(struct request_queue *q, char *name,
171171 dev_t dev, struct block_device *bdev,
172172 struct blk_user_trace_setup *buts);
173−extern __attribute__((format(printf, 2, 3)))
173+extern __printf(2, 3)
174174 void __trace_note_message(struct blk_trace *, const char *fmt, ...);
175175
176176 /**
include/linux/compaction.h+0−8
@@ -24,8 +24,6 @@ extern unsigned long try_to_compact_pages(struct zonelist *zonelist, · 23 unmodified lines
2424 int order, gfp_t gfp_mask, nodemask_t *mask,
2525 bool sync);
2626 extern unsigned long compaction_suitable(struct zone *zone, int order);
27−extern unsigned long compact_zone_order(struct zone *zone, int order,
28− gfp_t gfp_mask, bool sync);
2927
3028 /* Do not skip compaction more than 64 times */
3129 #define COMPACT_MAX_DEFER_SHIFT 6
@@ -69,12 +67,6 @@ static inline unsigned long compaction_suitable(struct zone *zone, int order) · 37 unmodified lines
6967 return COMPACT_SKIPPED;
7068 }
7169
72−static inline unsigned long compact_zone_order(struct zone *zone, int order,
73− gfp_t gfp_mask, bool sync)
74−{
75− return COMPACT_CONTINUE;
76−}
77−
7870 static inline void defer_compaction(struct zone *zone)
7971 {
8072 }
include/linux/compat.h+2−1
@@ -547,7 +547,8 @@ extern ssize_t compat_rw_copy_check_uvector(int type, · 546 unmodified lines
547547 const struct compat_iovec __user *uvector,
548548 unsigned long nr_segs,
549549 unsigned long fast_segs, struct iovec *fast_pointer,
550− struct iovec **ret_pointer);
550+ struct iovec **ret_pointer,
551+ int check_access);
551552
552553 extern void __user *compat_alloc_user_space(unsigned long len);
553554
include/linux/device.h+51−59
@@ -622,8 +622,8 @@ static inline const char *dev_name(const struct device *dev) · 621 unmodified lines
622622 return kobject_name(&dev->kobj);
623623 }
624624
625−extern int dev_set_name(struct device *dev, const char *name, ...)
626− __attribute__((format(printf, 2, 3)));
625+extern __printf(2, 3)
626+int dev_set_name(struct device *dev, const char *name, ...);
627627
628628 #ifdef CONFIG_NUMA
629629 static inline int dev_to_node(struct device *dev)
@@ -753,10 +753,10 @@ extern struct device *device_create_vargs(struct class *cls, · 123 unmodified lines
753753 void *drvdata,
754754 const char *fmt,
755755 va_list vargs);
756−extern struct device *device_create(struct class *cls, struct device *parent,
757− dev_t devt, void *drvdata,
758− const char *fmt, ...)
759− __attribute__((format(printf, 5, 6)));
756+extern __printf(5, 6)
757+struct device *device_create(struct class *cls, struct device *parent,
758+ dev_t devt, void *drvdata,
759+ const char *fmt, ...);
760760 extern void device_destroy(struct class *cls, dev_t devt);
761761
762762 /*
@@ -800,64 +800,56 @@ extern const char *dev_driver_string(const struct device *dev); · 37 unmodified lines
800800
801801 extern int __dev_printk(const char *level, const struct device *dev,
802802 struct va_format *vaf);
803−extern int dev_printk(const char *level, const struct device *dev,
804− const char *fmt, ...)
805− __attribute__ ((format (printf, 3, 4)));
806−extern int dev_emerg(const struct device *dev, const char *fmt, ...)
807− __attribute__ ((format (printf, 2, 3)));
808−extern int dev_alert(const struct device *dev, const char *fmt, ...)
809− __attribute__ ((format (printf, 2, 3)));
810−extern int dev_crit(const struct device *dev, const char *fmt, ...)
811− __attribute__ ((format (printf, 2, 3)));
812−extern int dev_err(const struct device *dev, const char *fmt, ...)
813− __attribute__ ((format (printf, 2, 3)));
814−extern int dev_warn(const struct device *dev, const char *fmt, ...)
815− __attribute__ ((format (printf, 2, 3)));
816−extern int dev_notice(const struct device *dev, const char *fmt, ...)
817− __attribute__ ((format (printf, 2, 3)));
818−extern int _dev_info(const struct device *dev, const char *fmt, ...)
819− __attribute__ ((format (printf, 2, 3)));
803+extern __printf(3, 4)
804+int dev_printk(const char *level, const struct device *dev,
805+ const char *fmt, ...)
806+ ;
807+extern __printf(2, 3)
808+int dev_emerg(const struct device *dev, const char *fmt, ...);
809+extern __printf(2, 3)
810+int dev_alert(const struct device *dev, const char *fmt, ...);
811+extern __printf(2, 3)
812+int dev_crit(const struct device *dev, const char *fmt, ...);
813+extern __printf(2, 3)
814+int dev_err(const struct device *dev, const char *fmt, ...);
815+extern __printf(2, 3)
816+int dev_warn(const struct device *dev, const char *fmt, ...);
817+extern __printf(2, 3)
818+int dev_notice(const struct device *dev, const char *fmt, ...);
819+extern __printf(2, 3)
820+int _dev_info(const struct device *dev, const char *fmt, ...);
820821
821822 #else
822823
823824 static inline int __dev_printk(const char *level, const struct device *dev,
824825 struct va_format *vaf)
825− { return 0; }
826−static inline int dev_printk(const char *level, const struct device *dev,
827− const char *fmt, ...)
828− __attribute__ ((format (printf, 3, 4)));
829−static inline int dev_printk(const char *level, const struct device *dev,
830− const char *fmt, ...)
831− { return 0; }
832−
833−static inline int dev_emerg(const struct device *dev, const char *fmt, ...)
834− __attribute__ ((format (printf, 2, 3)));
835−static inline int dev_emerg(const struct device *dev, const char *fmt, ...)
836− { return 0; }
837−static inline int dev_crit(const struct device *dev, const char *fmt, ...)
838− __attribute__ ((format (printf, 2, 3)));
839−static inline int dev_crit(const struct device *dev, const char *fmt, ...)
840− { return 0; }
841−static inline int dev_alert(const struct device *dev, const char *fmt, ...)
842− __attribute__ ((format (printf, 2, 3)));
843−static inline int dev_alert(const struct device *dev, const char *fmt, ...)
844− { return 0; }
845−static inline int dev_err(const struct device *dev, const char *fmt, ...)
846− __attribute__ ((format (printf, 2, 3)));
847−static inline int dev_err(const struct device *dev, const char *fmt, ...)
848− { return 0; }
849−static inline int dev_warn(const struct device *dev, const char *fmt, ...)
850− __attribute__ ((format (printf, 2, 3)));
851−static inline int dev_warn(const struct device *dev, const char *fmt, ...)
852− { return 0; }
853−static inline int dev_notice(const struct device *dev, const char *fmt, ...)
854− __attribute__ ((format (printf, 2, 3)));
855−static inline int dev_notice(const struct device *dev, const char *fmt, ...)
856− { return 0; }
857−static inline int _dev_info(const struct device *dev, const char *fmt, ...)
858− __attribute__ ((format (printf, 2, 3)));
859−static inline int _dev_info(const struct device *dev, const char *fmt, ...)
860− { return 0; }
826+{ return 0; }
827+static inline __printf(3, 4)
828+int dev_printk(const char *level, const struct device *dev,
829+ const char *fmt, ...)
830+{ return 0; }
831+
832+static inline __printf(2, 3)
833+int dev_emerg(const struct device *dev, const char *fmt, ...)
834+{ return 0; }
835+static inline __printf(2, 3)
836+int dev_crit(const struct device *dev, const char *fmt, ...)
837+{ return 0; }
838+static inline __printf(2, 3)
839+int dev_alert(const struct device *dev, const char *fmt, ...)
840+{ return 0; }
841+static inline __printf(2, 3)
842+int dev_err(const struct device *dev, const char *fmt, ...)
843+{ return 0; }
844+static inline __printf(2, 3)
845+int dev_warn(const struct device *dev, const char *fmt, ...)
846+{ return 0; }
847+static inline __printf(2, 3)
848+int dev_notice(const struct device *dev, const char *fmt, ...)
849+{ return 0; }
850+static inline __printf(2, 3)
851+int _dev_info(const struct device *dev, const char *fmt, ...)
852+{ return 0; }
861853
862854 #endif
863855
include/linux/dmar.h+2−0
@@ -26,6 +26,8 @@ · 25 unmodified lines
2626 #include <linux/msi.h>
2727 #include <linux/irqreturn.h>
2828
29+struct acpi_dmar_header;
30+
2931 /* DMAR Flags */
3032 #define DMAR_INTR_REMAP 0x1
3133 #define DMAR_X2APIC_OPT_OUT 0x2
include/linux/dynamic_debug.h+9−10
@@ -37,22 +37,21 @@ int ddebug_add_module(struct _ddebug *tab, unsigned int n, · 36 unmodified lines
3737
3838 #if defined(CONFIG_DYNAMIC_DEBUG)
3939 extern int ddebug_remove_module(const char *mod_name);
40−extern int __dynamic_pr_debug(struct _ddebug *descriptor, const char *fmt, ...)
41− __attribute__ ((format (printf, 2, 3)));
40+extern __printf(2, 3)
41+int __dynamic_pr_debug(struct _ddebug *descriptor, const char *fmt, ...);
4242
4343 struct device;
4444
45−extern int __dynamic_dev_dbg(struct _ddebug *descriptor,
46− const struct device *dev,
47− const char *fmt, ...)
48− __attribute__ ((format (printf, 3, 4)));
45+extern __printf(3, 4)
46+int __dynamic_dev_dbg(struct _ddebug *descriptor, const struct device *dev,
47+ const char *fmt, ...);
4948
5049 struct net_device;
5150
52−extern int __dynamic_netdev_dbg(struct _ddebug *descriptor,
53− const struct net_device *dev,
54− const char *fmt, ...)
55− __attribute__ ((format (printf, 3, 4)));
51+extern __printf(3, 4)
52+int __dynamic_netdev_dbg(struct _ddebug *descriptor,
53+ const struct net_device *dev,
54+ const char *fmt, ...);
5655
5756 #define DEFINE_DYNAMIC_DEBUG_METADATA(name, fmt) \
5857 static struct _ddebug __used __aligned(8) \
include/linux/ext3_fs.h+8−8
@@ -937,15 +937,15 @@ extern int ext3_group_extend(struct super_block *sb, · 936 unmodified lines
937937 ext3_fsblk_t n_blocks_count);
938938
939939 /* super.c */
940−extern void ext3_error (struct super_block *, const char *, const char *, ...)
941− __attribute__ ((format (printf, 3, 4)));
940+extern __printf(3, 4)
941+void ext3_error(struct super_block *, const char *, const char *, ...);
942942 extern void __ext3_std_error (struct super_block *, const char *, int);
943−extern void ext3_abort (struct super_block *, const char *, const char *, ...)
944− __attribute__ ((format (printf, 3, 4)));
945−extern void ext3_warning (struct super_block *, const char *, const char *, ...)
946− __attribute__ ((format (printf, 3, 4)));
947−extern void ext3_msg(struct super_block *, const char *, const char *, ...)
948− __attribute__ ((format (printf, 3, 4)));
943+extern __printf(3, 4)
944+void ext3_abort(struct super_block *, const char *, const char *, ...);
945+extern __printf(3, 4)
946+void ext3_warning(struct super_block *, const char *, const char *, ...);
947+extern __printf(3, 4)
948+void ext3_msg(struct super_block *, const char *, const char *, ...);
949949 extern void ext3_update_dynamic_rev (struct super_block *sb);
950950
951951 #define ext3_std_error(sb, errno) \
include/linux/fs.h+6−5
@@ -1633,9 +1633,10 @@ struct inode_operations { · 1632 unmodified lines
16331633 struct seq_file;
16341634
16351635 ssize_t rw_copy_check_uvector(int type, const struct iovec __user * uvector,
1636− unsigned long nr_segs, unsigned long fast_segs,
1637− struct iovec *fast_pointer,
1638− struct iovec **ret_pointer);
1636+ unsigned long nr_segs, unsigned long fast_segs,
1637+ struct iovec *fast_pointer,
1638+ struct iovec **ret_pointer,
1639+ int check_access);
16391640
16401641 extern ssize_t vfs_read(struct file *, char __user *, size_t, loff_t *);
16411642 extern ssize_t vfs_write(struct file *, const char __user *, size_t, loff_t *);
@@ -2634,8 +2635,8 @@ static const struct file_operations __fops = { \ · 992 unmodified lines
26342635 .llseek = generic_file_llseek, \
26352636 };
26362637
2637−static inline void __attribute__((format(printf, 1, 2)))
2638−__simple_attr_check_format(const char *fmt, ...)
2638+static inline __printf(1, 2)
2639+void __simple_attr_check_format(const char *fmt, ...)
26392640 {
26402641 /* don't do anything, just let the compiler check the arguments; */
26412642 }
include/linux/fscache-cache.h+4−4
@@ -492,10 +492,10 @@ static inline void fscache_end_io(struct fscache_retrieval *op, · 491 unmodified lines
492492 /*
493493 * out-of-line cache backend functions
494494 */
495−extern void fscache_init_cache(struct fscache_cache *cache,
496− const struct fscache_cache_ops *ops,
497− const char *idfmt,
498− ...) __attribute__ ((format (printf, 3, 4)));
495+extern __printf(3, 4)
496+void fscache_init_cache(struct fscache_cache *cache,
497+ const struct fscache_cache_ops *ops,
498+ const char *idfmt, ...);
499499
500500 extern int fscache_add_cache(struct fscache_cache *cache,
501501 struct fscache_object *fsdef,
include/linux/gameport.h+4−4
@@ -78,8 +78,8 @@ static inline void gameport_register_port(struct gameport *gameport) · 77 unmodified lines
7878
7979 void gameport_unregister_port(struct gameport *gameport);
8080
81−void gameport_set_phys(struct gameport *gameport, const char *fmt, ...)
82− __attribute__ ((format (printf, 2, 3)));
81+__printf(2, 3)
82+void gameport_set_phys(struct gameport *gameport, const char *fmt, ...);
8383
8484 #else
8585
@@ -93,8 +93,8 @@ static inline void gameport_unregister_port(struct gameport *gameport) · 7 unmodified lines
9393 return;
9494 }
9595
96−static inline void gameport_set_phys(struct gameport *gameport,
97− const char *fmt, ...)
96+static inline __printf(2, 3)
97+void gameport_set_phys(struct gameport *gameport, const char *fmt, ...)
9898 {
9999 return;
100100 }
include/linux/huge_mm.h+5−0
@@ -22,6 +22,11 @@ extern int zap_huge_pmd(struct mmu_gather *tlb, · 21 unmodified lines
2222 extern int mincore_huge_pmd(struct vm_area_struct *vma, pmd_t *pmd,
2323 unsigned long addr, unsigned long end,
2424 unsigned char *vec);
25+extern int move_huge_pmd(struct vm_area_struct *vma,
26+ struct vm_area_struct *new_vma,
27+ unsigned long old_addr,
28+ unsigned long new_addr, unsigned long old_end,
29+ pmd_t *old_pmd, pmd_t *new_pmd);
2530 extern int change_huge_pmd(struct vm_area_struct *vma, pmd_t *pmd,
2631 unsigned long addr, pgprot_t newprot);
2732
include/linux/kallsyms.h+2−3
@@ -101,9 +101,8 @@ static inline int lookup_symbol_attrs(unsigned long addr, unsigned long *size, u · 100 unmodified lines
101101 #endif /*CONFIG_KALLSYMS*/
102102
103103 /* This macro allows us to keep printk typechecking */
104−static void __check_printsym_format(const char *fmt, ...)
105−__attribute__((format(printf,1,2)));
106−static inline void __check_printsym_format(const char *fmt, ...)
104+static __printf(1, 2)
105+void __check_printsym_format(const char *fmt, ...)
107106 {
108107 }
109108
include/linux/kdb.h+3−6
@@ -114,12 +114,9 @@ typedef enum { · 113 unmodified lines
114114 } kdb_reason_t;
115115
116116 extern int kdb_trap_printk;
117−extern int vkdb_printf(const char *fmt, va_list args)
118− __attribute__ ((format (printf, 1, 0)));
119−extern int kdb_printf(const char *, ...)
120− __attribute__ ((format (printf, 1, 2)));
121−typedef int (*kdb_printf_t)(const char *, ...)
122− __attribute__ ((format (printf, 1, 2)));
117+extern __printf(1, 0) int vkdb_printf(const char *fmt, va_list args);
118+extern __printf(1, 2) int kdb_printf(const char *, ...);
119+typedef __printf(1, 2) int (*kdb_printf_t)(const char *, ...);
123120
124121 extern void kdb_init(int level);
125122
include/linux/kernel.h+30−25
@@ -287,6 +287,8 @@ static inline int __must_check kstrtos32_from_user(const char __user *s, size_t · 286 unmodified lines
287287 return kstrtoint_from_user(s, count, base, res);
288288 }
289289
290+/* Obsolete, do not use. Use kstrto<foo> instead */
291+
290292 extern unsigned long simple_strtoul(const char *,char **,unsigned int);
291293 extern long simple_strtol(const char *,char **,unsigned int);
292294 extern unsigned long long simple_strtoull(const char *,char **,unsigned int);
@@ -296,20 +298,20 @@ extern long long simple_strtoll(const char *,char **,unsigned int); · 3 unmodified lines
296298 #define strict_strtoull kstrtoull
297299 #define strict_strtoll kstrtoll
298300
299−extern int sprintf(char * buf, const char * fmt, ...)
300− __attribute__ ((format (printf, 2, 3)));
301−extern int vsprintf(char *buf, const char *, va_list)
302− __attribute__ ((format (printf, 2, 0)));
303−extern int snprintf(char * buf, size_t size, const char * fmt, ...)
304− __attribute__ ((format (printf, 3, 4)));
305−extern int vsnprintf(char *buf, size_t size, const char *fmt, va_list args)
306− __attribute__ ((format (printf, 3, 0)));
307−extern int scnprintf(char * buf, size_t size, const char * fmt, ...)
308− __attribute__ ((format (printf, 3, 4)));
309−extern int vscnprintf(char *buf, size_t size, const char *fmt, va_list args)
310− __attribute__ ((format (printf, 3, 0)));
311−extern char *kasprintf(gfp_t gfp, const char *fmt, ...)
312− __attribute__ ((format (printf, 2, 3)));
301+/* lib/printf utilities */
302+
303+extern __printf(2, 3) int sprintf(char *buf, const char * fmt, ...);
304+extern __printf(2, 0) int vsprintf(char *buf, const char *, va_list);
305+extern __printf(3, 4)
306+int snprintf(char *buf, size_t size, const char *fmt, ...);
307+extern __printf(3, 0)
308+int vsnprintf(char *buf, size_t size, const char *fmt, va_list args);
309+extern __printf(3, 4)
310+int scnprintf(char *buf, size_t size, const char *fmt, ...);
311+extern __printf(3, 0)
312+int vscnprintf(char *buf, size_t size, const char *fmt, va_list args);
313+extern __printf(2, 3)
314+char *kasprintf(gfp_t gfp, const char *fmt, ...);
313315 extern char *kvasprintf(gfp_t gfp, const char *fmt, va_list args);
314316
315317 extern int sscanf(const char *, const char *, ...)
@@ -374,13 +376,18 @@ extern const char hex_asc[]; · 58 unmodified lines
374376 #define hex_asc_lo(x) hex_asc[((x) & 0x0f)]
375377 #define hex_asc_hi(x) hex_asc[((x) & 0xf0) >> 4]
376378
377−static inline char *pack_hex_byte(char *buf, u8 byte)
379+static inline char *hex_byte_pack(char *buf, u8 byte)
378380 {
379381 *buf++ = hex_asc_hi(byte);
380382 *buf++ = hex_asc_lo(byte);
381383 return buf;
382384 }
383385
386+static inline char * __deprecated pack_hex_byte(char *buf, u8 byte)
387+{
388+ return hex_byte_pack(buf, byte);
389+}
390+
384391 extern int hex_to_bin(char ch);
385392 extern int __must_check hex2bin(u8 *dst, const char *src, size_t count);
386393
@@ -427,8 +434,8 @@ extern void tracing_start(void); · 40 unmodified lines
427434 extern void tracing_stop(void);
428435 extern void ftrace_off_permanent(void);
429436
430−static inline void __attribute__ ((format (printf, 1, 2)))
431−____trace_printk_check_format(const char *fmt, ...)
437+static inline __printf(1, 2)
438+void ____trace_printk_check_format(const char *fmt, ...)
432439 {
433440 }
434441 #define __trace_printk_check_format(fmt, args...) \
@@ -467,13 +474,11 @@ do { \ · 32 unmodified lines
467474 __trace_printk(_THIS_IP_, fmt, ##args); \
468475 } while (0)
469476
470−extern int
471−__trace_bprintk(unsigned long ip, const char *fmt, ...)
472− __attribute__ ((format (printf, 2, 3)));
477+extern __printf(2, 3)
478+int __trace_bprintk(unsigned long ip, const char *fmt, ...);
473479
474−extern int
475−__trace_printk(unsigned long ip, const char *fmt, ...)
476− __attribute__ ((format (printf, 2, 3)));
480+extern __printf(2, 3)
481+int __trace_printk(unsigned long ip, const char *fmt, ...);
477482
478483 extern void trace_dump_stack(void);
479484
@@ -502,8 +507,8 @@ __ftrace_vprintk(unsigned long ip, const char *fmt, va_list ap); · 22 unmodified lines
502507
503508 extern void ftrace_dump(enum ftrace_dump_mode oops_dump_mode);
504509 #else
505−static inline int
506−trace_printk(const char *fmt, ...) __attribute__ ((format (printf, 1, 2)));
510+static inline __printf(1, 2)
511+int trace_printk(const char *fmt, ...);
507512
508513 static inline void tracing_start(void) { }
509514 static inline void tracing_stop(void) { }
include/linux/kexec.h+2−2
@@ -140,8 +140,8 @@ void crash_save_vmcoreinfo(void); · 139 unmodified lines
140140 void crash_map_reserved_pages(void);
141141 void crash_unmap_reserved_pages(void);
142142 void arch_crash_save_vmcoreinfo(void);
143−void vmcoreinfo_append_str(const char *fmt, ...)
144− __attribute__ ((format (printf, 1, 2)));
143+__printf(1, 2)
144+void vmcoreinfo_append_str(const char *fmt, ...);
145145 unsigned long paddr_vmcoreinfo_note(void);
146146
147147 #define VMCOREINFO_OSRELEASE(value) \
include/linux/kmod.h+2−2
@@ -32,8 +32,8 @@ · 31 unmodified lines
3232 extern char modprobe_path[]; /* for sysctl */
3333 /* modprobe exit status on success, -ve on error. Return value
3434 * usually useless though. */
35−extern int __request_module(bool wait, const char *name, ...) \
36− __attribute__((format(printf, 2, 3)));
35+extern __printf(2, 3)
36+int __request_module(bool wait, const char *name, ...);
3737 #define request_module(mod...) __request_module(true, mod)
3838 #define request_module_nowait(mod...) __request_module(false, mod)
3939 #define try_then_request_module(x, mod...) \
include/linux/kobject.h+12−14
@@ -72,8 +72,8 @@ struct kobject { · 71 unmodified lines
7272 unsigned int uevent_suppress:1;
7373 };
7474
75−extern int kobject_set_name(struct kobject *kobj, const char *name, ...)
76− __attribute__((format(printf, 2, 3)));
75+extern __printf(2, 3)
76+int kobject_set_name(struct kobject *kobj, const char *name, ...);
7777 extern int kobject_set_name_vargs(struct kobject *kobj, const char *fmt,
7878 va_list vargs);
7979
@@ -83,15 +83,13 @@ static inline const char *kobject_name(const struct kobject *kobj) · 3 unmodified lines
8383 }
8484
8585 extern void kobject_init(struct kobject *kobj, struct kobj_type *ktype);
86−extern int __must_check kobject_add(struct kobject *kobj,
87− struct kobject *parent,
88− const char *fmt, ...)
89− __attribute__((format(printf, 3, 4)));
90−extern int __must_check kobject_init_and_add(struct kobject *kobj,
91− struct kobj_type *ktype,
92− struct kobject *parent,
93− const char *fmt, ...)
94− __attribute__((format(printf, 4, 5)));
86+extern __printf(3, 4) __must_check
87+int kobject_add(struct kobject *kobj, struct kobject *parent,
88+ const char *fmt, ...);
89+extern __printf(4, 5) __must_check
90+int kobject_init_and_add(struct kobject *kobj,
91+ struct kobj_type *ktype, struct kobject *parent,
92+ const char *fmt, ...);
9593
9694 extern void kobject_del(struct kobject *kobj);
9795
@@ -212,8 +210,8 @@ int kobject_uevent(struct kobject *kobj, enum kobject_action action); · 114 unmodified lines
212210 int kobject_uevent_env(struct kobject *kobj, enum kobject_action action,
213211 char *envp[]);
214212
215−int add_uevent_var(struct kobj_uevent_env *env, const char *format, ...)
216− __attribute__((format (printf, 2, 3)));
213+__printf(2, 3)
214+int add_uevent_var(struct kobj_uevent_env *env, const char *format, ...);
217215
218216 int kobject_action_type(const char *buf, size_t count,
219217 enum kobject_action *type);
@@ -226,7 +224,7 @@ static inline int kobject_uevent_env(struct kobject *kobj, · 6 unmodified lines
226224 char *envp[])
227225 { return 0; }
228226
229−static inline __attribute__((format(printf, 2, 3)))
227+static inline __printf(2, 3)
230228 int add_uevent_var(struct kobj_uevent_env *env, const char *format, ...)
231229 { return 0; }
232230
include/linux/kthread.h+2−2
@@ -4,11 +4,11 @@ · 3 unmodified lines
44 #include <linux/err.h>
55 #include <linux/sched.h>
66
7+__printf(4, 5)
78 struct task_struct *kthread_create_on_node(int (*threadfn)(void *data),
89 void *data,
910 int node,
10− const char namefmt[], ...)
11− __attribute__((format(printf, 4, 5)));
11+ const char namefmt[], ...);
1212
1313 #define kthread_create(threadfn, data, namefmt, arg...) \
1414 kthread_create_on_node(threadfn, data, -1, namefmt, ##arg)
include/linux/libata.h+9−9
@@ -1256,13 +1256,13 @@ static inline int sata_srst_pmp(struct ata_link *link) · 1255 unmodified lines
12561256 /*
12571257 * printk helpers
12581258 */
1259−__attribute__((format (printf, 3, 4)))
1259+__printf(3, 4)
12601260 int ata_port_printk(const struct ata_port *ap, const char *level,
12611261 const char *fmt, ...);
1262−__attribute__((format (printf, 3, 4)))
1262+__printf(3, 4)
12631263 int ata_link_printk(const struct ata_link *link, const char *level,
12641264 const char *fmt, ...);
1265−__attribute__((format (printf, 3, 4)))
1265+__printf(3, 4)
12661266 int ata_dev_printk(const struct ata_device *dev, const char *level,
12671267 const char *fmt, ...);
12681268
@@ -1304,10 +1304,10 @@ void ata_print_version(const struct device *dev, const char *version); · 35 unmodified lines
13041304 /*
13051305 * ata_eh_info helpers
13061306 */
1307−extern void __ata_ehi_push_desc(struct ata_eh_info *ehi, const char *fmt, ...)
1308− __attribute__ ((format (printf, 2, 3)));
1309−extern void ata_ehi_push_desc(struct ata_eh_info *ehi, const char *fmt, ...)
1310− __attribute__ ((format (printf, 2, 3)));
1307+extern __printf(2, 3)
1308+void __ata_ehi_push_desc(struct ata_eh_info *ehi, const char *fmt, ...);
1309+extern __printf(2, 3)
1310+void ata_ehi_push_desc(struct ata_eh_info *ehi, const char *fmt, ...);
13111311 extern void ata_ehi_clear_desc(struct ata_eh_info *ehi);
13121312
13131313 static inline void ata_ehi_hotplugged(struct ata_eh_info *ehi)
@@ -1321,8 +1321,8 @@ static inline void ata_ehi_hotplugged(struct ata_eh_info *ehi) · 7 unmodified lines
13211321 /*
13221322 * port description helpers
13231323 */
1324−extern void ata_port_desc(struct ata_port *ap, const char *fmt, ...)
1325− __attribute__ ((format (printf, 2, 3)));
1324+extern __printf(2, 3)
1325+void ata_port_desc(struct ata_port *ap, const char *fmt, ...);
13261326 #ifdef CONFIG_PCI
13271327 extern void ata_port_pbar_desc(struct ata_port *ap, int bar, ssize_t offset,
13281328 const char *name);
include/linux/lis3lv02d.h+0−1
@@ -113,7 +113,6 @@ struct lis3lv02d_platform_data { · 112 unmodified lines
113113 s8 axis_x;
114114 s8 axis_y;
115115 s8 axis_z;
116−#define LIS3_USE_REGULATOR_CTRL 0x01
117116 #define LIS3_USE_BLOCK_READ 0x02
118117 u16 driver_features;
119118 int default_rate;
include/linux/llist.h+1−1
@@ -148,7 +148,7 @@ static inline struct llist_node *llist_next(struct llist_node *node) · 147 unmodified lines
148148 * @new: new entry to be added
149149 * @head: the head for your lock-less list
150150 *
151− * Return whether list is empty before adding.
151+ * Returns true if the list was empty prior to adding this entry.
152152 */
153153 static inline bool llist_add(struct llist_node *new, struct llist_head *head)
154154 {
include/linux/memblock.h+1−0
@@ -80,6 +80,7 @@ extern phys_addr_t __memblock_alloc_base(phys_addr_t size, · 79 unmodified lines
8080 phys_addr_t align,
8181 phys_addr_t max_addr);
8282 extern phys_addr_t memblock_phys_mem_size(void);
83+extern phys_addr_t memblock_start_of_DRAM(void);
8384 extern phys_addr_t memblock_end_of_DRAM(void);
8485 extern void memblock_enforce_memory_limit(phys_addr_t memory_limit);
8586 extern int memblock_is_memory(phys_addr_t addr);
include/linux/memcontrol.h+2−1
@@ -35,7 +35,8 @@ enum mem_cgroup_page_stat_item { · 34 unmodified lines
3535 extern unsigned long mem_cgroup_isolate_pages(unsigned long nr_to_scan,
3636 struct list_head *dst,
3737 unsigned long *scanned, int order,
38− int mode, struct zone *z,
38+ isolate_mode_t mode,
39+ struct zone *z,
3940 struct mem_cgroup *mem_cont,
4041 int active, int file);
4142
include/linux/mm.h+2−1
@@ -1334,7 +1334,8 @@ extern void si_meminfo(struct sysinfo * val); · 1333 unmodified lines
13341334 extern void si_meminfo_node(struct sysinfo *val, int nid);
13351335 extern int after_bootmem;
13361336
1337−extern void warn_alloc_failed(gfp_t gfp_mask, int order, const char *fmt, ...);
1337+extern __printf(3, 4)
1338+void warn_alloc_failed(gfp_t gfp_mask, int order, const char *fmt, ...);
13381339
13391340 extern void setup_per_cpu_pageset(void);
13401341
include/linux/mm_types.h+9−5
@@ -304,8 +304,15 @@ struct mm_struct { · 303 unmodified lines
304304 unsigned long hiwater_rss; /* High-watermark of RSS usage */
305305 unsigned long hiwater_vm; /* High-water virtual memory usage */
306306
307− unsigned long total_vm, locked_vm, shared_vm, exec_vm;
308− unsigned long stack_vm, reserved_vm, def_flags, nr_ptes;
307+ unsigned long total_vm; /* Total pages mapped */
308+ unsigned long locked_vm; /* Pages that have PG_mlocked set */
309+ unsigned long pinned_vm; /* Refcount permanently increased */
310+ unsigned long shared_vm; /* Shared pages (files) */
311+ unsigned long exec_vm; /* VM_EXEC & ~VM_WRITE */
312+ unsigned long stack_vm; /* VM_GROWSUP/DOWN */
313+ unsigned long reserved_vm; /* VM_RESERVED|VM_IO pages */
314+ unsigned long def_flags;
315+ unsigned long nr_ptes; /* Page table pages */
309316 unsigned long start_code, end_code, start_data, end_data;
310317 unsigned long start_brk, brk, start_stack;
311318 unsigned long arg_start, arg_end, env_start, env_end;
@@ -336,9 +343,6 @@ struct mm_struct { · 24 unmodified lines
336343 unsigned int token_priority;
337344 unsigned int last_interval;
338345
339− /* How many tasks sharing this mm are OOM_DISABLE */
340− atomic_t oom_disable_count;
341−
342346 unsigned long flags; /* Must use atomic bitops to access the bits */
343347
344348 struct core_state *core_state; /* coredumping support */
include/linux/mmiotrace.h+2−6
@@ -49,8 +49,7 @@ extern void mmiotrace_ioremap(resource_size_t offset, unsigned long size, · 48 unmodified lines
4949 extern void mmiotrace_iounmap(volatile void __iomem *addr);
5050
5151 /* For anyone to insert markers. Remember trailing newline. */
52−extern int mmiotrace_printk(const char *fmt, ...)
53− __attribute__ ((format (printf, 1, 2)));
52+extern __printf(1, 2) int mmiotrace_printk(const char *fmt, ...);
5453 #else /* !CONFIG_MMIOTRACE: */
5554 static inline int is_kmmio_active(void)
5655 {
@@ -71,10 +70,7 @@ static inline void mmiotrace_iounmap(volatile void __iomem *addr) · 14 unmodified lines
7170 {
7271 }
7372
74−static inline int mmiotrace_printk(const char *fmt, ...)
75− __attribute__ ((format (printf, 1, 0)));
76−
77−static inline int mmiotrace_printk(const char *fmt, ...)
73+static inline __printf(1, 2) int mmiotrace_printk(const char *fmt, ...)
7874 {
7975 return 0;
8076 }
include/linux/mmzone.h+13−0
@@ -100,6 +100,7 @@ enum zone_stat_item { · 99 unmodified lines
100100 NR_UNSTABLE_NFS, /* NFS unstable pages */
101101 NR_BOUNCE,
102102 NR_VMSCAN_WRITE,
103+ NR_VMSCAN_IMMEDIATE, /* Prioritise for reclaim when writeback ends */
103104 NR_WRITEBACK_TEMP, /* Writeback using temporary buffers */
104105 NR_ISOLATED_ANON, /* Temporary isolated pages from anon lru */
105106 NR_ISOLATED_FILE, /* Temporary isolated pages from file lru */
@@ -164,6 +165,18 @@ static inline int is_unevictable_lru(enum lru_list l) · 58 unmodified lines
164165 #define LRU_ALL_EVICTABLE (LRU_ALL_FILE | LRU_ALL_ANON)
165166 #define LRU_ALL ((1 << NR_LRU_LISTS) - 1)
166167
168+/* Isolate inactive pages */
169+#define ISOLATE_INACTIVE ((__force isolate_mode_t)0x1)
170+/* Isolate active pages */
171+#define ISOLATE_ACTIVE ((__force isolate_mode_t)0x2)
172+/* Isolate clean file */
173+#define ISOLATE_CLEAN ((__force isolate_mode_t)0x4)
174+/* Isolate unmapped file */
175+#define ISOLATE_UNMAPPED ((__force isolate_mode_t)0x8)
176+
177+/* LRU Isolation modes. */
178+typedef unsigned __bitwise__ isolate_mode_t;
179+
167180 enum zone_watermarks {
168181 WMARK_MIN,
169182 WMARK_LOW,
include/linux/netdevice.h+17−17
@@ -2622,23 +2622,23 @@ static inline const char *netdev_name(const struct net_device *dev) · 2621 unmodified lines
26222622 extern int __netdev_printk(const char *level, const struct net_device *dev,
26232623 struct va_format *vaf);
26242624
2625−extern int netdev_printk(const char *level, const struct net_device *dev,
2626− const char *format, ...)
2627− __attribute__ ((format (printf, 3, 4)));
2628−extern int netdev_emerg(const struct net_device *dev, const char *format, ...)
2629− __attribute__ ((format (printf, 2, 3)));
2630−extern int netdev_alert(const struct net_device *dev, const char *format, ...)
2631− __attribute__ ((format (printf, 2, 3)));
2632−extern int netdev_crit(const struct net_device *dev, const char *format, ...)
2633− __attribute__ ((format (printf, 2, 3)));
2634−extern int netdev_err(const struct net_device *dev, const char *format, ...)
2635− __attribute__ ((format (printf, 2, 3)));
2636−extern int netdev_warn(const struct net_device *dev, const char *format, ...)
2637− __attribute__ ((format (printf, 2, 3)));
2638−extern int netdev_notice(const struct net_device *dev, const char *format, ...)
2639− __attribute__ ((format (printf, 2, 3)));
2640−extern int netdev_info(const struct net_device *dev, const char *format, ...)
2641− __attribute__ ((format (printf, 2, 3)));
2625+extern __printf(3, 4)
2626+int netdev_printk(const char *level, const struct net_device *dev,
2627+ const char *format, ...);
2628+extern __printf(2, 3)
2629+int netdev_emerg(const struct net_device *dev, const char *format, ...);
2630+extern __printf(2, 3)
2631+int netdev_alert(const struct net_device *dev, const char *format, ...);
2632+extern __printf(2, 3)
2633+int netdev_crit(const struct net_device *dev, const char *format, ...);
2634+extern __printf(2, 3)
2635+int netdev_err(const struct net_device *dev, const char *format, ...);
2636+extern __printf(2, 3)
2637+int netdev_warn(const struct net_device *dev, const char *format, ...);
2638+extern __printf(2, 3)
2639+int netdev_notice(const struct net_device *dev, const char *format, ...);
2640+extern __printf(2, 3)
2641+int netdev_info(const struct net_device *dev, const char *format, ...);
26422642
26432643 #define MODULE_ALIAS_NETDEV(device) \
26442644 MODULE_ALIAS("netdev-" device)
include/linux/oom.h+1−0
@@ -40,6 +40,7 @@ enum oom_constraint { · 39 unmodified lines
4040 CONSTRAINT_MEMCG,
4141 };
4242
43+extern void compare_swap_oom_score_adj(int old_val, int new_val);
4344 extern int test_set_oom_score_adj(int new_val);
4445
4546 extern unsigned int oom_badness(struct task_struct *p, struct mem_cgroup *mem,
include/linux/platform_data/leds-renesas-tpu.h+14−0
@@ -0,0 +1,14 @@
1+#ifndef __LEDS_RENESAS_TPU_H__
2+#define __LEDS_RENESAS_TPU_H__
3+
4+struct led_renesas_tpu_config {
5+ char *name;
6+ unsigned pin_gpio_fn;
7+ unsigned pin_gpio;
8+ unsigned int channel_offset;
9+ unsigned int timer_bit;
10+ unsigned int max_brightness;
11+ unsigned int refresh_rate;
12+};
13+
14+#endif /* __LEDS_RENESAS_TPU_H__ */
include/linux/printk.h+6−6
@@ -82,22 +82,22 @@ struct va_format { · 81 unmodified lines
8282 * Dummy printk for disabled debugging statements to use whilst maintaining
8383 * gcc's format and side-effect checking.
8484 */
85−static inline __attribute__ ((format (printf, 1, 2)))
85+static inline __printf(1, 2)
8686 int no_printk(const char *fmt, ...)
8787 {
8888 return 0;
8989 }
9090
91−extern asmlinkage __attribute__ ((format (printf, 1, 2)))
91+extern asmlinkage __printf(1, 2)
9292 void early_printk(const char *fmt, ...);
9393
9494 extern int printk_needs_cpu(int cpu);
9595 extern void printk_tick(void);
9696
9797 #ifdef CONFIG_PRINTK
98−asmlinkage __attribute__ ((format (printf, 1, 0)))
98+asmlinkage __printf(1, 0)
9999 int vprintk(const char *fmt, va_list args);
100−asmlinkage __attribute__ ((format (printf, 1, 2))) __cold
100+asmlinkage __printf(1, 2) __cold
101101 int printk(const char *fmt, ...);
102102
103103 /*
@@ -117,12 +117,12 @@ extern int kptr_restrict; · 13 unmodified lines
117117 void log_buf_kexec_setup(void);
118118 void __init setup_log_buf(int early);
119119 #else
120−static inline __attribute__ ((format (printf, 1, 0)))
120+static inline __printf(1, 0)
121121 int vprintk(const char *s, va_list args)
122122 {
123123 return 0;
124124 }
125−static inline __attribute__ ((format (printf, 1, 2))) __cold
125+static inline __printf(1, 2) __cold
126126 int printk(const char *s, ...)
127127 {
128128 return 0;
include/linux/quotaops.h+1−1
@@ -31,7 +31,7 @@ static inline bool is_quota_modification(struct inode *inode, struct iattr *ia) · 30 unmodified lines
3131 #define quota_error(sb, fmt, args...) \
3232 __quota_error((sb), __func__, fmt , ## args)
3333
34−extern __attribute__((format (printf, 3, 4)))
34+extern __printf(3, 4)
3535 void __quota_error(struct super_block *sb, const char *func,
3636 const char *fmt, ...);
3737
include/linux/seq_file.h+1−2
@@ -84,8 +84,7 @@ int seq_putc(struct seq_file *m, char c); · 83 unmodified lines
8484 int seq_puts(struct seq_file *m, const char *s);
8585 int seq_write(struct seq_file *seq, const void *data, size_t len);
8686
87−int seq_printf(struct seq_file *, const char *, ...)
88− __attribute__ ((format (printf,2,3)));
87+__printf(2, 3) int seq_printf(struct seq_file *, const char *, ...);
8988
9089 int seq_path(struct seq_file *, struct path *, char *);
9190 int seq_dentry(struct seq_file *, struct dentry *, char *);
include/linux/shrinker.h+1−0
@@ -20,6 +20,7 @@ struct shrink_control { · 19 unmodified lines
2020 * 'nr_to_scan' entries and attempt to free them up. It should return
2121 * the number of objects which remain in the cache. If it returns -1, it means
2222 * it cannot do any scanning at this time (eg. there is a risk of deadlock).
23+ * The callback must not return -1 if nr_to_scan is zero.
2324 *
2425 * The 'gfpmask' refers to the allocation we are currently trying to
2526 * fulfil.
include/linux/spi/l4f00242t03.h+0−2
@@ -24,8 +24,6 @@ · 23 unmodified lines
2424 struct l4f00242t03_pdata {
2525 unsigned int reset_gpio;
2626 unsigned int data_enable_gpio;
27− const char *io_supply; /* will be set to 1.8 V */
28− const char *core_supply; /* will be set to 2.8 V */
2927 };
3028
3129 #endif /* _INCLUDE_LINUX_SPI_L4F00242T03_H_ */
include/linux/string.h+1−0
@@ -114,6 +114,7 @@ extern int memcmp(const void *,const void *,__kernel_size_t); · 113 unmodified lines
114114 #ifndef __HAVE_ARCH_MEMCHR
115115 extern void * memchr(const void *,int,__kernel_size_t);
116116 #endif
117+void *memchr_inv(const void *s, int c, size_t n);
117118
118119 extern char *kstrdup(const char *s, gfp_t gfp);
119120 extern char *kstrndup(const char *s, size_t len, gfp_t gfp);
include/linux/swap.h+1−6
@@ -243,15 +243,10 @@ static inline void lru_cache_add_file(struct page *page) · 242 unmodified lines
243243 __lru_cache_add(page, LRU_INACTIVE_FILE);
244244 }
245245
246−/* LRU Isolation modes. */
247−#define ISOLATE_INACTIVE 0 /* Isolate inactive pages. */
248−#define ISOLATE_ACTIVE 1 /* Isolate active pages. */
249−#define ISOLATE_BOTH 2 /* Isolate both active and inactive pages. */
250−
251246 /* linux/mm/vmscan.c */
252247 extern unsigned long try_to_free_pages(struct zonelist *zonelist, int order,
253248 gfp_t gfp_mask, nodemask_t *mask);
254−extern int __isolate_lru_page(struct page *page, int mode, int file);
249+extern int __isolate_lru_page(struct page *page, isolate_mode_t mode, int file);
255250 extern unsigned long try_to_free_mem_cgroup_pages(struct mem_cgroup *mem,
256251 gfp_t gfp_mask, bool noswap);
257252 extern unsigned long mem_cgroup_shrink_node_zone(struct mem_cgroup *mem,
include/linux/syscalls.h+13−0
@@ -844,4 +844,17 @@ asmlinkage long sys_open_by_handle_at(int mountdirfd, · 843 unmodified lines
844844 struct file_handle __user *handle,
845845 int flags);
846846 asmlinkage long sys_setns(int fd, int nstype);
847+asmlinkage long sys_process_vm_readv(pid_t pid,
848+ const struct iovec __user *lvec,
849+ unsigned long liovcnt,
850+ const struct iovec __user *rvec,
851+ unsigned long riovcnt,
852+ unsigned long flags);
853+asmlinkage long sys_process_vm_writev(pid_t pid,
854+ const struct iovec __user *lvec,
855+ unsigned long liovcnt,
856+ const struct iovec __user *rvec,
857+ unsigned long riovcnt,
858+ unsigned long flags);
859+
847860 #endif
include/linux/trace_seq.h+4−4
@@ -29,10 +29,10 @@ trace_seq_init(struct trace_seq *s) · 28 unmodified lines
2929 * Currently only defined when tracing is enabled.
3030 */
3131 #ifdef CONFIG_TRACING
32−extern int trace_seq_printf(struct trace_seq *s, const char *fmt, ...)
33− __attribute__ ((format (printf, 2, 3)));
34−extern int trace_seq_vprintf(struct trace_seq *s, const char *fmt, va_list args)
35− __attribute__ ((format (printf, 2, 0)));
32+extern __printf(2, 3)
33+int trace_seq_printf(struct trace_seq *s, const char *fmt, ...);
34+extern __printf(2, 0)
35+int trace_seq_vprintf(struct trace_seq *s, const char *fmt, va_list args);
3636 extern int
3737 trace_seq_bprintf(struct trace_seq *s, const char *fmt, const u32 *binary);
3838 extern int trace_print_seq(struct seq_file *m, struct trace_seq *s);
include/linux/vmalloc.h+1−0
@@ -13,6 +13,7 @@ struct vm_area_struct; /* vma defining user mapping in mm_types.h */ · 12 unmodified lines
1313 #define VM_MAP 0x00000004 /* vmap()ed pages */
1414 #define VM_USERMAP 0x00000008 /* suitable for remap_vmalloc_range */
1515 #define VM_VPAGES 0x00000010 /* buffer for pages was vmalloc'ed */
16+#define VM_UNLIST 0x00000020 /* vm_struct is not listed in vmlist */
1617 /* bits [20..32] reserved for arch specific ioremap internals */
1718
1819 /*
include/net/bluetooth/bluetooth.h+1−1
@@ -77,7 +77,7 @@ struct bt_power { · 76 unmodified lines
7777 #define BT_POWER_FORCE_ACTIVE_OFF 0
7878 #define BT_POWER_FORCE_ACTIVE_ON 1
7979
80−__attribute__((format (printf, 2, 3)))
80+__printf(2, 3)
8181 int bt_printk(const char *level, const char *fmt, ...);
8282
8383 #define BT_INFO(fmt, arg...) bt_printk(KERN_INFO, pr_fmt(fmt), ##arg)
include/net/netfilter/nf_log.h+2−1
@@ -53,12 +53,13 @@ int nf_log_bind_pf(u_int8_t pf, const struct nf_logger *logger); · 52 unmodified lines
5353 void nf_log_unbind_pf(u_int8_t pf);
5454
5555 /* Calls the registered backend logging function */
56+__printf(7, 8)
5657 void nf_log_packet(u_int8_t pf,
5758 unsigned int hooknum,
5859 const struct sk_buff *skb,
5960 const struct net_device *in,
6061 const struct net_device *out,
6162 const struct nf_loginfo *li,
62− const char *fmt, ...) __attribute__ ((format(printf,7,8)));
63+ const char *fmt, ...);
6364
6465 #endif /* _NF_LOG_H */
include/net/sock.h+2−2
@@ -76,8 +76,8 @@ · 75 unmodified lines
7676 printk(KERN_DEBUG msg); } while (0)
7777 #else
7878 /* Validate arguments and do nothing */
79−static inline void __attribute__ ((format (printf, 2, 3)))
80−SOCK_DEBUG(struct sock *sk, const char *msg, ...)
79+static inline __printf(2, 3)
80+void SOCK_DEBUG(struct sock *sk, const char *msg, ...)
8181 {
8282 }
8383 #endif
include/sound/core.h+2−2
@@ -326,9 +326,9 @@ void release_and_free_resource(struct resource *res); · 325 unmodified lines
326326 /* --- */
327327
328328 #if defined(CONFIG_SND_DEBUG) || defined(CONFIG_SND_VERBOSE_PRINTK)
329+__printf(4, 5)
329330 void __snd_printk(unsigned int level, const char *file, int line,
330− const char *format, ...)
331− __attribute__ ((format (printf, 4, 5)));
331+ const char *format, ...);
332332 #else
333333 #define __snd_printk(level, file, line, format, args...) \
334334 printk(format, ##args)
include/sound/info.h+2−2
@@ -110,8 +110,8 @@ void snd_card_info_read_oss(struct snd_info_buffer *buffer); · 109 unmodified lines
110110 static inline void snd_card_info_read_oss(struct snd_info_buffer *buffer) {}
111111 #endif
112112
113−int snd_iprintf(struct snd_info_buffer *buffer, const char *fmt, ...) \
114− __attribute__ ((format (printf, 2, 3)));
113+__printf(2, 3)
114+int snd_iprintf(struct snd_info_buffer *buffer, const char *fmt, ...);
115115 int snd_info_init(void);
116116 int snd_info_done(void);
117117
include/sound/seq_kernel.h+2−2
@@ -75,9 +75,9 @@ struct snd_seq_port_callback { · 74 unmodified lines
7575 };
7676
7777 /* interface for kernel client */
78+__printf(3, 4)
7879 int snd_seq_create_kernel_client(struct snd_card *card, int client_index,
79− const char *name_fmt, ...)
80− __attribute__ ((format (printf, 3, 4)));
80+ const char *name_fmt, ...);
8181 int snd_seq_delete_kernel_client(int client);
8282 int snd_seq_kernel_client_enqueue(int client, struct snd_seq_event *ev, int atomic, int hop);
8383 int snd_seq_kernel_client_dispatch(int client, struct snd_seq_event *ev, int atomic, int hop);
include/trace/events/vmscan.h+4−4
@@ -266,7 +266,7 @@ DECLARE_EVENT_CLASS(mm_vmscan_lru_isolate_template, · 265 unmodified lines
266266 unsigned long nr_lumpy_taken,
267267 unsigned long nr_lumpy_dirty,
268268 unsigned long nr_lumpy_failed,
269− int isolate_mode),
269+ isolate_mode_t isolate_mode),
270270
271271 TP_ARGS(order, nr_requested, nr_scanned, nr_taken, nr_lumpy_taken, nr_lumpy_dirty, nr_lumpy_failed, isolate_mode),
272272
@@ -278,7 +278,7 @@ DECLARE_EVENT_CLASS(mm_vmscan_lru_isolate_template, · 5 unmodified lines
278278 __field(unsigned long, nr_lumpy_taken)
279279 __field(unsigned long, nr_lumpy_dirty)
280280 __field(unsigned long, nr_lumpy_failed)
281− __field(int, isolate_mode)
281+ __field(isolate_mode_t, isolate_mode)
282282 ),
283283
284284 TP_fast_assign(
@@ -312,7 +312,7 @@ DEFINE_EVENT(mm_vmscan_lru_isolate_template, mm_vmscan_lru_isolate, · 27 unmodified lines
312312 unsigned long nr_lumpy_taken,
313313 unsigned long nr_lumpy_dirty,
314314 unsigned long nr_lumpy_failed,
315− int isolate_mode),
315+ isolate_mode_t isolate_mode),
316316
317317 TP_ARGS(order, nr_requested, nr_scanned, nr_taken, nr_lumpy_taken, nr_lumpy_dirty, nr_lumpy_failed, isolate_mode)
318318
@@ -327,7 +327,7 @@ DEFINE_EVENT(mm_vmscan_lru_isolate_template, mm_vmscan_memcg_isolate, · 8 unmodified lines
327327 unsigned long nr_lumpy_taken,
328328 unsigned long nr_lumpy_dirty,
329329 unsigned long nr_lumpy_failed,
330− int isolate_mode),
330+ isolate_mode_t isolate_mode),
331331
332332 TP_ARGS(order, nr_requested, nr_scanned, nr_taken, nr_lumpy_taken, nr_lumpy_dirty, nr_lumpy_failed, isolate_mode)
333333
include/xen/hvc-console.h+2−2
@@ -6,12 +6,12 @@ extern struct console xenboot_console; · 5 unmodified lines
66 #ifdef CONFIG_HVC_XEN
77 void xen_console_resume(void);
88 void xen_raw_console_write(const char *str);
9−__attribute__((format(printf, 1, 2)))
9+__printf(1, 2)
1010 void xen_raw_printk(const char *fmt, ...);
1111 #else
1212 static inline void xen_console_resume(void) { }
1313 static inline void xen_raw_console_write(const char *str) { }
14−static inline __attribute__((format(printf, 1, 2)))
14+static inline __printf(1, 2)
1515 void xen_raw_printk(const char *fmt, ...) { }
1616 #endif
1717
include/xen/xenbus.h+6−6
@@ -156,9 +156,9 @@ int xenbus_scanf(struct xenbus_transaction t, · 155 unmodified lines
156156 __attribute__((format(scanf, 4, 5)));
157157
158158 /* Single printf and write: returns -errno or 0. */
159+__printf(4, 5)
159160 int xenbus_printf(struct xenbus_transaction t,
160− const char *dir, const char *node, const char *fmt, ...)
161− __attribute__((format(printf, 4, 5)));
161+ const char *dir, const char *node, const char *fmt, ...);
162162
163163 /* Generic read function: NULL-terminated triples of name,
164164 * sprintf-style type string, and pointer. Returns 0 or errno.*/
@@ -200,11 +200,11 @@ int xenbus_watch_path(struct xenbus_device *dev, const char *path, · 35 unmodified lines
200200 struct xenbus_watch *watch,
201201 void (*callback)(struct xenbus_watch *,
202202 const char **, unsigned int));
203+__printf(4, 5)
203204 int xenbus_watch_pathfmt(struct xenbus_device *dev, struct xenbus_watch *watch,
204205 void (*callback)(struct xenbus_watch *,
205206 const char **, unsigned int),
206− const char *pathfmt, ...)
207− __attribute__ ((format (printf, 4, 5)));
207+ const char *pathfmt, ...);
208208
209209 int xenbus_switch_state(struct xenbus_device *dev, enum xenbus_state new_state);
210210 int xenbus_grant_ring(struct xenbus_device *dev, unsigned long ring_mfn);
@@ -223,9 +223,9 @@ int xenbus_free_evtchn(struct xenbus_device *dev, int port); · 12 unmodified lines
223223
224224 enum xenbus_state xenbus_read_driver_state(const char *path);
225225
226−__attribute__((format(printf, 3, 4)))
226+__printf(3, 4)
227227 void xenbus_dev_error(struct xenbus_device *dev, int err, const char *fmt, ...);
228−__attribute__((format(printf, 3, 4)))
228+__printf(3, 4)
229229 void xenbus_dev_fatal(struct xenbus_device *dev, int err, const char *fmt, ...);
230230
231231 const char *xenbus_strstate(enum xenbus_state state);
ipc/mqueue.c+2−2
@@ -449,8 +449,8 @@ static int wq_sleep(struct mqueue_inode_info *info, int sr, · 448 unmodified lines
449449 set_current_state(TASK_INTERRUPTIBLE);
450450
451451 spin_unlock(&info->lock);
452− time = schedule_hrtimeout_range_clock(timeout,
453− HRTIMER_MODE_ABS, 0, CLOCK_REALTIME);
452+ time = schedule_hrtimeout_range_clock(timeout, 0,
453+ HRTIMER_MODE_ABS, CLOCK_REALTIME);
454454
455455 while (ewp->state == STATE_PENDING)
456456 cpu_relax();
kernel/debug/gdbstub.c+6−6
@@ -217,7 +217,7 @@ void gdbstub_msg_write(const char *s, int len) · 216 unmodified lines
217217
218218 /* Pack in hex chars */
219219 for (i = 0; i < wcount; i++)
220− bufptr = pack_hex_byte(bufptr, s[i]);
220+ bufptr = hex_byte_pack(bufptr, s[i]);
221221 *bufptr = '\0';
222222
223223 /* Move up */
@@ -249,7 +249,7 @@ char *kgdb_mem2hex(char *mem, char *buf, int count) · 25 unmodified lines
249249 if (err)
250250 return NULL;
251251 while (count > 0) {
252− buf = pack_hex_byte(buf, *tmp);
252+ buf = hex_byte_pack(buf, *tmp);
253253 tmp++;
254254 count--;
255255 }
@@ -411,14 +411,14 @@ static char *pack_threadid(char *pkt, unsigned char *id) · 155 unmodified lines
411411 limit = id + (BUF_THREAD_ID_SIZE / 2);
412412 while (id < limit) {
413413 if (!lzero || *id != 0) {
414− pkt = pack_hex_byte(pkt, *id);
414+ pkt = hex_byte_pack(pkt, *id);
415415 lzero = 0;
416416 }
417417 id++;
418418 }
419419
420420 if (lzero)
421− pkt = pack_hex_byte(pkt, 0);
421+ pkt = hex_byte_pack(pkt, 0);
422422
423423 return pkt;
424424 }
@@ -486,7 +486,7 @@ static void gdb_cmd_status(struct kgdb_state *ks) · 61 unmodified lines
486486 dbg_remove_all_break();
487487
488488 remcom_out_buffer[0] = 'S';
489− pack_hex_byte(&remcom_out_buffer[1], ks->signo);
489+ hex_byte_pack(&remcom_out_buffer[1], ks->signo);
490490 }
491491
492492 static void gdb_get_regs_helper(struct kgdb_state *ks)
@@ -954,7 +954,7 @@ int gdb_serial_stub(struct kgdb_state *ks) · 461 unmodified lines
954954 /* Reply to host that an exception has occurred */
955955 ptr = remcom_out_buffer;
956956 *ptr++ = 'T';
957− ptr = pack_hex_byte(ptr, ks->signo);
957+ ptr = hex_byte_pack(ptr, ks->signo);
958958 ptr += strlen(strcpy(ptr, "thread:"));
959959 int_to_threadref(thref, shadow_pid(current->pid));
960960 ptr = pack_threadid(ptr, thref);
kernel/events/core.c+3−3
@@ -3544,7 +3544,7 @@ static void perf_mmap_close(struct vm_area_struct *vma) · 3543 unmodified lines
35443544 struct ring_buffer *rb = event->rb;
35453545
35463546 atomic_long_sub((size >> PAGE_SHIFT) + 1, &user->locked_vm);
3547− vma->vm_mm->locked_vm -= event->mmap_locked;
3547+ vma->vm_mm->pinned_vm -= event->mmap_locked;
35483548 rcu_assign_pointer(event->rb, NULL);
35493549 mutex_unlock(&event->mmap_mutex);
35503550
@@ -3625,7 +3625,7 @@ static int perf_mmap(struct file *file, struct vm_area_struct *vma) · 74 unmodified lines
36253625
36263626 lock_limit = rlimit(RLIMIT_MEMLOCK);
36273627 lock_limit >>= PAGE_SHIFT;
3628− locked = vma->vm_mm->locked_vm + extra;
3628+ locked = vma->vm_mm->pinned_vm + extra;
36293629
36303630 if ((locked > lock_limit) && perf_paranoid_tracepoint_raw() &&
36313631 !capable(CAP_IPC_LOCK)) {
@@ -3651,7 +3651,7 @@ static int perf_mmap(struct file *file, struct vm_area_struct *vma) · 19 unmodified lines
36513651 atomic_long_add(user_extra, &user->locked_vm);
36523652 event->mmap_locked = extra;
36533653 event->mmap_user = get_current_user();
3654− vma->vm_mm->locked_vm += event->mmap_locked;
3654+ vma->vm_mm->pinned_vm += event->mmap_locked;
36553655
36563656 unlock:
36573657 if (!ret)
kernel/exit.c+0−2
@@ -681,8 +681,6 @@ static void exit_mm(struct task_struct * tsk) · 680 unmodified lines
681681 enter_lazy_tlb(mm, current);
682682 /* We don't want this task to be frozen prematurely */
683683 clear_freeze_flag(tsk);
684− if (tsk->signal->oom_score_adj == OOM_SCORE_ADJ_MIN)
685− atomic_dec(&mm->oom_disable_count);
686684 task_unlock(tsk);
687685 mm_update_next_owner(mm);
688686 mmput(mm);
kernel/fork.c+1−9
@@ -501,7 +501,6 @@ static struct mm_struct *mm_init(struct mm_struct *mm, struct task_struct *p) · 500 unmodified lines
501501 mm->cached_hole_size = ~0UL;
502502 mm_init_aio(mm);
503503 mm_init_owner(mm, p);
504− atomic_set(&mm->oom_disable_count, 0);
505504
506505 if (likely(!mm_alloc_pgd(mm))) {
507506 mm->def_flags = 0;
@@ -816,8 +815,6 @@ good_mm: · 308 unmodified lines
816815 /* Initializing for Swap token stuff */
817816 mm->token_priority = 0;
818817 mm->last_interval = 0;
819− if (tsk->signal->oom_score_adj == OOM_SCORE_ADJ_MIN)
820− atomic_inc(&mm->oom_disable_count);
821818
822819 tsk->mm = mm;
823820 tsk->active_mm = mm;
@@ -1391,13 +1388,8 @@ bad_fork_cleanup_io: · 567 unmodified lines
13911388 bad_fork_cleanup_namespaces:
13921389 exit_task_namespaces(p);
13931390 bad_fork_cleanup_mm:
1394− if (p->mm) {
1395− task_lock(p);
1396− if (p->signal->oom_score_adj == OOM_SCORE_ADJ_MIN)
1397− atomic_dec(&p->mm->oom_disable_count);
1398− task_unlock(p);
1391+ if (p->mm)
13991392 mmput(p->mm);
1400− }
14011393 bad_fork_cleanup_signal:
14021394 if (!(clone_flags & CLONE_THREAD))
14031395 free_signal_struct(p->signal);
kernel/printk.c+7−3
@@ -532,6 +532,9 @@ static int __init ignore_loglevel_setup(char *str) · 531 unmodified lines
532532 }
533533
534534 early_param("ignore_loglevel", ignore_loglevel_setup);
535+module_param_named(ignore_loglevel, ignore_loglevel, bool, S_IRUGO | S_IWUSR);
536+MODULE_PARM_DESC(ignore_loglevel, "ignore loglevel setting, to"
537+ "print all kernel messages to the console.");
535538
536539 /*
537540 * Write out chars from start to end - 1 inclusive
@@ -592,9 +595,6 @@ static size_t log_prefix(const char *p, unsigned int *level, char *special) · 54 unmodified lines
592595 /* multi digit including the level and facility number */
593596 char *endp = NULL;
594597
595− if (p[1] < '0' && p[1] > '9')
596− return 0;
597−
598598 lev = (simple_strtoul(&p[1], &endp, 10) & 7);
599599 if (endp == NULL || endp[0] != '>')
600600 return 0;
@@ -1108,6 +1108,10 @@ static int __init console_suspend_disable(char *str) · 507 unmodified lines
11081108 return 1;
11091109 }
11101110 __setup("no_console_suspend", console_suspend_disable);
1111+module_param_named(console_suspend, console_suspend_enabled,
1112+ bool, S_IRUGO | S_IWUSR);
1113+MODULE_PARM_DESC(console_suspend, "suspend console during suspend"
1114+ " and hibernate operations");
11111115
11121116 /**
11131117 * suspend_console - suspend the console subsystem
kernel/stop_machine.c+22−0
@@ -41,6 +41,7 @@ struct cpu_stopper { · 40 unmodified lines
4141 };
4242
4343 static DEFINE_PER_CPU(struct cpu_stopper, cpu_stopper);
44+static bool stop_machine_initialized = false;
4445
4546 static void cpu_stop_init_done(struct cpu_stop_done *done, unsigned int nr_todo)
4647 {
@@ -386,6 +387,8 @@ static int __init cpu_stop_init(void) · 339 unmodified lines
386387 cpu_stop_cpu_callback(&cpu_stop_cpu_notifier, CPU_ONLINE, bcpu);
387388 register_cpu_notifier(&cpu_stop_cpu_notifier);
388389
390+ stop_machine_initialized = true;
391+
389392 return 0;
390393 }
391394 early_initcall(cpu_stop_init);
@@ -485,6 +488,25 @@ int __stop_machine(int (*fn)(void *), void *data, const struct cpumask *cpus) · 93 unmodified lines
485488 .num_threads = num_online_cpus(),
486489 .active_cpus = cpus };
487490
491+ if (!stop_machine_initialized) {
492+ /*
493+ * Handle the case where stop_machine() is called
494+ * early in boot before stop_machine() has been
495+ * initialized.
496+ */
497+ unsigned long flags;
498+ int ret;
499+
500+ WARN_ON_ONCE(smdata.num_threads != 1);
501+
502+ local_irq_save(flags);
503+ hard_irq_disable();
504+ ret = (*fn)(data);
505+ local_irq_restore(flags);
506+
507+ return ret;
508+ }
509+
488510 /* Set the initial state and stop all online cpus. */
489511 set_state(&smdata, STOPMACHINE_PREPARE);
490512 return stop_cpus(cpu_online_mask, stop_machine_cpu_stop, &smdata);
kernel/sys_ni.c+4−0
@@ -145,6 +145,10 @@ cond_syscall(sys_io_submit); · 144 unmodified lines
145145 cond_syscall(sys_io_cancel);
146146 cond_syscall(sys_io_getevents);
147147 cond_syscall(sys_syslog);
148+cond_syscall(sys_process_vm_readv);
149+cond_syscall(sys_process_vm_writev);
150+cond_syscall(compat_sys_process_vm_readv);
151+cond_syscall(compat_sys_process_vm_writev);
148152
149153 /* arch-specific weak syscall entries */
150154 cond_syscall(sys_pciconfig_read);
kernel/sysctl.c+9−0
@@ -57,6 +57,7 @@ · 56 unmodified lines
5757 #include <linux/pipe_fs_i.h>
5858 #include <linux/oom.h>
5959 #include <linux/kmod.h>
60+#include <linux/capability.h>
6061
6162 #include <asm/uaccess.h>
6263 #include <asm/processor.h>
@@ -134,6 +135,7 @@ static int minolduid; · 71 unmodified lines
134135 static int min_percpu_pagelist_fract = 8;
135136
136137 static int ngroups_max = NGROUPS_MAX;
138+static const int cap_last_cap = CAP_LAST_CAP;
137139
138140 #ifdef CONFIG_INOTIFY_USER
139141 #include <linux/inotify.h>
@@ -732,6 +734,13 @@ static struct ctl_table kern_table[] = { · 592 unmodified lines
732734 .mode = 0444,
733735 .proc_handler = proc_dointvec,
734736 },
737+ {
738+ .procname = "cap_last_cap",
739+ .data = (void *)&cap_last_cap,
740+ .maxlen = sizeof(int),
741+ .mode = 0444,
742+ .proc_handler = proc_dointvec,
743+ },
735744 #if defined(CONFIG_LOCKUP_DETECTOR)
736745 {
737746 .procname = "watchdog",
kernel/watchdog.c+2−2
@@ -481,6 +481,8 @@ static void watchdog_disable(int cpu) · 480 unmodified lines
481481 }
482482 }
483483
484+/* sysctl functions */
485+#ifdef CONFIG_SYSCTL
484486 static void watchdog_enable_all_cpus(void)
485487 {
486488 int cpu;
@@ -510,8 +512,6 @@ static void watchdog_disable_all_cpus(void) · 23 unmodified lines
510512 }
511513
512514
513−/* sysctl functions */
514−#ifdef CONFIG_SYSCTL
515515 /*
516516 * proc handler for /proc/sys/kernel/nmi_watchdog,watchdog_thresh
517517 */
lib/Kconfig.debug+3−2
@@ -248,8 +248,9 @@ config DEFAULT_HUNG_TASK_TIMEOUT · 247 unmodified lines
248248 to determine when a task has become non-responsive and should
249249 be considered hung.
250250
251− It can be adjusted at runtime via the kernel.hung_task_timeout
252− sysctl or by writing a value to /proc/sys/kernel/hung_task_timeout.
251+ It can be adjusted at runtime via the kernel.hung_task_timeout_secs
252+ sysctl or by writing a value to
253+ /proc/sys/kernel/hung_task_timeout_secs.
253254
254255 A timeout of 0 disables the check. The default is two minutes.
255256 Keeping the default should be fine in most cases.
lib/bitmap.c+6−4
@@ -419,7 +419,7 @@ int __bitmap_parse(const char *buf, unsigned int buflen, · 418 unmodified lines
419419 {
420420 int c, old_c, totaldigits, ndigits, nchunks, nbits;
421421 u32 chunk;
422− const char __user *ubuf = buf;
422+ const char __user __force *ubuf = (const char __user __force *)buf;
423423
424424 bitmap_zero(maskp, nmaskbits);
425425
@@ -504,7 +504,9 @@ int bitmap_parse_user(const char __user *ubuf, · 78 unmodified lines
504504 {
505505 if (!access_ok(VERIFY_READ, ubuf, ulen))
506506 return -EFAULT;
507− return __bitmap_parse((const char *)ubuf, ulen, 1, maskp, nmaskbits);
507+ return __bitmap_parse((const char __force *)ubuf,
508+ ulen, 1, maskp, nmaskbits);
509+
508510 }
509511 EXPORT_SYMBOL(bitmap_parse_user);
510512
@@ -594,7 +596,7 @@ static int __bitmap_parselist(const char *buf, unsigned int buflen, · 83 unmodified lines
594596 {
595597 unsigned a, b;
596598 int c, old_c, totaldigits;
597− const char __user *ubuf = buf;
599+ const char __user __force *ubuf = (const char __user __force *)buf;
598600 int exp_digit, in_range;
599601
600602 totaldigits = c = 0;
@@ -694,7 +696,7 @@ int bitmap_parselist_user(const char __user *ubuf, · 93 unmodified lines
694696 {
695697 if (!access_ok(VERIFY_READ, ubuf, ulen))
696698 return -EFAULT;
697− return __bitmap_parselist((const char *)ubuf,
699+ return __bitmap_parselist((const char __force *)ubuf,
698700 ulen, 1, maskp, nmaskbits);
699701 }
700702 EXPORT_SYMBOL(bitmap_parselist_user);
lib/idr.c+2−2
@@ -767,8 +767,8 @@ EXPORT_SYMBOL(ida_pre_get); · 766 unmodified lines
767767 * @starting_id: id to start search at
768768 * @p_id: pointer to the allocated handle
769769 *
770− * Allocate new ID above or equal to @ida. It should be called with
771− * any required locks.
770+ * Allocate new ID above or equal to @starting_id. It should be called
771+ * with any required locks.
772772 *
773773 * If memory is required, it will return %-EAGAIN, you should unlock
774774 * and go back to the ida_pre_get() call. If the ida is full, it will
lib/kstrtox.c+53−22
@@ -18,26 +18,40 @@ · 17 unmodified lines
1818 #include <linux/module.h>
1919 #include <linux/types.h>
2020 #include <asm/uaccess.h>
21+#include "kstrtox.h"
2122
22−static int _kstrtoull(const char *s, unsigned int base, unsigned long long *res)
23+const char *_parse_integer_fixup_radix(const char *s, unsigned int *base)
2324 {
24− unsigned long long acc;
25− int ok;
26−
27− if (base == 0) {
25+ if (*base == 0) {
2826 if (s[0] == '0') {
2927 if (_tolower(s[1]) == 'x' && isxdigit(s[2]))
30− base = 16;
28+ *base = 16;
3129 else
32− base = 8;
30+ *base = 8;
3331 } else
34− base = 10;
32+ *base = 10;
3533 }
36− if (base == 16 && s[0] == '0' && _tolower(s[1]) == 'x')
34+ if (*base == 16 && s[0] == '0' && _tolower(s[1]) == 'x')
3735 s += 2;
36+ return s;
37+}
3838
39− acc = 0;
40− ok = 0;
39+/*
40+ * Convert non-negative integer string representation in explicitly given radix
41+ * to an integer.
42+ * Return number of characters consumed maybe or-ed with overflow bit.
43+ * If overflow occurs, result integer (incorrect) is still returned.
44+ *
45+ * Don't you dare use this function.
46+ */
47+unsigned int _parse_integer(const char *s, unsigned int base, unsigned long long *res)
48+{
49+ unsigned int rv;
50+ int overflow;
51+
52+ *res = 0;
53+ rv = 0;
54+ overflow = 0;
4155 while (*s) {
4256 unsigned int val;
4357
@@ -45,23 +59,40 @@ static int _kstrtoull(const char *s, unsigned int base, unsigned long long *res) · 1 unmodified line
4559 val = *s - '0';
4660 else if ('a' <= _tolower(*s) && _tolower(*s) <= 'f')
4761 val = _tolower(*s) - 'a' + 10;
48− else if (*s == '\n' && *(s + 1) == '\0')
49− break;
5062 else
51− return -EINVAL;
63+ break;
5264
5365 if (val >= base)
54− return -EINVAL;
55− if (acc > div_u64(ULLONG_MAX - val, base))
56− return -ERANGE;
57− acc = acc * base + val;
58− ok = 1;
59−
66+ break;
67+ if (*res > div_u64(ULLONG_MAX - val, base))
68+ overflow = 1;
69+ *res = *res * base + val;
70+ rv++;
6071 s++;
6172 }
62− if (!ok)
73+ if (overflow)
74+ rv |= KSTRTOX_OVERFLOW;
75+ return rv;
76+}
77+
78+static int _kstrtoull(const char *s, unsigned int base, unsigned long long *res)
79+{
80+ unsigned long long _res;
81+ unsigned int rv;
82+
83+ s = _parse_integer_fixup_radix(s, &base);
84+ rv = _parse_integer(s, base, &_res);
85+ if (rv & KSTRTOX_OVERFLOW)
86+ return -ERANGE;
87+ rv &= ~KSTRTOX_OVERFLOW;
88+ if (rv == 0)
89+ return -EINVAL;
90+ s += rv;
91+ if (*s == '\n')
92+ s++;
93+ if (*s)
6394 return -EINVAL;
64− *res = acc;
95+ *res = _res;
6596 return 0;
6697 }
6798
lib/kstrtox.h+8−0
@@ -0,0 +1,8 @@
1+#ifndef _LIB_KSTRTOX_H
2+#define _LIB_KSTRTOX_H
3+
4+#define KSTRTOX_OVERFLOW (1U << 31)
5+const char *_parse_integer_fixup_radix(const char *s, unsigned int *base);
6+unsigned int _parse_integer(const char *s, unsigned int base, unsigned long long *res);
7+
8+#endif
lib/percpu_counter.c+2−0
@@ -10,8 +10,10 @@ · 9 unmodified lines
1010 #include <linux/module.h>
1111 #include <linux/debugobjects.h>
1212
13+#ifdef CONFIG_HOTPLUG_CPU
1314 static LIST_HEAD(percpu_counters);
1415 static DEFINE_MUTEX(percpu_counters_lock);
16+#endif
1517
1618 #ifdef CONFIG_DEBUG_OBJECTS_PERCPU_COUNTER
1719
lib/radix-tree.c+2−8
@@ -576,7 +576,6 @@ int radix_tree_tag_get(struct radix_tree_root *root, · 575 unmodified lines
576576 {
577577 unsigned int height, shift;
578578 struct radix_tree_node *node;
579− int saw_unset_tag = 0;
580579
581580 /* check the root's tag bit */
582581 if (!root_tag_get(root, tag))
@@ -603,15 +602,10 @@ int radix_tree_tag_get(struct radix_tree_root *root, · 20 unmodified lines
603602 return 0;
604603
605604 offset = (index >> shift) & RADIX_TREE_MAP_MASK;
606−
607− /*
608− * This is just a debug check. Later, we can bale as soon as
609− * we see an unset tag.
610− */
611605 if (!tag_get(node, tag, offset))
612− saw_unset_tag = 1;
606+ return 0;
613607 if (height == 1)
614− return !!tag_get(node, tag, offset);
608+ return 1;
615609 node = rcu_dereference_raw(node->slots[offset]);
616610 shift -= RADIX_TREE_MAP_SHIFT;
617611 height--;
lib/spinlock_debug.c+10−9
@@ -49,13 +49,10 @@ void __rwlock_init(rwlock_t *lock, const char *name, · 48 unmodified lines
4949
5050 EXPORT_SYMBOL(__rwlock_init);
5151
52−static void spin_bug(raw_spinlock_t *lock, const char *msg)
52+static void spin_dump(raw_spinlock_t *lock, const char *msg)
5353 {
5454 struct task_struct *owner = NULL;
5555
56− if (!debug_locks_off())
57− return;
58−
5956 if (lock->owner && lock->owner != SPINLOCK_OWNER_INIT)
6057 owner = lock->owner;
6158 printk(KERN_EMERG "BUG: spinlock %s on CPU#%d, %s/%d\n",
@@ -70,6 +67,14 @@ static void spin_bug(raw_spinlock_t *lock, const char *msg) · 8 unmodified lines
7067 dump_stack();
7168 }
7269
70+static void spin_bug(raw_spinlock_t *lock, const char *msg)
71+{
72+ if (!debug_locks_off())
73+ return;
74+
75+ spin_dump(lock, msg);
76+}
77+
7378 #define SPIN_BUG_ON(cond, lock, msg) if (unlikely(cond)) spin_bug(lock, msg)
7479
7580 static inline void
@@ -113,11 +118,7 @@ static void __spin_lock_debug(raw_spinlock_t *lock) · 37 unmodified lines
113118 /* lockup suspected: */
114119 if (print_once) {
115120 print_once = 0;
116− printk(KERN_EMERG "BUG: spinlock lockup on CPU#%d, "
117− "%s/%d, %p\n",
118− raw_smp_processor_id(), current->comm,
119− task_pid_nr(current), lock);
120− dump_stack();
121+ spin_dump(lock, "lockup");
121122 #ifdef CONFIG_SMP
122123 trigger_all_cpu_backtrace();
123124 #endif
lib/string.c+55−2
@@ -360,7 +360,6 @@ char *strim(char *s) · 359 unmodified lines
360360 size_t size;
361361 char *end;
362362
363− s = skip_spaces(s);
364363 size = strlen(s);
365364 if (!size)
366365 return s;
@@ -370,7 +369,7 @@ char *strim(char *s) · 3 unmodified lines
370369 end--;
371370 *(end + 1) = '\0';
372371
373− return s;
372+ return skip_spaces(s);
374373 }
375374 EXPORT_SYMBOL(strim);
376375
@@ -756,3 +755,57 @@ void *memchr(const void *s, int c, size_t n) · 379 unmodified lines
756755 }
757756 EXPORT_SYMBOL(memchr);
758757 #endif
758+
759+static void *check_bytes8(const u8 *start, u8 value, unsigned int bytes)
760+{
761+ while (bytes) {
762+ if (*start != value)
763+ return (void *)start;
764+ start++;
765+ bytes--;
766+ }
767+ return NULL;
768+}
769+
770+/**
771+ * memchr_inv - Find an unmatching character in an area of memory.
772+ * @start: The memory area
773+ * @c: Find a character other than c
774+ * @bytes: The size of the area.
775+ *
776+ * returns the address of the first character other than @c, or %NULL
777+ * if the whole buffer contains just @c.
778+ */
779+void *memchr_inv(const void *start, int c, size_t bytes)
780+{
781+ u8 value = c;
782+ u64 value64;
783+ unsigned int words, prefix;
784+
785+ if (bytes <= 16)
786+ return check_bytes8(start, value, bytes);
787+
788+ value64 = value | value << 8 | value << 16 | value << 24;
789+ value64 = (value64 & 0xffffffff) | value64 << 32;
790+ prefix = 8 - ((unsigned long)start) % 8;
791+
792+ if (prefix) {
793+ u8 *r = check_bytes8(start, value, prefix);
794+ if (r)
795+ return r;
796+ start += prefix;
797+ bytes -= prefix;
798+ }
799+
800+ words = bytes / 8;
801+
802+ while (words) {
803+ if (*(u64 *)start != value64)
804+ return check_bytes8(start, value, 8);
805+ start += 8;
806+ words--;
807+ }
808+
809+ return check_bytes8(start, value, bytes % 8);
810+}
811+EXPORT_SYMBOL(memchr_inv);
lib/vsprintf.c+14−33
@@ -31,17 +31,7 @@ · 30 unmodified lines
3131 #include <asm/div64.h>
3232 #include <asm/sections.h> /* for dereference_function_descriptor() */
3333
34−static unsigned int simple_guess_base(const char *cp)
35−{
36− if (cp[0] == '0') {
37− if (_tolower(cp[1]) == 'x' && isxdigit(cp[2]))
38− return 16;
39− else
40− return 8;
41− } else {
42− return 10;
43− }
44−}
34+#include "kstrtox.h"
4535
4636 /**
4737 * simple_strtoull - convert a string to an unsigned long long
@@ -51,23 +41,14 @@ static unsigned int simple_guess_base(const char *cp) · 3 unmodified lines
5141 */
5242 unsigned long long simple_strtoull(const char *cp, char **endp, unsigned int base)
5343 {
54− unsigned long long result = 0;
44+ unsigned long long result;
45+ unsigned int rv;
5546
56− if (!base)
57− base = simple_guess_base(cp);
47+ cp = _parse_integer_fixup_radix(cp, &base);
48+ rv = _parse_integer(cp, base, &result);
49+ /* FIXME */
50+ cp += (rv & ~KSTRTOX_OVERFLOW);
5851
59− if (base == 16 && cp[0] == '0' && _tolower(cp[1]) == 'x')
60− cp += 2;
61−
62− while (isxdigit(*cp)) {
63− unsigned int value;
64−
65− value = isdigit(*cp) ? *cp - '0' : _tolower(*cp) - 'a' + 10;
66− if (value >= base)
67− break;
68− result = result * base + value;
69− cp++;
70− }
7152 if (endp)
7253 *endp = (char *)cp;
7354
@@ -566,7 +547,7 @@ char *mac_address_string(char *buf, char *end, u8 *addr, · 492 unmodified lines
566547 }
567548
568549 for (i = 0; i < 6; i++) {
569− p = pack_hex_byte(p, addr[i]);
550+ p = hex_byte_pack(p, addr[i]);
570551 if (fmt[0] == 'M' && i != 5)
571552 *p++ = separator;
572553 }
@@ -686,13 +667,13 @@ char *ip6_compressed_string(char *p, const char *addr) · 113 unmodified lines
686667 lo = word & 0xff;
687668 if (hi) {
688669 if (hi > 0x0f)
689− p = pack_hex_byte(p, hi);
670+ p = hex_byte_pack(p, hi);
690671 else
691672 *p++ = hex_asc_lo(hi);
692− p = pack_hex_byte(p, lo);
673+ p = hex_byte_pack(p, lo);
693674 }
694675 else if (lo > 0x0f)
695− p = pack_hex_byte(p, lo);
676+ p = hex_byte_pack(p, lo);
696677 else
697678 *p++ = hex_asc_lo(lo);
698679 needcolon = true;
@@ -714,8 +695,8 @@ char *ip6_string(char *p, const char *addr, const char *fmt) · 15 unmodified lines
714695 int i;
715696
716697 for (i = 0; i < 8; i++) {
717− p = pack_hex_byte(p, *addr++);
718− p = pack_hex_byte(p, *addr++);
698+ p = hex_byte_pack(p, *addr++);
699+ p = hex_byte_pack(p, *addr++);
719700 if (fmt[0] == 'I' && i != 7)
720701 *p++ = ':';
721702 }
@@ -773,7 +754,7 @@ char *uuid_string(char *buf, char *end, const u8 *addr, · 51 unmodified lines
773754 }
774755
775756 for (i = 0; i < 16; i++) {
776− p = pack_hex_byte(p, addr[index[i]]);
757+ p = hex_byte_pack(p, addr[index[i]]);
777758 switch (i) {
778759 case 3:
779760 case 5:
mm/Kconfig+3−0
@@ -131,6 +131,9 @@ config SPARSEMEM_VMEMMAP · 130 unmodified lines
131131 config HAVE_MEMBLOCK
132132 boolean
133133
134+config NO_BOOTMEM
135+ boolean
136+
134137 # eventually, we can have this option just 'select SPARSEMEM'
135138 config MEMORY_HOTPLUG
136139 bool "Allow for memory hot-add"
mm/Makefile+2−1
@@ -5,7 +5,8 @@ · 4 unmodified lines
55 mmu-y := nommu.o
66 mmu-$(CONFIG_MMU) := fremap.o highmem.o madvise.o memory.o mincore.o \
77 mlock.o mmap.o mprotect.o mremap.o msync.o rmap.o \
8− vmalloc.o pagewalk.o pgtable-generic.o
8+ vmalloc.o pagewalk.o pgtable-generic.o \
9+ process_vm_access.o
910
1011 obj-y := filemap.o mempool.o oom_kill.o fadvise.o \
1112 maccess.o page_alloc.o page-writeback.o \
mm/backing-dev.c+2−3
@@ -404,9 +404,8 @@ static int bdi_forker_thread(void *ptr) · 403 unmodified lines
404404 /*
405405 * In the following loop we are going to check whether we have
406406 * some work to do without any synchronization with tasks
407− * waking us up to do work for them. So we have to set task
408− * state already here so that we don't miss wakeups coming
409− * after we verify some condition.
407+ * waking us up to do work for them. Set the task state here
408+ * so that we don't miss wakeups after verifying conditions.
410409 */
411410 set_current_state(TASK_INTERRUPTIBLE);
412411
mm/compaction.c+11−15
@@ -35,10 +35,6 @@ struct compact_control { · 34 unmodified lines
3535 unsigned long migrate_pfn; /* isolate_migratepages search base */
3636 bool sync; /* Synchronous migration */
3737
38− /* Account for isolated anon and file pages */
39− unsigned long nr_anon;
40− unsigned long nr_file;
41−
4238 unsigned int order; /* order a direct compactor needs */
4339 int migratetype; /* MOVABLE, RECLAIMABLE etc */
4440 struct zone *zone;
@@ -223,17 +219,13 @@ static void isolate_freepages(struct zone *zone, · 178 unmodified lines
223219 static void acct_isolated(struct zone *zone, struct compact_control *cc)
224220 {
225221 struct page *page;
226− unsigned int count[NR_LRU_LISTS] = { 0, };
222+ unsigned int count[2] = { 0, };
227223
228− list_for_each_entry(page, &cc->migratepages, lru) {
229− int lru = page_lru_base_type(page);
230− count[lru]++;
231− }
224+ list_for_each_entry(page, &cc->migratepages, lru)
225+ count[!!page_is_file_cache(page)]++;
232226
233− cc->nr_anon = count[LRU_ACTIVE_ANON] + count[LRU_INACTIVE_ANON];
234− cc->nr_file = count[LRU_ACTIVE_FILE] + count[LRU_INACTIVE_FILE];
235− __mod_zone_page_state(zone, NR_ISOLATED_ANON, cc->nr_anon);
236− __mod_zone_page_state(zone, NR_ISOLATED_FILE, cc->nr_file);
227+ __mod_zone_page_state(zone, NR_ISOLATED_ANON, count[0]);
228+ __mod_zone_page_state(zone, NR_ISOLATED_FILE, count[1]);
237229 }
238230
239231 /* Similar to reclaim, but different enough that they don't share logic */
@@ -269,6 +261,7 @@ static isolate_migrate_t isolate_migratepages(struct zone *zone, · 29 unmodified lines
269261 unsigned long last_pageblock_nr = 0, pageblock_nr;
270262 unsigned long nr_scanned = 0, nr_isolated = 0;
271263 struct list_head *migratelist = &cc->migratepages;
264+ isolate_mode_t mode = ISOLATE_ACTIVE|ISOLATE_INACTIVE;
272265
273266 /* Do not scan outside zone boundaries */
274267 low_pfn = max(cc->migrate_pfn, zone->zone_start_pfn);
@@ -356,8 +349,11 @@ static isolate_migrate_t isolate_migratepages(struct zone *zone, · 81 unmodified lines
356349 continue;
357350 }
358351
352+ if (!cc->sync)
353+ mode |= ISOLATE_CLEAN;
354+
359355 /* Try isolate the page */
360− if (__isolate_lru_page(page, ISOLATE_BOTH, 0) != 0)
356+ if (__isolate_lru_page(page, mode, 0) != 0)
361357 continue;
362358
363359 VM_BUG_ON(PageTransCompound(page));
@@ -586,7 +582,7 @@ out: · 222 unmodified lines
586582 return ret;
587583 }
588584
589−unsigned long compact_zone_order(struct zone *zone,
585+static unsigned long compact_zone_order(struct zone *zone,
590586 int order, gfp_t gfp_mask,
591587 bool sync)
592588 {
mm/debug-pagealloc.c+16−40
@@ -1,7 +1,10 @@
11 #include <linux/kernel.h>
2+#include <linux/string.h>
23 #include <linux/mm.h>
4+#include <linux/highmem.h>
35 #include <linux/page-debug-flags.h>
46 #include <linux/poison.h>
7+#include <linux/ratelimit.h>
58
69 static inline void set_page_poison(struct page *page)
710 {
@@ -18,28 +21,13 @@ static inline bool page_poison(struct page *page) · 10 unmodified lines
1821 return test_bit(PAGE_DEBUG_FLAG_POISON, &page->debug_flags);
1922 }
2023
21−static void poison_highpage(struct page *page)
22−{
23− /*
24− * Page poisoning for highmem pages is not implemented.
25− *
26− * This can be called from interrupt contexts.
27− * So we need to create a new kmap_atomic slot for this
28− * application and it will need interrupt protection.
29− */
30−}
31−
3224 static void poison_page(struct page *page)
3325 {
34− void *addr;
26+ void *addr = kmap_atomic(page);
3527
36− if (PageHighMem(page)) {
37− poison_highpage(page);
38− return;
39− }
4028 set_page_poison(page);
41− addr = page_address(page);
4229 memset(addr, PAGE_POISON, PAGE_SIZE);
30+ kunmap_atomic(addr);
4331 }
4432
4533 static void poison_pages(struct page *page, int n)
@@ -59,14 +47,12 @@ static bool single_bit_flip(unsigned char a, unsigned char b) · 13 unmodified lines
5947
6048 static void check_poison_mem(unsigned char *mem, size_t bytes)
6149 {
50+ static DEFINE_RATELIMIT_STATE(ratelimit, 5 * HZ, 10);
6251 unsigned char *start;
6352 unsigned char *end;
6453
65− for (start = mem; start < mem + bytes; start++) {
66− if (*start != PAGE_POISON)
67− break;
68− }
69− if (start == mem + bytes)
54+ start = memchr_inv(mem, PAGE_POISON, bytes);
55+ if (!start)
7056 return;
7157
7258 for (end = mem + bytes - 1; end > start; end--) {
@@ -74,7 +60,7 @@ static void check_poison_mem(unsigned char *mem, size_t bytes) · 1 unmodified line
7460 break;
7561 }
7662
77− if (!printk_ratelimit())
63+ if (!__ratelimit(&ratelimit))
7864 return;
7965 else if (start == end && single_bit_flip(*start, PAGE_POISON))
8066 printk(KERN_ERR "pagealloc: single bit error\n");
@@ -86,27 +72,17 @@ static void check_poison_mem(unsigned char *mem, size_t bytes) · 5 unmodified lines
8672 dump_stack();
8773 }
8874
89−static void unpoison_highpage(struct page *page)
90−{
91− /*
92− * See comment in poison_highpage().
93− * Highmem pages should not be poisoned for now
94− */
95− BUG_ON(page_poison(page));
96−}
97−
9875 static void unpoison_page(struct page *page)
9976 {
100− if (PageHighMem(page)) {
101− unpoison_highpage(page);
77+ void *addr;
78+
79+ if (!page_poison(page))
10280 return;
103− }
104− if (page_poison(page)) {
105− void *addr = page_address(page);
10681
107− check_poison_mem(addr, PAGE_SIZE);
108− clear_page_poison(page);
109− }
82+ addr = kmap_atomic(page);
83+ check_poison_mem(addr, PAGE_SIZE);
84+ clear_page_poison(page);
85+ kunmap_atomic(addr);
11086 }
11187
11288 static void unpoison_pages(struct page *page, int n)
mm/highmem.c+1−1
@@ -250,7 +250,7 @@ void *kmap_high_get(struct page *page) · 249 unmodified lines
250250 #endif
251251
252252 /**
253− * kunmap_high - map a highmem page into memory
253+ * kunmap_high - unmap a highmem page into memory
254254 * @page: &struct page to unmap
255255 *
256256 * If ARCH_NEEDS_KMAP_HIGH_GET is not defined then this may be called
mm/huge_memory.c+51−3
@@ -89,7 +89,8 @@ struct khugepaged_scan { · 88 unmodified lines
8989 struct list_head mm_head;
9090 struct mm_slot *mm_slot;
9191 unsigned long address;
92−} khugepaged_scan = {
92+};
93+static struct khugepaged_scan khugepaged_scan = {
9394 .mm_head = LIST_HEAD_INIT(khugepaged_scan.mm_head),
9495 };
9596
@@ -829,7 +830,7 @@ static int do_huge_pmd_wp_page_fallback(struct mm_struct *mm, · 733 unmodified lines
829830
830831 for (i = 0; i < HPAGE_PMD_NR; i++) {
831832 copy_user_highpage(pages[i], page + i,
832− haddr + PAGE_SHIFT*i, vma);
833+ haddr + PAGE_SIZE * i, vma);
833834 __SetPageUptodate(pages[i]);
834835 cond_resched();
835836 }
@@ -1052,6 +1053,51 @@ int mincore_huge_pmd(struct vm_area_struct *vma, pmd_t *pmd, · 216 unmodified lines
10521053 return ret;
10531054 }
10541055
1056+int move_huge_pmd(struct vm_area_struct *vma, struct vm_area_struct *new_vma,
1057+ unsigned long old_addr,
1058+ unsigned long new_addr, unsigned long old_end,
1059+ pmd_t *old_pmd, pmd_t *new_pmd)
1060+{
1061+ int ret = 0;
1062+ pmd_t pmd;
1063+
1064+ struct mm_struct *mm = vma->vm_mm;
1065+
1066+ if ((old_addr & ~HPAGE_PMD_MASK) ||
1067+ (new_addr & ~HPAGE_PMD_MASK) ||
1068+ old_end - old_addr < HPAGE_PMD_SIZE ||
1069+ (new_vma->vm_flags & VM_NOHUGEPAGE))
1070+ goto out;
1071+
1072+ /*
1073+ * The destination pmd shouldn't be established, free_pgtables()
1074+ * should have release it.
1075+ */
1076+ if (WARN_ON(!pmd_none(*new_pmd))) {
1077+ VM_BUG_ON(pmd_trans_huge(*new_pmd));
1078+ goto out;
1079+ }
1080+
1081+ spin_lock(&mm->page_table_lock);
1082+ if (likely(pmd_trans_huge(*old_pmd))) {
1083+ if (pmd_trans_splitting(*old_pmd)) {
1084+ spin_unlock(&mm->page_table_lock);
1085+ wait_split_huge_page(vma->anon_vma, old_pmd);
1086+ ret = -1;
1087+ } else {
1088+ pmd = pmdp_get_and_clear(mm, old_addr, old_pmd);
1089+ VM_BUG_ON(!pmd_none(*new_pmd));
1090+ set_pmd_at(mm, new_addr, new_pmd, pmd);
1091+ spin_unlock(&mm->page_table_lock);
1092+ ret = 1;
1093+ }
1094+ } else {
1095+ spin_unlock(&mm->page_table_lock);
1096+ }
1097+out:
1098+ return ret;
1099+}
1100+
10551101 int change_huge_pmd(struct vm_area_struct *vma, pmd_t *pmd,
10561102 unsigned long addr, pgprot_t newprot)
10571103 {
@@ -1906,7 +1952,7 @@ static void collapse_huge_page(struct mm_struct *mm, · 848 unmodified lines
19061952 BUG_ON(!pmd_none(*pmd));
19071953 page_add_new_anon_rmap(new_page, vma, address);
19081954 set_pmd_at(mm, address, pmd, _pmd);
1909− update_mmu_cache(vma, address, entry);
1955+ update_mmu_cache(vma, address, _pmd);
19101956 prepare_pmd_huge_pte(pgtable, mm);
19111957 mm->nr_ptes--;
19121958 spin_unlock(&mm->page_table_lock);
@@ -2024,6 +2070,8 @@ static void collect_mm_slot(struct mm_slot *mm_slot) · 111 unmodified lines
20242070
20252071 static unsigned int khugepaged_scan_mm_slot(unsigned int pages,
20262072 struct page **hpage)
2073+ __releases(&khugepaged_mm_lock)
2074+ __acquires(&khugepaged_mm_lock)
20272075 {
20282076 struct mm_slot *mm_slot;
20292077 struct mm_struct *mm;
mm/ksm.c+2−1
@@ -1905,7 +1905,8 @@ static ssize_t run_store(struct kobject *kobj, struct kobj_attribute *attr, · 1904 unmodified lines
19051905
19061906 oom_score_adj = test_set_oom_score_adj(OOM_SCORE_ADJ_MAX);
19071907 err = unmerge_and_remove_all_rmap_items();
1908− test_set_oom_score_adj(oom_score_adj);
1908+ compare_swap_oom_score_adj(OOM_SCORE_ADJ_MAX,
1909+ oom_score_adj);
19091910 if (err) {
19101911 ksm_run = KSM_RUN_STOP;
19111912 count = err;
mm/memblock.c+9−2
@@ -58,7 +58,8 @@ static unsigned long __init_memblock memblock_addrs_overlap(phys_addr_t base1, p · 57 unmodified lines
5858 return ((base1 < (base2 + size2)) && (base2 < (base1 + size1)));
5959 }
6060
61−long __init_memblock memblock_overlaps_region(struct memblock_type *type, phys_addr_t base, phys_addr_t size)
61+static long __init_memblock memblock_overlaps_region(struct memblock_type *type,
62+ phys_addr_t base, phys_addr_t size)
6263 {
6364 unsigned long i;
6465
@@ -267,7 +268,7 @@ static int __init_memblock memblock_double_array(struct memblock_type *type) · 202 unmodified lines
267268 return 0;
268269 }
269270
270−extern int __init_memblock __weak memblock_memory_can_coalesce(phys_addr_t addr1, phys_addr_t size1,
271+int __init_memblock __weak memblock_memory_can_coalesce(phys_addr_t addr1, phys_addr_t size1,
271272 phys_addr_t addr2, phys_addr_t size2)
272273 {
273274 return 1;
@@ -626,6 +627,12 @@ phys_addr_t __init memblock_phys_mem_size(void) · 352 unmodified lines
626627 return memblock.memory_size;
627628 }
628629
630+/* lowest address */
631+phys_addr_t __init_memblock memblock_start_of_DRAM(void)
632+{
633+ return memblock.memory.regions[0].base;
634+}
635+
629636 phys_addr_t __init_memblock memblock_end_of_DRAM(void)
630637 {
631638 int idx = memblock.memory.cnt - 1;
mm/memcontrol.c+2−1
@@ -1185,7 +1185,8 @@ mem_cgroup_get_reclaim_stat_from_page(struct page *page) · 1184 unmodified lines
11851185 unsigned long mem_cgroup_isolate_pages(unsigned long nr_to_scan,
11861186 struct list_head *dst,
11871187 unsigned long *scanned, int order,
1188− int mode, struct zone *z,
1188+ isolate_mode_t mode,
1189+ struct zone *z,
11891190 struct mem_cgroup *mem_cont,
11901191 int active, int file)
11911192 {
mm/memory-failure.c+6−6
@@ -1310,7 +1310,7 @@ int unpoison_memory(unsigned long pfn) · 1309 unmodified lines
13101310 * to the end.
13111311 */
13121312 if (PageHuge(page)) {
1313− pr_debug("MCE: Memory failure is now running on free hugepage %#lx\n", pfn);
1313+ pr_info("MCE: Memory failure is now running on free hugepage %#lx\n", pfn);
13141314 return 0;
13151315 }
13161316 if (TestClearPageHWPoison(p))
@@ -1419,7 +1419,7 @@ static int soft_offline_huge_page(struct page *page, int flags) · 102 unmodified lines
14191419
14201420 if (PageHWPoison(hpage)) {
14211421 put_page(hpage);
1422− pr_debug("soft offline: %#lx hugepage already poisoned\n", pfn);
1422+ pr_info("soft offline: %#lx hugepage already poisoned\n", pfn);
14231423 return -EBUSY;
14241424 }
14251425
@@ -1433,8 +1433,8 @@ static int soft_offline_huge_page(struct page *page, int flags) · 7 unmodified lines
14331433 list_for_each_entry_safe(page1, page2, &pagelist, lru)
14341434 put_page(page1);
14351435
1436− pr_debug("soft offline: %#lx: migration failed %d, type %lx\n",
1437− pfn, ret, page->flags);
1436+ pr_info("soft offline: %#lx: migration failed %d, type %lx\n",
1437+ pfn, ret, page->flags);
14381438 if (ret > 0)
14391439 ret = -EIO;
14401440 return ret;
@@ -1505,7 +1505,7 @@ int soft_offline_page(struct page *page, int flags) · 64 unmodified lines
15051505 }
15061506 if (!PageLRU(page)) {
15071507 pr_info("soft_offline: %#lx: unknown non LRU page type %lx\n",
1508− pfn, page->flags);
1508+ pfn, page->flags);
15091509 return -EIO;
15101510 }
15111511
@@ -1566,7 +1566,7 @@ int soft_offline_page(struct page *page, int flags) · 54 unmodified lines
15661566 }
15671567 } else {
15681568 pr_info("soft offline: %#lx: isolation failed: %d, page count %d, type %lx\n",
1569− pfn, ret, page_count(page), page->flags);
1569+ pfn, ret, page_count(page), page->flags);
15701570 }
15711571 if (ret)
15721572 return ret;
mm/mempolicy.c+1−1
@@ -111,7 +111,7 @@ enum zone_type policy_zone = 0; · 110 unmodified lines
111111 /*
112112 * run-time system-wide default policy => local allocation
113113 */
114−struct mempolicy default_policy = {
114+static struct mempolicy default_policy = {
115115 .refcnt = ATOMIC_INIT(1), /* never free it */
116116 .mode = MPOL_PREFERRED,
117117 .flags = MPOL_F_LOCAL,
mm/migrate.c+40−35
@@ -621,38 +621,18 @@ static int move_to_new_page(struct page *newpage, struct page *page, · 620 unmodified lines
621621 return rc;
622622 }
623623
624−/*
625− * Obtain the lock on page, remove all ptes and migrate the page
626− * to the newly allocated page in newpage.
627− */
628−static int unmap_and_move(new_page_t get_new_page, unsigned long private,
629− struct page *page, int force, bool offlining, bool sync)
624+static int __unmap_and_move(struct page *page, struct page *newpage,
625+ int force, bool offlining, bool sync)
630626 {
631− int rc = 0;
632− int *result = NULL;
633− struct page *newpage = get_new_page(page, private, &result);
627+ int rc = -EAGAIN;
634628 int remap_swapcache = 1;
635629 int charge = 0;
636630 struct mem_cgroup *mem;
637631 struct anon_vma *anon_vma = NULL;
638632
639− if (!newpage)
640− return -ENOMEM;
641−
642− if (page_count(page) == 1) {
643− /* page was freed from under us. So we are done. */
644− goto move_newpage;
645− }
646− if (unlikely(PageTransHuge(page)))
647− if (unlikely(split_huge_page(page)))
648− goto move_newpage;
649−
650− /* prepare cgroup just returns 0 or -ENOMEM */
651− rc = -EAGAIN;
652−
653633 if (!trylock_page(page)) {
654634 if (!force || !sync)
655− goto move_newpage;
635+ goto out;
656636
657637 /*
658638 * It's not safe for direct compaction to call lock_page.
@@ -668,7 +648,7 @@ static int unmap_and_move(new_page_t get_new_page, unsigned long private, · 9 unmodified lines
668648 * altogether.
669649 */
670650 if (current->flags & PF_MEMALLOC)
671− goto move_newpage;
651+ goto out;
672652
673653 lock_page(page);
674654 }
@@ -785,27 +765,52 @@ uncharge: · 110 unmodified lines
785765 mem_cgroup_end_migration(mem, page, newpage, rc == 0);
786766 unlock:
787767 unlock_page(page);
768+out:
769+ return rc;
770+}
788771
789−move_newpage:
772+/*
773+ * Obtain the lock on page, remove all ptes and migrate the page
774+ * to the newly allocated page in newpage.
775+ */
776+static int unmap_and_move(new_page_t get_new_page, unsigned long private,
777+ struct page *page, int force, bool offlining, bool sync)
778+{
779+ int rc = 0;
780+ int *result = NULL;
781+ struct page *newpage = get_new_page(page, private, &result);
782+
783+ if (!newpage)
784+ return -ENOMEM;
785+
786+ if (page_count(page) == 1) {
787+ /* page was freed from under us. So we are done. */
788+ goto out;
789+ }
790+
791+ if (unlikely(PageTransHuge(page)))
792+ if (unlikely(split_huge_page(page)))
793+ goto out;
794+
795+ rc = __unmap_and_move(page, newpage, force, offlining, sync);
796+out:
790797 if (rc != -EAGAIN) {
791− /*
792− * A page that has been migrated has all references
793− * removed and will be freed. A page that has not been
794− * migrated will have kepts its references and be
795− * restored.
796− */
797− list_del(&page->lru);
798+ /*
799+ * A page that has been migrated has all references
800+ * removed and will be freed. A page that has not been
801+ * migrated will have kepts its references and be
802+ * restored.
803+ */
804+ list_del(&page->lru);
798805 dec_zone_page_state(page, NR_ISOLATED_ANON +
799806 page_is_file_cache(page));
800807 putback_lru_page(page);
801808 }
802−
803809 /*
804810 * Move the new page to the LRU. If migration was not successful
805811 * then this will free the page.
806812 */
807813 putback_lru_page(newpage);
808−
809814 if (result) {
810815 if (rc)
811816 *result = rc;
mm/mlock.c+11−2
@@ -110,7 +110,15 @@ void munlock_vma_page(struct page *page) · 109 unmodified lines
110110 if (TestClearPageMlocked(page)) {
111111 dec_zone_page_state(page, NR_MLOCK);
112112 if (!isolate_lru_page(page)) {
113− int ret = try_to_munlock(page);
113+ int ret = SWAP_AGAIN;
114+
115+ /*
116+ * Optimization: if the page was mapped just once,
117+ * that's our mapping and we don't need to check all the
118+ * other vmas.
119+ */
120+ if (page_mapcount(page) > 1)
121+ ret = try_to_munlock(page);
114122 /*
115123 * did try_to_unlock() succeed or punt?
116124 */
@@ -549,7 +557,8 @@ SYSCALL_DEFINE1(mlockall, int, flags) · 432 unmodified lines
549557 if (!can_do_mlock())
550558 goto out;
551559
552− lru_add_drain_all(); /* flush pagevec */
560+ if (flags & MCL_CURRENT)
561+ lru_add_drain_all(); /* flush pagevec */
553562
554563 down_write(&current->mm->mmap_sem);
555564
mm/mmap.c+3−6
@@ -2558,7 +2558,6 @@ int mm_take_all_locks(struct mm_struct *mm) · 2557 unmodified lines
25582558 {
25592559 struct vm_area_struct *vma;
25602560 struct anon_vma_chain *avc;
2561− int ret = -EINTR;
25622561
25632562 BUG_ON(down_read_trylock(&mm->mmap_sem));
25642563
@@ -2579,13 +2578,11 @@ int mm_take_all_locks(struct mm_struct *mm) · 14 unmodified lines
25792578 vm_lock_anon_vma(mm, avc->anon_vma);
25802579 }
25812580
2582− ret = 0;
2581+ return 0;
25832582
25842583 out_unlock:
2585− if (ret)
2586− mm_drop_all_locks(mm);
2587−
2588− return ret;
2584+ mm_drop_all_locks(mm);
2585+ return -EINTR;
25892586 }
25902587
25912588 static void vm_unlock_anon_vma(struct anon_vma *anon_vma)
mm/mremap.c+30−12
@@ -41,8 +41,7 @@ static pmd_t *get_old_pmd(struct mm_struct *mm, unsigned long addr) · 40 unmodified lines
4141 return NULL;
4242
4343 pmd = pmd_offset(pud, addr);
44− split_huge_page_pmd(mm, pmd);
45− if (pmd_none_or_clear_bad(pmd))
44+ if (pmd_none(*pmd))
4645 return NULL;
4746
4847 return pmd;
@@ -65,8 +64,6 @@ static pmd_t *alloc_new_pmd(struct mm_struct *mm, struct vm_area_struct *vma, · 16 unmodified lines
6564 return NULL;
6665
6766 VM_BUG_ON(pmd_trans_huge(*pmd));
68− if (pmd_none(*pmd) && __pte_alloc(mm, vma, pmd, addr))
69− return NULL;
7067
7168 return pmd;
7269 }
@@ -80,11 +77,7 @@ static void move_ptes(struct vm_area_struct *vma, pmd_t *old_pmd, · 7 unmodified lines
8077 struct mm_struct *mm = vma->vm_mm;
8178 pte_t *old_pte, *new_pte, pte;
8279 spinlock_t *old_ptl, *new_ptl;
83− unsigned long old_start;
8480
85− old_start = old_addr;
86− mmu_notifier_invalidate_range_start(vma->vm_mm,
87− old_start, old_end);
8881 if (vma->vm_file) {
8982 /*
9083 * Subtle point from Rajesh Venkatasubramanian: before
@@ -111,7 +104,7 @@ static void move_ptes(struct vm_area_struct *vma, pmd_t *old_pmd, · 20 unmodified lines
111104 new_pte++, new_addr += PAGE_SIZE) {
112105 if (pte_none(*old_pte))
113106 continue;
114− pte = ptep_clear_flush(vma, old_addr, old_pte);
107+ pte = ptep_get_and_clear(mm, old_addr, old_pte);
115108 pte = move_pte(pte, new_vma->vm_page_prot, old_addr, new_addr);
116109 set_pte_at(mm, new_addr, new_pte, pte);
117110 }
@@ -123,7 +116,6 @@ static void move_ptes(struct vm_area_struct *vma, pmd_t *old_pmd, · 5 unmodified lines
123116 pte_unmap_unlock(old_pte - 1, old_ptl);
124117 if (mapping)
125118 mutex_unlock(&mapping->i_mmap_mutex);
126− mmu_notifier_invalidate_range_end(vma->vm_mm, old_start, old_end);
127119 }
128120
129121 #define LATENCY_LIMIT (64 * PAGE_SIZE)
@@ -134,22 +126,43 @@ unsigned long move_page_tables(struct vm_area_struct *vma, · 4 unmodified lines
134126 {
135127 unsigned long extent, next, old_end;
136128 pmd_t *old_pmd, *new_pmd;
129+ bool need_flush = false;
137130
138131 old_end = old_addr + len;
139132 flush_cache_range(vma, old_addr, old_end);
140133
134+ mmu_notifier_invalidate_range_start(vma->vm_mm, old_addr, old_end);
135+
141136 for (; old_addr < old_end; old_addr += extent, new_addr += extent) {
142137 cond_resched();
143138 next = (old_addr + PMD_SIZE) & PMD_MASK;
144− if (next - 1 > old_end)
145− next = old_end;
139+ /* even if next overflowed, extent below will be ok */
146140 extent = next - old_addr;
141+ if (extent > old_end - old_addr)
142+ extent = old_end - old_addr;
147143 old_pmd = get_old_pmd(vma->vm_mm, old_addr);
148144 if (!old_pmd)
149145 continue;
150146 new_pmd = alloc_new_pmd(vma->vm_mm, vma, new_addr);
151147 if (!new_pmd)
152148 break;
149+ if (pmd_trans_huge(*old_pmd)) {
150+ int err = 0;
151+ if (extent == HPAGE_PMD_SIZE)
152+ err = move_huge_pmd(vma, new_vma, old_addr,
153+ new_addr, old_end,
154+ old_pmd, new_pmd);
155+ if (err > 0) {
156+ need_flush = true;
157+ continue;
158+ } else if (!err) {
159+ split_huge_page_pmd(vma->vm_mm, old_pmd);
160+ }
161+ VM_BUG_ON(pmd_trans_huge(*old_pmd));
162+ }
163+ if (pmd_none(*new_pmd) && __pte_alloc(new_vma->vm_mm, new_vma,
164+ new_pmd, new_addr))
165+ break;
153166 next = (new_addr + PMD_SIZE) & PMD_MASK;
154167 if (extent > next - new_addr)
155168 extent = next - new_addr;
@@ -157,7 +170,12 @@ unsigned long move_page_tables(struct vm_area_struct *vma, · 1 unmodified line
157170 extent = LATENCY_LIMIT;
158171 move_ptes(vma, old_pmd, old_addr, old_addr + extent,
159172 new_vma, new_pmd, new_addr);
173+ need_flush = true;
160174 }
175+ if (likely(need_flush))
176+ flush_tlb_range(vma, old_end-len, old_addr);
177+
178+ mmu_notifier_invalidate_range_end(vma->vm_mm, old_end-len, old_end);
161179
162180 return len + old_addr - old_end; /* how much done */
163181 }
mm/oom_kill.c+32−21
@@ -32,12 +32,32 @@ · 31 unmodified lines
3232 #include <linux/mempolicy.h>
3333 #include <linux/security.h>
3434 #include <linux/ptrace.h>
35+#include <linux/freezer.h>
3536
3637 int sysctl_panic_on_oom;
3738 int sysctl_oom_kill_allocating_task;
3839 int sysctl_oom_dump_tasks = 1;
3940 static DEFINE_SPINLOCK(zone_scan_lock);
4041
42+/*
43+ * compare_swap_oom_score_adj() - compare and swap current's oom_score_adj
44+ * @old_val: old oom_score_adj for compare
45+ * @new_val: new oom_score_adj for swap
46+ *
47+ * Sets the oom_score_adj value for current to @new_val iff its present value is
48+ * @old_val. Usually used to reinstate a previous value to prevent racing with
49+ * userspacing tuning the value in the interim.
50+ */
51+void compare_swap_oom_score_adj(int old_val, int new_val)
52+{
53+ struct sighand_struct *sighand = current->sighand;
54+
55+ spin_lock_irq(&sighand->siglock);
56+ if (current->signal->oom_score_adj == old_val)
57+ current->signal->oom_score_adj = new_val;
58+ spin_unlock_irq(&sighand->siglock);
59+}
60+
4161 /**
4262 * test_set_oom_score_adj() - set current's oom_score_adj and return old value
4363 * @new_val: new oom_score_adj value
@@ -53,13 +73,7 @@ int test_set_oom_score_adj(int new_val) · 9 unmodified lines
5373
5474 spin_lock_irq(&sighand->siglock);
5575 old_val = current->signal->oom_score_adj;
56− if (new_val != old_val) {
57− if (new_val == OOM_SCORE_ADJ_MIN)
58− atomic_inc(&current->mm->oom_disable_count);
59− else if (old_val == OOM_SCORE_ADJ_MIN)
60− atomic_dec(&current->mm->oom_disable_count);
61− current->signal->oom_score_adj = new_val;
62− }
76+ current->signal->oom_score_adj = new_val;
6377 spin_unlock_irq(&sighand->siglock);
6478
6579 return old_val;
@@ -171,16 +185,6 @@ unsigned int oom_badness(struct task_struct *p, struct mem_cgroup *mem, · 105 unmodified lines
171185 if (!p)
172186 return 0;
173187
174− /*
175− * Shortcut check for a thread sharing p->mm that is OOM_SCORE_ADJ_MIN
176− * so the entire heuristic doesn't need to be executed for something
177− * that cannot be killed.
178− */
179− if (atomic_read(&p->mm->oom_disable_count)) {
180− task_unlock(p);
181− return 0;
182− }
183−
184188 /*
185189 * The memory controller may have a limit of 0 bytes, so avoid a divide
186190 * by zero, if necessary.
@@ -317,8 +321,11 @@ static struct task_struct *select_bad_process(unsigned int *ppoints, · 130 unmodified lines
317321 * blocked waiting for another task which itself is waiting
318322 * for memory. Is there a better alternative?
319323 */
320− if (test_tsk_thread_flag(p, TIF_MEMDIE))
324+ if (test_tsk_thread_flag(p, TIF_MEMDIE)) {
325+ if (unlikely(frozen(p)))
326+ thaw_process(p);
321327 return ERR_PTR(-1UL);
328+ }
322329 if (!p->mm)
323330 continue;
324331
@@ -435,7 +442,7 @@ static int oom_kill_task(struct task_struct *p, struct mem_cgroup *mem) · 110 unmodified lines
435442 task_unlock(p);
436443
437444 /*
438− * Kill all processes sharing p->mm in other thread groups, if any.
445+ * Kill all user processes sharing p->mm in other thread groups, if any.
439446 * They don't get access to memory reserves or a higher scheduler
440447 * priority, though, to avoid depletion of all memory or task
441448 * starvation. This prevents mm->mmap_sem livelock when an oom killed
@@ -445,7 +452,11 @@ static int oom_kill_task(struct task_struct *p, struct mem_cgroup *mem) · 3 unmodified lines
445452 * signal.
446453 */
447454 for_each_process(q)
448− if (q->mm == mm && !same_thread_group(q, p)) {
455+ if (q->mm == mm && !same_thread_group(q, p) &&
456+ !(q->flags & PF_KTHREAD)) {
457+ if (q->signal->oom_score_adj == OOM_SCORE_ADJ_MIN)
458+ continue;
459+
449460 task_lock(q); /* Protect ->comm from prctl() */
450461 pr_err("Kill process %d (%s) sharing same memory\n",
451462 task_pid_nr(q), q->comm);
@@ -722,7 +733,7 @@ void out_of_memory(struct zonelist *zonelist, gfp_t gfp_mask, · 270 unmodified lines
722733 read_lock(&tasklist_lock);
723734 if (sysctl_oom_kill_allocating_task &&
724735 !oom_unkillable_task(current, NULL, nodemask) &&
725− current->mm && !atomic_read(&current->mm->oom_disable_count)) {
736+ current->mm) {
726737 /*
727738 * oom_kill_process() needs tasklist_lock held. If it returns
728739 * non-zero, current could not be killed so we must fallback to
mm/page-writeback.c+3−1
@@ -305,7 +305,9 @@ static unsigned long task_min_dirty_limit(unsigned long bdi_dirty) · 304 unmodified lines
305305 }
306306
307307 /*
308− *
308+ * bdi_min_ratio keeps the sum of the minimum dirty shares of all
309+ * registered backing devices, which, for obvious reasons, can not
310+ * exceed 100%.
309311 */
310312 static unsigned int bdi_min_ratio;
311313
mm/page_alloc.c+12−5
@@ -318,6 +318,7 @@ static void bad_page(struct page *page) · 317 unmodified lines
318318 current->comm, page_to_pfn(page));
319319 dump_page(page);
320320
321+ print_modules();
321322 dump_stack();
322323 out:
323324 /* Leave bad fields for debug, except PageBuddy could make trouble */
@@ -1753,7 +1754,6 @@ static DEFINE_RATELIMIT_STATE(nopage_rs, · 1429 unmodified lines
17531754
17541755 void warn_alloc_failed(gfp_t gfp_mask, int order, const char *fmt, ...)
17551756 {
1756− va_list args;
17571757 unsigned int filter = SHOW_MEM_FILTER_NODES;
17581758
17591759 if ((gfp_mask & __GFP_NOWARN) || !__ratelimit(&nopage_rs))
@@ -1772,14 +1772,21 @@ void warn_alloc_failed(gfp_t gfp_mask, int order, const char *fmt, ...) · 12 unmodified lines
17721772 filter &= ~SHOW_MEM_FILTER_NODES;
17731773
17741774 if (fmt) {
1775− printk(KERN_WARNING);
1775+ struct va_format vaf;
1776+ va_list args;
1777+
17761778 va_start(args, fmt);
1777− vprintk(fmt, args);
1779+
1780+ vaf.fmt = fmt;
1781+ vaf.va = &args;
1782+
1783+ pr_warn("%pV", &vaf);
1784+
17781785 va_end(args);
17791786 }
17801787
1781− pr_warning("%s: page allocation failure: order:%d, mode:0x%x\n",
1782− current->comm, order, gfp_mask);
1788+ pr_warn("%s: page allocation failure: order:%d, mode:0x%x\n",
1789+ current->comm, order, gfp_mask);
17831790
17841791 dump_stack();
17851792 if (!should_suppress_show_mem())
mm/process_vm_access.c+496−0
@@ -0,0 +1,496 @@
1+/*
2+ * linux/mm/process_vm_access.c
3+ *
4+ * Copyright (C) 2010-2011 Christopher Yeoh <cyeoh@au1.ibm.com>, IBM Corp.
5+ *
6+ * This program is free software; you can redistribute it and/or
7+ * modify it under the terms of the GNU General Public License
8+ * as published by the Free Software Foundation; either version
9+ * 2 of the License, or (at your option) any later version.
10+ */
11+
12+#include <linux/mm.h>
13+#include <linux/uio.h>
14+#include <linux/sched.h>
15+#include <linux/highmem.h>
16+#include <linux/ptrace.h>
17+#include <linux/slab.h>
18+#include <linux/syscalls.h>
19+
20+#ifdef CONFIG_COMPAT
21+#include <linux/compat.h>
22+#endif
23+
24+/**
25+ * process_vm_rw_pages - read/write pages from task specified
26+ * @task: task to read/write from
27+ * @mm: mm for task
28+ * @process_pages: struct pages area that can store at least
29+ * nr_pages_to_copy struct page pointers
30+ * @pa: address of page in task to start copying from/to
31+ * @start_offset: offset in page to start copying from/to
32+ * @len: number of bytes to copy
33+ * @lvec: iovec array specifying where to copy to/from
34+ * @lvec_cnt: number of elements in iovec array
35+ * @lvec_current: index in iovec array we are up to
36+ * @lvec_offset: offset in bytes from current iovec iov_base we are up to
37+ * @vm_write: 0 means copy from, 1 means copy to
38+ * @nr_pages_to_copy: number of pages to copy
39+ * @bytes_copied: returns number of bytes successfully copied
40+ * Returns 0 on success, error code otherwise
41+ */
42+static int process_vm_rw_pages(struct task_struct *task,
43+ struct mm_struct *mm,
44+ struct page **process_pages,
45+ unsigned long pa,
46+ unsigned long start_offset,
47+ unsigned long len,
48+ const struct iovec *lvec,
49+ unsigned long lvec_cnt,
50+ unsigned long *lvec_current,
51+ size_t *lvec_offset,
52+ int vm_write,
53+ unsigned int nr_pages_to_copy,
54+ ssize_t *bytes_copied)
55+{
56+ int pages_pinned;
57+ void *target_kaddr;
58+ int pgs_copied = 0;
59+ int j;
60+ int ret;
61+ ssize_t bytes_to_copy;
62+ ssize_t rc = 0;
63+
64+ *bytes_copied = 0;
65+
66+ /* Get the pages we're interested in */
67+ down_read(&mm->mmap_sem);
68+ pages_pinned = get_user_pages(task, mm, pa,
69+ nr_pages_to_copy,
70+ vm_write, 0, process_pages, NULL);
71+ up_read(&mm->mmap_sem);
72+
73+ if (pages_pinned != nr_pages_to_copy) {
74+ rc = -EFAULT;
75+ goto end;
76+ }
77+
78+ /* Do the copy for each page */
79+ for (pgs_copied = 0;
80+ (pgs_copied < nr_pages_to_copy) && (*lvec_current < lvec_cnt);
81+ pgs_copied++) {
82+ /* Make sure we have a non zero length iovec */
83+ while (*lvec_current < lvec_cnt
84+ && lvec[*lvec_current].iov_len == 0)
85+ (*lvec_current)++;
86+ if (*lvec_current == lvec_cnt)
87+ break;
88+
89+ /*
90+ * Will copy smallest of:
91+ * - bytes remaining in page
92+ * - bytes remaining in destination iovec
93+ */
94+ bytes_to_copy = min_t(ssize_t, PAGE_SIZE - start_offset,
95+ len - *bytes_copied);
96+ bytes_to_copy = min_t(ssize_t, bytes_to_copy,
97+ lvec[*lvec_current].iov_len
98+ - *lvec_offset);
99+
100+ target_kaddr = kmap(process_pages[pgs_copied]) + start_offset;
101+
102+ if (vm_write)
103+ ret = copy_from_user(target_kaddr,
104+ lvec[*lvec_current].iov_base
105+ + *lvec_offset,
106+ bytes_to_copy);
107+ else
108+ ret = copy_to_user(lvec[*lvec_current].iov_base
109+ + *lvec_offset,
110+ target_kaddr, bytes_to_copy);
111+ kunmap(process_pages[pgs_copied]);
112+ if (ret) {
113+ *bytes_copied += bytes_to_copy - ret;
114+ pgs_copied++;
115+ rc = -EFAULT;
116+ goto end;
117+ }
118+ *bytes_copied += bytes_to_copy;
119+ *lvec_offset += bytes_to_copy;
120+ if (*lvec_offset == lvec[*lvec_current].iov_len) {
121+ /*
122+ * Need to copy remaining part of page into the
123+ * next iovec if there are any bytes left in page
124+ */
125+ (*lvec_current)++;
126+ *lvec_offset = 0;
127+ start_offset = (start_offset + bytes_to_copy)
128+ % PAGE_SIZE;
129+ if (start_offset)
130+ pgs_copied--;
131+ } else {
132+ start_offset = 0;
133+ }
134+ }
135+
136+end:
137+ if (vm_write) {
138+ for (j = 0; j < pages_pinned; j++) {
139+ if (j < pgs_copied)
140+ set_page_dirty_lock(process_pages[j]);
141+ put_page(process_pages[j]);
142+ }
143+ } else {
144+ for (j = 0; j < pages_pinned; j++)
145+ put_page(process_pages[j]);
146+ }
147+
148+ return rc;
149+}
150+
151+/* Maximum number of pages kmalloc'd to hold struct page's during copy */
152+#define PVM_MAX_KMALLOC_PAGES (PAGE_SIZE * 2)
153+
154+/**
155+ * process_vm_rw_single_vec - read/write pages from task specified
156+ * @addr: start memory address of target process
157+ * @len: size of area to copy to/from
158+ * @lvec: iovec array specifying where to copy to/from locally
159+ * @lvec_cnt: number of elements in iovec array
160+ * @lvec_current: index in iovec array we are up to
161+ * @lvec_offset: offset in bytes from current iovec iov_base we are up to
162+ * @process_pages: struct pages area that can store at least
163+ * nr_pages_to_copy struct page pointers
164+ * @mm: mm for task
165+ * @task: task to read/write from
166+ * @vm_write: 0 means copy from, 1 means copy to
167+ * @bytes_copied: returns number of bytes successfully copied
168+ * Returns 0 on success or on failure error code
169+ */
170+static int process_vm_rw_single_vec(unsigned long addr,
171+ unsigned long len,
172+ const struct iovec *lvec,
173+ unsigned long lvec_cnt,
174+ unsigned long *lvec_current,
175+ size_t *lvec_offset,
176+ struct page **process_pages,
177+ struct mm_struct *mm,
178+ struct task_struct *task,
179+ int vm_write,
180+ ssize_t *bytes_copied)
181+{
182+ unsigned long pa = addr & PAGE_MASK;
183+ unsigned long start_offset = addr - pa;
184+ unsigned long nr_pages;
185+ ssize_t bytes_copied_loop;
186+ ssize_t rc = 0;
187+ unsigned long nr_pages_copied = 0;
188+ unsigned long nr_pages_to_copy;
189+ unsigned long max_pages_per_loop = PVM_MAX_KMALLOC_PAGES
190+ / sizeof(struct pages *);
191+
192+ *bytes_copied = 0;
193+
194+ /* Work out address and page range required */
195+ if (len == 0)
196+ return 0;
197+ nr_pages = (addr + len - 1) / PAGE_SIZE - addr / PAGE_SIZE + 1;
198+
199+ while ((nr_pages_copied < nr_pages) && (*lvec_current < lvec_cnt)) {
200+ nr_pages_to_copy = min(nr_pages - nr_pages_copied,
201+ max_pages_per_loop);
202+
203+ rc = process_vm_rw_pages(task, mm, process_pages, pa,
204+ start_offset, len,
205+ lvec, lvec_cnt,
206+ lvec_current, lvec_offset,
207+ vm_write, nr_pages_to_copy,
208+ &bytes_copied_loop);
209+ start_offset = 0;
210+ *bytes_copied += bytes_copied_loop;
211+
212+ if (rc < 0) {
213+ return rc;
214+ } else {
215+ len -= bytes_copied_loop;
216+ nr_pages_copied += nr_pages_to_copy;
217+ pa += nr_pages_to_copy * PAGE_SIZE;
218+ }
219+ }
220+
221+ return rc;
222+}
223+
224+/* Maximum number of entries for process pages array
225+ which lives on stack */
226+#define PVM_MAX_PP_ARRAY_COUNT 16
227+
228+/**
229+ * process_vm_rw_core - core of reading/writing pages from task specified
230+ * @pid: PID of process to read/write from/to
231+ * @lvec: iovec array specifying where to copy to/from locally
232+ * @liovcnt: size of lvec array
233+ * @rvec: iovec array specifying where to copy to/from in the other process
234+ * @riovcnt: size of rvec array
235+ * @flags: currently unused
236+ * @vm_write: 0 if reading from other process, 1 if writing to other process
237+ * Returns the number of bytes read/written or error code. May
238+ * return less bytes than expected if an error occurs during the copying
239+ * process.
240+ */
241+static ssize_t process_vm_rw_core(pid_t pid, const struct iovec *lvec,
242+ unsigned long liovcnt,
243+ const struct iovec *rvec,
244+ unsigned long riovcnt,
245+ unsigned long flags, int vm_write)
246+{
247+ struct task_struct *task;
248+ struct page *pp_stack[PVM_MAX_PP_ARRAY_COUNT];
249+ struct page **process_pages = pp_stack;
250+ struct mm_struct *mm;
251+ unsigned long i;
252+ ssize_t rc = 0;
253+ ssize_t bytes_copied_loop;
254+ ssize_t bytes_copied = 0;
255+ unsigned long nr_pages = 0;
256+ unsigned long nr_pages_iov;
257+ unsigned long iov_l_curr_idx = 0;
258+ size_t iov_l_curr_offset = 0;
259+ ssize_t iov_len;
260+
261+ /*
262+ * Work out how many pages of struct pages we're going to need
263+ * when eventually calling get_user_pages
264+ */
265+ for (i = 0; i < riovcnt; i++) {
266+ iov_len = rvec[i].iov_len;
267+ if (iov_len > 0) {
268+ nr_pages_iov = ((unsigned long)rvec[i].iov_base
269+ + iov_len)
270+ / PAGE_SIZE - (unsigned long)rvec[i].iov_base
271+ / PAGE_SIZE + 1;
272+ nr_pages = max(nr_pages, nr_pages_iov);
273+ }
274+ }
275+
276+ if (nr_pages == 0)
277+ return 0;
278+
279+ if (nr_pages > PVM_MAX_PP_ARRAY_COUNT) {
280+ /* For reliability don't try to kmalloc more than
281+ 2 pages worth */
282+ process_pages = kmalloc(min_t(size_t, PVM_MAX_KMALLOC_PAGES,
283+ sizeof(struct pages *)*nr_pages),
284+ GFP_KERNEL);
285+
286+ if (!process_pages)
287+ return -ENOMEM;
288+ }
289+
290+ /* Get process information */
291+ rcu_read_lock();
292+ task = find_task_by_vpid(pid);
293+ if (task)
294+ get_task_struct(task);
295+ rcu_read_unlock();
296+ if (!task) {
297+ rc = -ESRCH;
298+ goto free_proc_pages;
299+ }
300+
301+ task_lock(task);
302+ if (__ptrace_may_access(task, PTRACE_MODE_ATTACH)) {
303+ task_unlock(task);
304+ rc = -EPERM;
305+ goto put_task_struct;
306+ }
307+ mm = task->mm;
308+
309+ if (!mm || (task->flags & PF_KTHREAD)) {
310+ task_unlock(task);
311+ rc = -EINVAL;
312+ goto put_task_struct;
313+ }
314+
315+ atomic_inc(&mm->mm_users);
316+ task_unlock(task);
317+
318+ for (i = 0; i < riovcnt && iov_l_curr_idx < liovcnt; i++) {
319+ rc = process_vm_rw_single_vec(
320+ (unsigned long)rvec[i].iov_base, rvec[i].iov_len,
321+ lvec, liovcnt, &iov_l_curr_idx, &iov_l_curr_offset,
322+ process_pages, mm, task, vm_write, &bytes_copied_loop);
323+ bytes_copied += bytes_copied_loop;
324+ if (rc != 0) {
325+ /* If we have managed to copy any data at all then
326+ we return the number of bytes copied. Otherwise
327+ we return the error code */
328+ if (bytes_copied)
329+ rc = bytes_copied;
330+ goto put_mm;
331+ }
332+ }
333+
334+ rc = bytes_copied;
335+put_mm:
336+ mmput(mm);
337+
338+put_task_struct:
339+ put_task_struct(task);
340+
341+free_proc_pages:
342+ if (process_pages != pp_stack)
343+ kfree(process_pages);
344+ return rc;
345+}
346+
347+/**
348+ * process_vm_rw - check iovecs before calling core routine
349+ * @pid: PID of process to read/write from/to
350+ * @lvec: iovec array specifying where to copy to/from locally
351+ * @liovcnt: size of lvec array
352+ * @rvec: iovec array specifying where to copy to/from in the other process
353+ * @riovcnt: size of rvec array
354+ * @flags: currently unused
355+ * @vm_write: 0 if reading from other process, 1 if writing to other process
356+ * Returns the number of bytes read/written or error code. May
357+ * return less bytes than expected if an error occurs during the copying
358+ * process.
359+ */
360+static ssize_t process_vm_rw(pid_t pid,
361+ const struct iovec __user *lvec,
362+ unsigned long liovcnt,
363+ const struct iovec __user *rvec,
364+ unsigned long riovcnt,
365+ unsigned long flags, int vm_write)
366+{
367+ struct iovec iovstack_l[UIO_FASTIOV];
368+ struct iovec iovstack_r[UIO_FASTIOV];
369+ struct iovec *iov_l = iovstack_l;
370+ struct iovec *iov_r = iovstack_r;
371+ ssize_t rc;
372+
373+ if (flags != 0)
374+ return -EINVAL;
375+
376+ /* Check iovecs */
377+ if (vm_write)
378+ rc = rw_copy_check_uvector(WRITE, lvec, liovcnt, UIO_FASTIOV,
379+ iovstack_l, &iov_l, 1);
380+ else
381+ rc = rw_copy_check_uvector(READ, lvec, liovcnt, UIO_FASTIOV,
382+ iovstack_l, &iov_l, 1);
383+ if (rc <= 0)
384+ goto free_iovecs;
385+
386+ rc = rw_copy_check_uvector(READ, rvec, riovcnt, UIO_FASTIOV,
387+ iovstack_r, &iov_r, 0);
388+ if (rc <= 0)
389+ goto free_iovecs;
390+
391+ rc = process_vm_rw_core(pid, iov_l, liovcnt, iov_r, riovcnt, flags,
392+ vm_write);
393+
394+free_iovecs:
395+ if (iov_r != iovstack_r)
396+ kfree(iov_r);
397+ if (iov_l != iovstack_l)
398+ kfree(iov_l);
399+
400+ return rc;
401+}
402+
403+SYSCALL_DEFINE6(process_vm_readv, pid_t, pid, const struct iovec __user *, lvec,
404+ unsigned long, liovcnt, const struct iovec __user *, rvec,
405+ unsigned long, riovcnt, unsigned long, flags)
406+{
407+ return process_vm_rw(pid, lvec, liovcnt, rvec, riovcnt, flags, 0);
408+}
409+
410+SYSCALL_DEFINE6(process_vm_writev, pid_t, pid,
411+ const struct iovec __user *, lvec,
412+ unsigned long, liovcnt, const struct iovec __user *, rvec,
413+ unsigned long, riovcnt, unsigned long, flags)
414+{
415+ return process_vm_rw(pid, lvec, liovcnt, rvec, riovcnt, flags, 1);
416+}
417+
418+#ifdef CONFIG_COMPAT
419+
420+asmlinkage ssize_t
421+compat_process_vm_rw(compat_pid_t pid,
422+ const struct compat_iovec __user *lvec,
423+ unsigned long liovcnt,
424+ const struct compat_iovec __user *rvec,
425+ unsigned long riovcnt,
426+ unsigned long flags, int vm_write)
427+{
428+ struct iovec iovstack_l[UIO_FASTIOV];
429+ struct iovec iovstack_r[UIO_FASTIOV];
430+ struct iovec *iov_l = iovstack_l;
431+ struct iovec *iov_r = iovstack_r;
432+ ssize_t rc = -EFAULT;
433+
434+ if (flags != 0)
435+ return -EINVAL;
436+
437+ if (!access_ok(VERIFY_READ, lvec, liovcnt * sizeof(*lvec)))
438+ goto out;
439+
440+ if (!access_ok(VERIFY_READ, rvec, riovcnt * sizeof(*rvec)))
441+ goto out;
442+
443+ if (vm_write)
444+ rc = compat_rw_copy_check_uvector(WRITE, lvec, liovcnt,
445+ UIO_FASTIOV, iovstack_l,
446+ &iov_l, 1);
447+ else
448+ rc = compat_rw_copy_check_uvector(READ, lvec, liovcnt,
449+ UIO_FASTIOV, iovstack_l,
450+ &iov_l, 1);
451+ if (rc <= 0)
452+ goto free_iovecs;
453+ rc = compat_rw_copy_check_uvector(READ, rvec, riovcnt,
454+ UIO_FASTIOV, iovstack_r,
455+ &iov_r, 0);
456+ if (rc <= 0)
457+ goto free_iovecs;
458+
459+ rc = process_vm_rw_core(pid, iov_l, liovcnt, iov_r, riovcnt, flags,
460+ vm_write);
461+
462+free_iovecs:
463+ if (iov_r != iovstack_r)
464+ kfree(iov_r);
465+ if (iov_l != iovstack_l)
466+ kfree(iov_l);
467+
468+out:
469+ return rc;
470+}
471+
472+asmlinkage ssize_t
473+compat_sys_process_vm_readv(compat_pid_t pid,
474+ const struct compat_iovec __user *lvec,
475+ unsigned long liovcnt,
476+ const struct compat_iovec __user *rvec,
477+ unsigned long riovcnt,
478+ unsigned long flags)
479+{
480+ return compat_process_vm_rw(pid, lvec, liovcnt, rvec,
481+ riovcnt, flags, 0);
482+}
483+
484+asmlinkage ssize_t
485+compat_sys_process_vm_writev(compat_pid_t pid,
486+ const struct compat_iovec __user *lvec,
487+ unsigned long liovcnt,
488+ const struct compat_iovec __user *rvec,
489+ unsigned long riovcnt,
490+ unsigned long flags)
491+{
492+ return compat_process_vm_rw(pid, lvec, liovcnt, rvec,
493+ riovcnt, flags, 1);
494+}
495+
496+#endif
mm/rmap.c+1−1
@@ -1164,7 +1164,7 @@ void page_remove_rmap(struct page *page) · 1163 unmodified lines
11641164
11651165 /*
11661166 * Subfunctions of try_to_unmap: try_to_unmap_one called
1167− * repeatedly from either try_to_unmap_anon or try_to_unmap_file.
1167+ * repeatedly from try_to_unmap_ksm, try_to_unmap_anon or try_to_unmap_file.
11681168 */
11691169 int try_to_unmap_one(struct page *page, struct vm_area_struct *vma,
11701170 unsigned long address, enum ttu_flags flags)
mm/shmem.c+6−0
@@ -1068,6 +1068,12 @@ int shmem_lock(struct file *file, int lock, struct user_struct *user) · 1067 unmodified lines
10681068 user_shm_unlock(inode->i_size, user);
10691069 info->flags &= ~VM_LOCKED;
10701070 mapping_clear_unevictable(file->f_mapping);
1071+ /*
1072+ * Ensure that a racing putback_lru_page() can see
1073+ * the pages of this mapping are evictable when we
1074+ * skip them due to !PageLRU during the scan.
1075+ */
1076+ smp_mb__after_clear_bit();
10711077 scan_mapping_unevictable_pages(file->f_mapping);
10721078 }
10731079 retval = 0;
mm/slub.c+2−45
@@ -655,49 +655,6 @@ static void init_object(struct kmem_cache *s, void *object, u8 val) · 654 unmodified lines
655655 memset(p + s->objsize, val, s->inuse - s->objsize);
656656 }
657657
658−static u8 *check_bytes8(u8 *start, u8 value, unsigned int bytes)
659−{
660− while (bytes) {
661− if (*start != value)
662− return start;
663− start++;
664− bytes--;
665− }
666− return NULL;
667−}
668−
669−static u8 *check_bytes(u8 *start, u8 value, unsigned int bytes)
670−{
671− u64 value64;
672− unsigned int words, prefix;
673−
674− if (bytes <= 16)
675− return check_bytes8(start, value, bytes);
676−
677− value64 = value | value << 8 | value << 16 | value << 24;
678− value64 = (value64 & 0xffffffff) | value64 << 32;
679− prefix = 8 - ((unsigned long)start) % 8;
680−
681− if (prefix) {
682− u8 *r = check_bytes8(start, value, prefix);
683− if (r)
684− return r;
685− start += prefix;
686− bytes -= prefix;
687− }
688−
689− words = bytes / 8;
690−
691− while (words) {
692− if (*(u64 *)start != value64)
693− return check_bytes8(start, value, 8);
694− start += 8;
695− words--;
696− }
697−
698− return check_bytes8(start, value, bytes % 8);
699−}
700−
701658 static void restore_bytes(struct kmem_cache *s, char *message, u8 data,
702659 void *from, void *to)
703660 {
@@ -712,7 +669,7 @@ static int check_bytes_and_report(struct kmem_cache *s, struct page *page, · 8 unmodified lines
712669 u8 *fault;
713670 u8 *end;
714671
715− fault = check_bytes(start, value, bytes);
672+ fault = memchr_inv(start, value, bytes);
716673 if (!fault)
717674 return 1;
718675
@@ -805,7 +762,7 @@ static int slab_pad_check(struct kmem_cache *s, struct page *page) · 86 unmodified lines
805762 if (!remainder)
806763 return 1;
807764
808− fault = check_bytes(end - remainder, POISON_INUSE, remainder);
765+ fault = memchr_inv(end - remainder, POISON_INUSE, remainder);
809766 if (!fault)
810767 return 1;
811768 while (end > fault && end[-1] == POISON_INUSE)
mm/swapfile.c+1−1
@@ -1617,7 +1617,7 @@ SYSCALL_DEFINE1(swapoff, const char __user *, specialfile) · 1616 unmodified lines
16171617
16181618 oom_score_adj = test_set_oom_score_adj(OOM_SCORE_ADJ_MAX);
16191619 err = try_to_unuse(type);
1620− test_set_oom_score_adj(oom_score_adj);
1620+ compare_swap_oom_score_adj(OOM_SCORE_ADJ_MAX, oom_score_adj);
16211621
16221622 if (err) {
16231623 /*
mm/thrash.c+1−1
@@ -29,7 +29,7 @@ · 28 unmodified lines
2929
3030 static DEFINE_SPINLOCK(swap_token_lock);
3131 struct mm_struct *swap_token_mm;
32−struct mem_cgroup *swap_token_memcg;
32+static struct mem_cgroup *swap_token_memcg;
3333
3434 #ifdef CONFIG_CGROUP_MEM_RES_CTLR
3535 static struct mem_cgroup *swap_token_memcg_from_mm(struct mm_struct *mm)
mm/vmalloc.c+58−22
@@ -1253,18 +1253,22 @@ EXPORT_SYMBOL_GPL(map_vm_area); · 1252 unmodified lines
12531253 DEFINE_RWLOCK(vmlist_lock);
12541254 struct vm_struct *vmlist;
12551255
1256−static void insert_vmalloc_vm(struct vm_struct *vm, struct vmap_area *va,
1256+static void setup_vmalloc_vm(struct vm_struct *vm, struct vmap_area *va,
12571257 unsigned long flags, void *caller)
12581258 {
1259− struct vm_struct *tmp, **p;
1260−
12611259 vm->flags = flags;
12621260 vm->addr = (void *)va->va_start;
12631261 vm->size = va->va_end - va->va_start;
12641262 vm->caller = caller;
12651263 va->private = vm;
12661264 va->flags |= VM_VM_AREA;
1265+}
12671266
1267+static void insert_vmalloc_vmlist(struct vm_struct *vm)
1268+{
1269+ struct vm_struct *tmp, **p;
1270+
1271+ vm->flags &= ~VM_UNLIST;
12681272 write_lock(&vmlist_lock);
12691273 for (p = &vmlist; (tmp = *p) != NULL; p = &tmp->next) {
12701274 if (tmp->addr >= vm->addr)
@@ -1275,6 +1279,13 @@ static void insert_vmalloc_vm(struct vm_struct *vm, struct vmap_area *va, · 4 unmodified lines
12751279 write_unlock(&vmlist_lock);
12761280 }
12771281
1282+static void insert_vmalloc_vm(struct vm_struct *vm, struct vmap_area *va,
1283+ unsigned long flags, void *caller)
1284+{
1285+ setup_vmalloc_vm(vm, va, flags, caller);
1286+ insert_vmalloc_vmlist(vm);
1287+}
1288+
12781289 static struct vm_struct *__get_vm_area_node(unsigned long size,
12791290 unsigned long align, unsigned long flags, unsigned long start,
12801291 unsigned long end, int node, gfp_t gfp_mask, void *caller)
@@ -1313,7 +1324,18 @@ static struct vm_struct *__get_vm_area_node(unsigned long size, · 32 unmodified lines
13131324 return NULL;
13141325 }
13151326
1316− insert_vmalloc_vm(area, va, flags, caller);
1327+ /*
1328+ * When this function is called from __vmalloc_node_range,
1329+ * we do not add vm_struct to vmlist here to avoid
1330+ * accessing uninitialized members of vm_struct such as
1331+ * pages and nr_pages fields. They will be set later.
1332+ * To distinguish it from others, we use a VM_UNLIST flag.
1333+ */
1334+ if (flags & VM_UNLIST)
1335+ setup_vmalloc_vm(area, va, flags, caller);
1336+ else
1337+ insert_vmalloc_vm(area, va, flags, caller);
1338+
13171339 return area;
13181340 }
13191341
@@ -1381,17 +1403,20 @@ struct vm_struct *remove_vm_area(const void *addr) · 61 unmodified lines
13811403 va = find_vmap_area((unsigned long)addr);
13821404 if (va && va->flags & VM_VM_AREA) {
13831405 struct vm_struct *vm = va->private;
1384− struct vm_struct *tmp, **p;
1385− /*
1386− * remove from list and disallow access to this vm_struct
1387− * before unmap. (address range confliction is maintained by
1388− * vmap.)
1389− */
1390− write_lock(&vmlist_lock);
1391− for (p = &vmlist; (tmp = *p) != vm; p = &tmp->next)
1392− ;
1393− *p = tmp->next;
1394− write_unlock(&vmlist_lock);
1406+
1407+ if (!(vm->flags & VM_UNLIST)) {
1408+ struct vm_struct *tmp, **p;
1409+ /*
1410+ * remove from list and disallow access to
1411+ * this vm_struct before unmap. (address range
1412+ * confliction is maintained by vmap.)
1413+ */
1414+ write_lock(&vmlist_lock);
1415+ for (p = &vmlist; (tmp = *p) != vm; p = &tmp->next)
1416+ ;
1417+ *p = tmp->next;
1418+ write_unlock(&vmlist_lock);
1419+ }
13951420
13961421 vmap_debug_free_range(va->va_start, va->va_end);
13971422 free_unmap_vmap_area(va);
@@ -1568,8 +1593,8 @@ static void *__vmalloc_area_node(struct vm_struct *area, gfp_t gfp_mask, · 170 unmodified lines
15681593 return area->addr;
15691594
15701595 fail:
1571− warn_alloc_failed(gfp_mask, order, "vmalloc: allocation failure, "
1572− "allocated %ld of %ld bytes\n",
1596+ warn_alloc_failed(gfp_mask, order,
1597+ "vmalloc: allocation failure, allocated %ld of %ld bytes\n",
15731598 (area->nr_pages*PAGE_SIZE), area->size);
15741599 vfree(area->addr);
15751600 return NULL;
@@ -1600,16 +1625,21 @@ void *__vmalloc_node_range(unsigned long size, unsigned long align, · 24 unmodified lines
16001625
16011626 size = PAGE_ALIGN(size);
16021627 if (!size || (size >> PAGE_SHIFT) > totalram_pages)
1603− return NULL;
1604−
1605− area = __get_vm_area_node(size, align, VM_ALLOC, start, end, node,
1606− gfp_mask, caller);
1628+ goto fail;
16071629
1630+ area = __get_vm_area_node(size, align, VM_ALLOC | VM_UNLIST,
1631+ start, end, node, gfp_mask, caller);
16081632 if (!area)
1609− return NULL;
1633+ goto fail;
16101634
16111635 addr = __vmalloc_area_node(area, gfp_mask, prot, node, caller);
16121636
1637+ /*
1638+ * In this function, newly allocated vm_struct is not added
1639+ * to vmlist at __get_vm_area_node(). so, it is added here.
1640+ */
1641+ insert_vmalloc_vmlist(area);
1642+
16131643 /*
16141644 * A ref_count = 3 is needed because the vm_struct and vmap_area
16151645 * structures allocated in the __get_vm_area_node() function contain
@@ -1618,6 +1648,12 @@ void *__vmalloc_node_range(unsigned long size, unsigned long align, · 2 unmodified lines
16181648 kmemleak_alloc(addr, real_size, 3, gfp_mask);
16191649
16201650 return addr;
1651+
1652+fail:
1653+ warn_alloc_failed(gfp_mask, 0,
1654+ "vmalloc: allocation failure: %lu bytes\n",
1655+ real_size);
1656+ return NULL;
16211657 }
16221658
16231659 /**
mm/vmscan.c+177−148
@@ -495,15 +495,6 @@ static pageout_t pageout(struct page *page, struct address_space *mapping, · 494 unmodified lines
495495 return PAGE_ACTIVATE;
496496 }
497497
498− /*
499− * Wait on writeback if requested to. This happens when
500− * direct reclaiming a large contiguous area and the
501− * first attempt to free a range of pages fails.
502− */
503− if (PageWriteback(page) &&
504− (sc->reclaim_mode & RECLAIM_MODE_SYNC))
505− wait_on_page_writeback(page);
506−
507498 if (!PageWriteback(page)) {
508499 /* synchronous write or broken a_ops? */
509500 ClearPageReclaim(page);
@@ -642,13 +633,14 @@ redo: · 132 unmodified lines
642633 lru = LRU_UNEVICTABLE;
643634 add_page_to_unevictable_list(page);
644635 /*
645− * When racing with an mlock clearing (page is
646− * unlocked), make sure that if the other thread does
647− * not observe our setting of PG_lru and fails
648− * isolation, we see PG_mlocked cleared below and move
636+ * When racing with an mlock or AS_UNEVICTABLE clearing
637+ * (page is unlocked) make sure that if the other thread
638+ * does not observe our setting of PG_lru and fails
639+ * isolation/check_move_unevictable_page,
640+ * we see PG_mlocked/AS_UNEVICTABLE cleared below and move
649641 * the page back to the evictable list.
650642 *
651− * The other side is TestClearPageMlocked().
643+ * The other side is TestClearPageMlocked() or shmem_lock().
652644 */
653645 smp_mb();
654646 }
@@ -759,7 +751,10 @@ static noinline_for_stack void free_page_list(struct list_head *free_pages) · 104 unmodified lines
759751 */
760752 static unsigned long shrink_page_list(struct list_head *page_list,
761753 struct zone *zone,
762− struct scan_control *sc)
754+ struct scan_control *sc,
755+ int priority,
756+ unsigned long *ret_nr_dirty,
757+ unsigned long *ret_nr_writeback)
763758 {
764759 LIST_HEAD(ret_pages);
765760 LIST_HEAD(free_pages);
@@ -767,6 +762,7 @@ static unsigned long shrink_page_list(struct list_head *page_list, · 1 unmodified line
767762 unsigned long nr_dirty = 0;
768763 unsigned long nr_congested = 0;
769764 unsigned long nr_reclaimed = 0;
765+ unsigned long nr_writeback = 0;
770766
771767 cond_resched();
772768
@@ -803,13 +799,12 @@ static unsigned long shrink_page_list(struct list_head *page_list, · 30 unmodified lines
803799 (PageSwapCache(page) && (sc->gfp_mask & __GFP_IO));
804800
805801 if (PageWriteback(page)) {
802+ nr_writeback++;
806803 /*
807− * Synchronous reclaim is performed in two passes,
808− * first an asynchronous pass over the list to
809− * start parallel writeback, and a second synchronous
810− * pass to wait for the IO to complete. Wait here
811− * for any page for which writeback has already
812− * started.
804+ * Synchronous reclaim cannot queue pages for
805+ * writeback due to the possibility of stack overflow
806+ * but if it encounters a page under writeback, wait
807+ * for the IO to complete.
813808 */
814809 if ((sc->reclaim_mode & RECLAIM_MODE_SYNC) &&
815810 may_enter_fs)
@@ -865,6 +860,25 @@ static unsigned long shrink_page_list(struct list_head *page_list, · 49 unmodified lines
865860 if (PageDirty(page)) {
866861 nr_dirty++;
867862
863+ /*
864+ * Only kswapd can writeback filesystem pages to
865+ * avoid risk of stack overflow but do not writeback
866+ * unless under significant pressure.
867+ */
868+ if (page_is_file_cache(page) &&
869+ (!current_is_kswapd() || priority >= DEF_PRIORITY - 2)) {
870+ /*
871+ * Immediately reclaim when written back.
872+ * Similar in principal to deactivate_page()
873+ * except we already have the page isolated
874+ * and know it's dirty
875+ */
876+ inc_zone_page_state(page, NR_VMSCAN_IMMEDIATE);
877+ SetPageReclaim(page);
878+
879+ goto keep_locked;
880+ }
881+
868882 if (references == PAGEREF_RECLAIM_CLEAN)
869883 goto keep_locked;
870884 if (!may_enter_fs)
@@ -999,6 +1013,8 @@ keep_lumpy: · 128 unmodified lines
9991013
10001014 list_splice(&ret_pages, page_list);
10011015 count_vm_events(PGACTIVATE, pgactivate);
1016+ *ret_nr_dirty += nr_dirty;
1017+ *ret_nr_writeback += nr_writeback;
10021018 return nr_reclaimed;
10031019 }
10041020
@@ -1012,23 +1028,27 @@ keep_lumpy: · 7 unmodified lines
10121028 *
10131029 * returns 0 on success, -ve errno on failure.
10141030 */
1015−int __isolate_lru_page(struct page *page, int mode, int file)
1031+int __isolate_lru_page(struct page *page, isolate_mode_t mode, int file)
10161032 {
1033+ bool all_lru_mode;
10171034 int ret = -EINVAL;
10181035
10191036 /* Only take pages on the LRU. */
10201037 if (!PageLRU(page))
10211038 return ret;
10221039
1040+ all_lru_mode = (mode & (ISOLATE_ACTIVE|ISOLATE_INACTIVE)) ==
1041+ (ISOLATE_ACTIVE|ISOLATE_INACTIVE);
1042+
10231043 /*
10241044 * When checking the active state, we need to be sure we are
10251045 * dealing with comparible boolean values. Take the logical not
10261046 * of each.
10271047 */
1028− if (mode != ISOLATE_BOTH && (!PageActive(page) != !mode))
1048+ if (!all_lru_mode && !PageActive(page) != !(mode & ISOLATE_ACTIVE))
10291049 return ret;
10301050
1031− if (mode != ISOLATE_BOTH && page_is_file_cache(page) != file)
1051+ if (!all_lru_mode && !!page_is_file_cache(page) != file)
10321052 return ret;
10331053
10341054 /*
@@ -1041,6 +1061,12 @@ int __isolate_lru_page(struct page *page, int mode, int file) · 6 unmodified lines
10411061
10421062 ret = -EBUSY;
10431063
1064+ if ((mode & ISOLATE_CLEAN) && (PageDirty(page) || PageWriteback(page)))
1065+ return ret;
1066+
1067+ if ((mode & ISOLATE_UNMAPPED) && page_mapped(page))
1068+ return ret;
1069+
10441070 if (likely(get_page_unless_zero(page))) {
10451071 /*
10461072 * Be careful not to clear PageLRU until after we're
@@ -1076,7 +1102,8 @@ int __isolate_lru_page(struct page *page, int mode, int file) · 29 unmodified lines
10761102 */
10771103 static unsigned long isolate_lru_pages(unsigned long nr_to_scan,
10781104 struct list_head *src, struct list_head *dst,
1079− unsigned long *scanned, int order, int mode, int file)
1105+ unsigned long *scanned, int order, isolate_mode_t mode,
1106+ int file)
10801107 {
10811108 unsigned long nr_taken = 0;
10821109 unsigned long nr_lumpy_taken = 0;
@@ -1201,8 +1228,8 @@ static unsigned long isolate_lru_pages(unsigned long nr_to_scan, · 118 unmodified lines
12011228 static unsigned long isolate_pages_global(unsigned long nr,
12021229 struct list_head *dst,
12031230 unsigned long *scanned, int order,
1204− int mode, struct zone *z,
1205− int active, int file)
1231+ isolate_mode_t mode,
1232+ struct zone *z, int active, int file)
12061233 {
12071234 int lru = LRU_BASE;
12081235 if (active)
@@ -1394,7 +1421,7 @@ static noinline_for_stack void update_isolated_counts(struct zone *zone, · 185 unmodified lines
13941421 }
13951422
13961423 /*
1397− * Returns true if the caller should wait to clean dirty/writeback pages.
1424+ * Returns true if a direct reclaim should wait on pages under writeback.
13981425 *
13991426 * If we are direct reclaiming for contiguous pages and we do not reclaim
14001427 * everything in the list, try again and wait for writeback IO to complete.
@@ -1448,6 +1475,9 @@ shrink_inactive_list(unsigned long nr_to_scan, struct zone *zone, · 47 unmodified lines
14481475 unsigned long nr_taken;
14491476 unsigned long nr_anon;
14501477 unsigned long nr_file;
1478+ unsigned long nr_dirty = 0;
1479+ unsigned long nr_writeback = 0;
1480+ isolate_mode_t reclaim_mode = ISOLATE_INACTIVE;
14511481
14521482 while (unlikely(too_many_isolated(zone, file, sc))) {
14531483 congestion_wait(BLK_RW_ASYNC, HZ/10);
@@ -1458,15 +1488,21 @@ shrink_inactive_list(unsigned long nr_to_scan, struct zone *zone, · 4 unmodified lines
14581488 }
14591489
14601490 set_reclaim_mode(priority, sc, false);
1491+ if (sc->reclaim_mode & RECLAIM_MODE_LUMPYRECLAIM)
1492+ reclaim_mode |= ISOLATE_ACTIVE;
1493+
14611494 lru_add_drain();
1495+
1496+ if (!sc->may_unmap)
1497+ reclaim_mode |= ISOLATE_UNMAPPED;
1498+ if (!sc->may_writepage)
1499+ reclaim_mode |= ISOLATE_CLEAN;
1500+
14621501 spin_lock_irq(&zone->lru_lock);
14631502
14641503 if (scanning_global_lru(sc)) {
1465− nr_taken = isolate_pages_global(nr_to_scan,
1466− &page_list, &nr_scanned, sc->order,
1467− sc->reclaim_mode & RECLAIM_MODE_LUMPYRECLAIM ?
1468− ISOLATE_BOTH : ISOLATE_INACTIVE,
1469− zone, 0, file);
1504+ nr_taken = isolate_pages_global(nr_to_scan, &page_list,
1505+ &nr_scanned, sc->order, reclaim_mode, zone, 0, file);
14701506 zone->pages_scanned += nr_scanned;
14711507 if (current_is_kswapd())
14721508 __count_zone_vm_events(PGSCAN_KSWAPD, zone,
@@ -1475,12 +1511,9 @@ shrink_inactive_list(unsigned long nr_to_scan, struct zone *zone, · 2 unmodified lines
14751511 __count_zone_vm_events(PGSCAN_DIRECT, zone,
14761512 nr_scanned);
14771513 } else {
1478− nr_taken = mem_cgroup_isolate_pages(nr_to_scan,
1479− &page_list, &nr_scanned, sc->order,
1480− sc->reclaim_mode & RECLAIM_MODE_LUMPYRECLAIM ?
1481− ISOLATE_BOTH : ISOLATE_INACTIVE,
1482− zone, sc->mem_cgroup,
1483− 0, file);
1514+ nr_taken = mem_cgroup_isolate_pages(nr_to_scan, &page_list,
1515+ &nr_scanned, sc->order, reclaim_mode, zone,
1516+ sc->mem_cgroup, 0, file);
14841517 /*
14851518 * mem_cgroup_isolate_pages() keeps track of
14861519 * scanned pages on its own.
@@ -1496,12 +1529,14 @@ shrink_inactive_list(unsigned long nr_to_scan, struct zone *zone, · 9 unmodified lines
14961529
14971530 spin_unlock_irq(&zone->lru_lock);
14981531
1499− nr_reclaimed = shrink_page_list(&page_list, zone, sc);
1532+ nr_reclaimed = shrink_page_list(&page_list, zone, sc, priority,
1533+ &nr_dirty, &nr_writeback);
15001534
15011535 /* Check if we should syncronously wait for writeback */
15021536 if (should_reclaim_stall(nr_taken, nr_reclaimed, priority, sc)) {
15031537 set_reclaim_mode(priority, sc, true);
1504− nr_reclaimed += shrink_page_list(&page_list, zone, sc);
1538+ nr_reclaimed += shrink_page_list(&page_list, zone, sc,
1539+ priority, &nr_dirty, &nr_writeback);
15051540 }
15061541
15071542 local_irq_disable();
@@ -1511,6 +1546,32 @@ shrink_inactive_list(unsigned long nr_to_scan, struct zone *zone, · 3 unmodified lines
15111546
15121547 putback_lru_pages(zone, sc, nr_anon, nr_file, &page_list);
15131548
1549+ /*
1550+ * If reclaim is isolating dirty pages under writeback, it implies
1551+ * that the long-lived page allocation rate is exceeding the page
1552+ * laundering rate. Either the global limits are not being effective
1553+ * at throttling processes due to the page distribution throughout
1554+ * zones or there is heavy usage of a slow backing device. The
1555+ * only option is to throttle from reclaim context which is not ideal
1556+ * as there is no guarantee the dirtying process is throttled in the
1557+ * same way balance_dirty_pages() manages.
1558+ *
1559+ * This scales the number of dirty pages that must be under writeback
1560+ * before throttling depending on priority. It is a simple backoff
1561+ * function that has the most effect in the range DEF_PRIORITY to
1562+ * DEF_PRIORITY-2 which is the priority reclaim is considered to be
1563+ * in trouble and reclaim is considered to be in trouble.
1564+ *
1565+ * DEF_PRIORITY 100% isolated pages must be PageWriteback to throttle
1566+ * DEF_PRIORITY-1 50% must be PageWriteback
1567+ * DEF_PRIORITY-2 25% must be PageWriteback, kswapd in trouble
1568+ * ...
1569+ * DEF_PRIORITY-6 For SWAP_CLUSTER_MAX isolated pages, throttle if any
1570+ * isolated page is PageWriteback
1571+ */
1572+ if (nr_writeback && nr_writeback >= (nr_taken >> (DEF_PRIORITY-priority)))
1573+ wait_iff_congested(zone, BLK_RW_ASYNC, HZ/10);
1574+
15141575 trace_mm_vmscan_lru_shrink_inactive(zone->zone_pgdat->node_id,
15151576 zone_idx(zone),
15161577 nr_scanned, nr_reclaimed,
@@ -1582,19 +1643,26 @@ static void shrink_active_list(unsigned long nr_pages, struct zone *zone, · 65 unmodified lines
15821643 struct page *page;
15831644 struct zone_reclaim_stat *reclaim_stat = get_reclaim_stat(zone, sc);
15841645 unsigned long nr_rotated = 0;
1646+ isolate_mode_t reclaim_mode = ISOLATE_ACTIVE;
15851647
15861648 lru_add_drain();
1649+
1650+ if (!sc->may_unmap)
1651+ reclaim_mode |= ISOLATE_UNMAPPED;
1652+ if (!sc->may_writepage)
1653+ reclaim_mode |= ISOLATE_CLEAN;
1654+
15871655 spin_lock_irq(&zone->lru_lock);
15881656 if (scanning_global_lru(sc)) {
15891657 nr_taken = isolate_pages_global(nr_pages, &l_hold,
15901658 &pgscanned, sc->order,
1591− ISOLATE_ACTIVE, zone,
1659+ reclaim_mode, zone,
15921660 1, file);
15931661 zone->pages_scanned += pgscanned;
15941662 } else {
15951663 nr_taken = mem_cgroup_isolate_pages(nr_pages, &l_hold,
15961664 &pgscanned, sc->order,
1597− ISOLATE_ACTIVE, zone,
1665+ reclaim_mode, zone,
15981666 sc->mem_cgroup, 1, file);
15991667 /*
16001668 * mem_cgroup_isolate_pages() keeps track of
@@ -1795,12 +1863,19 @@ static void get_scan_count(struct zone *zone, struct scan_control *sc, · 194 unmodified lines
17951863 enum lru_list l;
17961864 int noswap = 0;
17971865 bool force_scan = false;
1798− unsigned long nr_force_scan[2];
17991866
1800− /* kswapd does zone balancing and needs to scan this zone */
1867+ /*
1868+ * If the zone or memcg is small, nr[l] can be 0. This
1869+ * results in no scanning on this priority and a potential
1870+ * priority drop. Global direct reclaim can go to the next
1871+ * zone and tends to have no problems. Global kswapd is for
1872+ * zone balancing and it needs to scan a minimum amount. When
1873+ * reclaiming for a memcg, a priority drop can cause high
1874+ * latencies, so it's better to scan a minimum amount there as
1875+ * well.
1876+ */
18011877 if (scanning_global_lru(sc) && current_is_kswapd())
18021878 force_scan = true;
1803− /* memcg may have small limit and need to avoid priority drop */
18041879 if (!scanning_global_lru(sc))
18051880 force_scan = true;
18061881
@@ -1810,8 +1885,6 @@ static void get_scan_count(struct zone *zone, struct scan_control *sc, · 3 unmodified lines
18101885 fraction[0] = 0;
18111886 fraction[1] = 1;
18121887 denominator = 1;
1813− nr_force_scan[0] = 0;
1814− nr_force_scan[1] = SWAP_CLUSTER_MAX;
18151888 goto out;
18161889 }
18171890
@@ -1828,8 +1901,6 @@ static void get_scan_count(struct zone *zone, struct scan_control *sc, · 10 unmodified lines
18281901 fraction[0] = 1;
18291902 fraction[1] = 0;
18301903 denominator = 1;
1831− nr_force_scan[0] = SWAP_CLUSTER_MAX;
1832− nr_force_scan[1] = 0;
18331904 goto out;
18341905 }
18351906 }
@@ -1878,11 +1949,6 @@ static void get_scan_count(struct zone *zone, struct scan_control *sc, · 42 unmodified lines
18781949 fraction[0] = ap;
18791950 fraction[1] = fp;
18801951 denominator = ap + fp + 1;
1881− if (force_scan) {
1882− unsigned long scan = SWAP_CLUSTER_MAX;
1883− nr_force_scan[0] = div64_u64(scan * ap, denominator);
1884− nr_force_scan[1] = div64_u64(scan * fp, denominator);
1885− }
18861952 out:
18871953 for_each_evictable_lru(l) {
18881954 int file = is_file_lru(l);
@@ -1891,20 +1957,10 @@ out: · 2 unmodified lines
18911957 scan = zone_nr_lru_pages(zone, sc, l);
18921958 if (priority || noswap) {
18931959 scan >>= priority;
1960+ if (!scan && force_scan)
1961+ scan = SWAP_CLUSTER_MAX;
18941962 scan = div64_u64(scan * fraction[file], denominator);
18951963 }
1896−
1897− /*
1898− * If zone is small or memcg is small, nr[l] can be 0.
1899− * This results no-scan on this priority and priority drop down.
1900− * For global direct reclaim, it can visit next zone and tend
1901− * not to have problems. For global kswapd, it's for zone
1902− * balancing and it need to scan a small amounts. When using
1903− * memcg, priority drop can cause big latency. So, it's better
1904− * to scan small amount. See may_noscan above.
1905− */
1906− if (!scan && force_scan)
1907− scan = nr_force_scan[file];
19081964 nr[l] = scan;
19091965 }
19101966 }
@@ -1983,12 +2039,14 @@ static void shrink_zone(int priority, struct zone *zone, · 72 unmodified lines
19832039 enum lru_list l;
19842040 unsigned long nr_reclaimed, nr_scanned;
19852041 unsigned long nr_to_reclaim = sc->nr_to_reclaim;
2042+ struct blk_plug plug;
19862043
19872044 restart:
19882045 nr_reclaimed = 0;
19892046 nr_scanned = sc->nr_scanned;
19902047 get_scan_count(zone, sc, nr, priority);
19912048
2049+ blk_start_plug(&plug);
19922050 while (nr[LRU_INACTIVE_ANON] || nr[LRU_ACTIVE_FILE] ||
19932051 nr[LRU_INACTIVE_FILE]) {
19942052 for_each_evictable_lru(l) {
@@ -2012,6 +2070,7 @@ restart: · 17 unmodified lines
20122070 if (nr_reclaimed >= nr_to_reclaim && priority < DEF_PRIORITY)
20132071 break;
20142072 }
2073+ blk_finish_plug(&plug);
20152074 sc->nr_reclaimed += nr_reclaimed;
20162075
20172076 /*
@@ -2044,14 +2103,19 @@ restart: · 26 unmodified lines
20442103 *
20452104 * If a zone is deemed to be full of pinned pages then just give it a light
20462105 * scan then give up on it.
2106+ *
2107+ * This function returns true if a zone is being reclaimed for a costly
2108+ * high-order allocation and compaction is either ready to begin or deferred.
2109+ * This indicates to the caller that it should retry the allocation or fail.
20472110 */
2048−static void shrink_zones(int priority, struct zonelist *zonelist,
2111+static bool shrink_zones(int priority, struct zonelist *zonelist,
20492112 struct scan_control *sc)
20502113 {
20512114 struct zoneref *z;
20522115 struct zone *zone;
20532116 unsigned long nr_soft_reclaimed;
20542117 unsigned long nr_soft_scanned;
2118+ bool should_abort_reclaim = false;
20552119
20562120 for_each_zone_zonelist_nodemask(zone, z, zonelist,
20572121 gfp_zone(sc->gfp_mask), sc->nodemask) {
@@ -2066,6 +2130,23 @@ static void shrink_zones(int priority, struct zonelist *zonelist, · 8 unmodified lines
20662130 continue;
20672131 if (zone->all_unreclaimable && priority != DEF_PRIORITY)
20682132 continue; /* Let kswapd poll it */
2133+ if (COMPACTION_BUILD) {
2134+ /*
2135+ * If we already have plenty of memory free for
2136+ * compaction in this zone, don't free any more.
2137+ * Even though compaction is invoked for any
2138+ * non-zero order, only frequent costly order
2139+ * reclamation is disruptive enough to become a
2140+ * noticable problem, like transparent huge page
2141+ * allocations.
2142+ */
2143+ if (sc->order > PAGE_ALLOC_COSTLY_ORDER &&
2144+ (compaction_suitable(zone, sc->order) ||
2145+ compaction_deferred(zone))) {
2146+ should_abort_reclaim = true;
2147+ continue;
2148+ }
2149+ }
20692150 /*
20702151 * This steals pages from memory cgroups over softlimit
20712152 * and returns the number of reclaimed pages and
@@ -2083,6 +2164,8 @@ static void shrink_zones(int priority, struct zonelist *zonelist, · 11 unmodified lines
20832164
20842165 shrink_zone(priority, zone, sc);
20852166 }
2167+
2168+ return should_abort_reclaim;
20862169 }
20872170
20882171 static bool zone_reclaimable(struct zone *zone)
@@ -2147,7 +2230,9 @@ static unsigned long do_try_to_free_pages(struct zonelist *zonelist, · 58 unmodified lines
21472230 sc->nr_scanned = 0;
21482231 if (!priority)
21492232 disable_swap_token(sc->mem_cgroup);
2150− shrink_zones(priority, zonelist, sc);
2233+ if (shrink_zones(priority, zonelist, sc))
2234+ break;
2235+
21512236 /*
21522237 * Don't shrink slabs when reclaiming memory from
21532238 * over limit cgroups
@@ -2690,6 +2775,8 @@ out: · 536 unmodified lines
26902775
26912776 /* If balanced, clear the congested flag */
26922777 zone_clear_flag(zone, ZONE_CONGESTED);
2778+ if (i <= *classzone_idx)
2779+ balanced += zone->present_pages;
26932780 }
26942781 }
26952782
@@ -2763,7 +2850,9 @@ static void kswapd_try_to_sleep(pg_data_t *pgdat, int order, int classzone_idx) · 67 unmodified lines
27632850 static int kswapd(void *p)
27642851 {
27652852 unsigned long order, new_order;
2853+ unsigned balanced_order;
27662854 int classzone_idx, new_classzone_idx;
2855+ int balanced_classzone_idx;
27672856 pg_data_t *pgdat = (pg_data_t*)p;
27682857 struct task_struct *tsk = current;
27692858
@@ -2794,7 +2883,9 @@ static int kswapd(void *p) · 24 unmodified lines
27942883 set_freezable();
27952884
27962885 order = new_order = 0;
2886+ balanced_order = 0;
27972887 classzone_idx = new_classzone_idx = pgdat->nr_zones - 1;
2888+ balanced_classzone_idx = classzone_idx;
27982889 for ( ; ; ) {
27992890 int ret;
28002891
@@ -2803,7 +2894,8 @@ static int kswapd(void *p) · 2 unmodified lines
28032894 * new request of a similar or harder type will succeed soon
28042895 * so consider going to sleep on the basis we reclaimed at
28052896 */
2806− if (classzone_idx >= new_classzone_idx && order == new_order) {
2897+ if (balanced_classzone_idx >= new_classzone_idx &&
2898+ balanced_order == new_order) {
28072899 new_order = pgdat->kswapd_max_order;
28082900 new_classzone_idx = pgdat->classzone_idx;
28092901 pgdat->kswapd_max_order = 0;
@@ -2818,9 +2910,12 @@ static int kswapd(void *p) · 8 unmodified lines
28182910 order = new_order;
28192911 classzone_idx = new_classzone_idx;
28202912 } else {
2821− kswapd_try_to_sleep(pgdat, order, classzone_idx);
2913+ kswapd_try_to_sleep(pgdat, balanced_order,
2914+ balanced_classzone_idx);
28222915 order = pgdat->kswapd_max_order;
28232916 classzone_idx = pgdat->classzone_idx;
2917+ new_order = order;
2918+ new_classzone_idx = classzone_idx;
28242919 pgdat->kswapd_max_order = 0;
28252920 pgdat->classzone_idx = pgdat->nr_zones - 1;
28262921 }
@@ -2835,7 +2930,9 @@ static int kswapd(void *p) · 8 unmodified lines
28352930 */
28362931 if (!ret) {
28372932 trace_mm_vmscan_kswapd_wake(pgdat->node_id, order);
2838− order = balance_pgdat(pgdat, order, &classzone_idx);
2933+ balanced_classzone_idx = classzone_idx;
2934+ balanced_order = balance_pgdat(pgdat, order,
2935+ &balanced_classzone_idx);
28392936 }
28402937 }
28412938 return 0;
@@ -3347,66 +3444,12 @@ void scan_mapping_unevictable_pages(struct address_space *mapping) · 505 unmodified lines
33473444
33483445 }
33493446
3350−/**
3351− * scan_zone_unevictable_pages - check unevictable list for evictable pages
3352− * @zone - zone of which to scan the unevictable list
3353− *
3354− * Scan @zone's unevictable LRU lists to check for pages that have become
3355− * evictable. Move those that have to @zone's inactive list where they
3356− * become candidates for reclaim, unless shrink_inactive_zone() decides
3357− * to reactivate them. Pages that are still unevictable are rotated
3358− * back onto @zone's unevictable list.
3359− */
3360−#define SCAN_UNEVICTABLE_BATCH_SIZE 16UL /* arbitrary lock hold batch size */
3361−static void scan_zone_unevictable_pages(struct zone *zone)
3447+static void warn_scan_unevictable_pages(void)
33623448 {
3363− struct list_head *l_unevictable = &zone->lru[LRU_UNEVICTABLE].list;
3364− unsigned long scan;
3365− unsigned long nr_to_scan = zone_page_state(zone, NR_UNEVICTABLE);
3366−
3367− while (nr_to_scan > 0) {
3368− unsigned long batch_size = min(nr_to_scan,
3369− SCAN_UNEVICTABLE_BATCH_SIZE);
3370−
3371− spin_lock_irq(&zone->lru_lock);
3372− for (scan = 0; scan < batch_size; scan++) {
3373− struct page *page = lru_to_page(l_unevictable);
3374−
3375− if (!trylock_page(page))
3376− continue;
3377−
3378− prefetchw_prev_lru_page(page, l_unevictable, flags);
3379−
3380− if (likely(PageLRU(page) && PageUnevictable(page)))
3381− check_move_unevictable_page(page, zone);
3382−
3383− unlock_page(page);
3384− }
3385− spin_unlock_irq(&zone->lru_lock);
3386−
3387− nr_to_scan -= batch_size;
3388− }
3389−}
3390−
3391−
3392−/**
3393− * scan_all_zones_unevictable_pages - scan all unevictable lists for evictable pages
3394− *
3395− * A really big hammer: scan all zones' unevictable LRU lists to check for
3396− * pages that have become evictable. Move those back to the zones'
3397− * inactive list where they become candidates for reclaim.
3398− * This occurs when, e.g., we have unswappable pages on the unevictable lists,
3399− * and we add swap to the system. As such, it runs in the context of a task
3400− * that has possibly/probably made some previously unevictable pages
3401− * evictable.
3402− */
3403−static void scan_all_zones_unevictable_pages(void)
3404−{
3405− struct zone *zone;
3406−
3407− for_each_zone(zone) {
3408− scan_zone_unevictable_pages(zone);
3409− }
3449+ printk_once(KERN_WARNING
3450+ "The scan_unevictable_pages sysctl/node-interface has been "
3451+ "disabled for lack of a legitimate use case. If you have "
3452+ "one, please send an email to linux-mm@kvack.org.\n");
34103453 }
34113454
34123455 /*
@@ -3419,11 +3462,8 @@ int scan_unevictable_handler(struct ctl_table *table, int write, · 6 unmodified lines
34193462 void __user *buffer,
34203463 size_t *length, loff_t *ppos)
34213464 {
3465+ warn_scan_unevictable_pages();
34223466 proc_doulongvec_minmax(table, write, buffer, length, ppos);
3423−
3424− if (write && *(unsigned long *)table->data)
3425− scan_all_zones_unevictable_pages();
3426−
34273467 scan_unevictable_pages = 0;
34283468 return 0;
34293469 }
@@ -3438,6 +3478,7 @@ static ssize_t read_scan_unevictable_node(struct sys_device *dev, · 8 unmodified lines
34383478 struct sysdev_attribute *attr,
34393479 char *buf)
34403480 {
3481+ warn_scan_unevictable_pages();
34413482 return sprintf(buf, "0\n"); /* always zero; should fit... */
34423483 }
34433484
@@ -3445,19 +3486,7 @@ static ssize_t write_scan_unevictable_node(struct sys_device *dev, · 1 unmodified line
34453486 struct sysdev_attribute *attr,
34463487 const char *buf, size_t count)
34473488 {
3448− struct zone *node_zones = NODE_DATA(dev->id)->node_zones;
3449− struct zone *zone;
3450− unsigned long res;
3451− unsigned long req = strict_strtoul(buf, 10, &res);
3452−
3453− if (!req)
3454− return 1; /* zero is no-op */
3455−
3456− for (zone = node_zones; zone - node_zones < MAX_NR_ZONES; ++zone) {
3457− if (!populated_zone(zone))
3458− continue;
3459− scan_zone_unevictable_pages(zone);
3460− }
3489+ warn_scan_unevictable_pages();
34613490 return 1;
34623491 }
34633492
mm/vmstat.c+2−1
@@ -78,7 +78,7 @@ void vm_events_fold_cpu(int cpu) · 77 unmodified lines
7878 *
7979 * vm_stat contains the global counters
8080 */
81−atomic_long_t vm_stat[NR_VM_ZONE_STAT_ITEMS];
81+atomic_long_t vm_stat[NR_VM_ZONE_STAT_ITEMS] __cacheline_aligned_in_smp;
8282 EXPORT_SYMBOL(vm_stat);
8383
8484 #ifdef CONFIG_SMP
@@ -702,6 +702,7 @@ const char * const vmstat_text[] = { · 617 unmodified lines
702702 "nr_unstable",
703703 "nr_bounce",
704704 "nr_vmscan_write",
705+ "nr_vmscan_immediate_reclaim",
705706 "nr_writeback_temp",
706707 "nr_isolated_anon",
707708 "nr_isolated_file",
net/nfc/nfc.h+1−1
@@ -27,7 +27,7 @@ · 26 unmodified lines
2727 #include <net/nfc/nfc.h>
2828 #include <net/sock.h>
2929
30−__attribute__((format (printf, 2, 3)))
30+__printf(2, 3)
3131 int nfc_printk(const char *level, const char *fmt, ...);
3232
3333 #define nfc_info(fmt, arg...) nfc_printk(KERN_INFO, fmt, ##arg)
net/rds/rds.h+4−4
@@ -36,8 +36,8 @@ · 35 unmodified lines
3636 #define rdsdebug(fmt, args...) pr_debug("%s(): " fmt, __func__ , ##args)
3737 #else
3838 /* sigh, pr_debug() causes unused variable warnings */
39−static inline void __attribute__ ((format (printf, 1, 2)))
40−rdsdebug(char *fmt, ...)
39+static inline __printf(1, 2)
40+void rdsdebug(char *fmt, ...)
4141 {
4242 }
4343 #endif
@@ -625,8 +625,8 @@ void rds_for_each_conn_info(struct socket *sock, unsigned int len, · 581 unmodified lines
625625 struct rds_info_lengths *lens,
626626 int (*visitor)(struct rds_connection *, void *),
627627 size_t item_len);
628−void __rds_conn_error(struct rds_connection *conn, const char *, ...)
629− __attribute__ ((format (printf, 2, 3)));
628+__printf(2, 3)
629+void __rds_conn_error(struct rds_connection *conn, const char *, ...);
630630 #define rds_conn_error(conn, fmt...) \
631631 __rds_conn_error(conn, KERN_WARNING "RDS: " fmt)
632632
net/sunrpc/svc.c+2−3
@@ -971,9 +971,8 @@ static void svc_unregister(const struct svc_serv *serv) · 970 unmodified lines
971971 /*
972972 * Printk the given error with the address of the client that caused it.
973973 */
974−static int
975−__attribute__ ((format (printf, 2, 3)))
976−svc_printk(struct svc_rqst *rqstp, const char *fmt, ...)
974+static __printf(2, 3)
975+int svc_printk(struct svc_rqst *rqstp, const char *fmt, ...)
977976 {
978977 va_list args;
979978 int r;
scripts/checkpatch.pl+29−7
@@ -240,9 +240,8 @@ our $NonptrType; · 239 unmodified lines
240240 our $Type;
241241 our $Declare;
242242
243−our $UTF8 = qr {
244− [\x09\x0A\x0D\x20-\x7E] # ASCII
245− | [\xC2-\xDF][\x80-\xBF] # non-overlong 2-byte
243+our $NON_ASCII_UTF8 = qr{
244+ [\xC2-\xDF][\x80-\xBF] # non-overlong 2-byte
246245 | \xE0[\xA0-\xBF][\x80-\xBF] # excluding overlongs
247246 | [\xE1-\xEC\xEE\xEF][\x80-\xBF]{2} # straight 3-byte
248247 | \xED[\x80-\x9F][\x80-\xBF] # excluding surrogates
@@ -251,6 +250,11 @@ our $UTF8 = qr { · 2 unmodified lines
251250 | \xF4[\x80-\x8F][\x80-\xBF]{2} # plane 16
252251 }x;
253252
253+our $UTF8 = qr{
254+ [\x09\x0A\x0D\x20-\x7E] # ASCII
255+ | $NON_ASCII_UTF8
256+}x;
257+
254258 our $typeTypedefs = qr{(?x:
255259 (?:__)?(?:u|s|be|le)(?:8|16|32|64)|
256260 atomic_t
@@ -1330,6 +1334,9 @@ sub process { · 1073 unmodified lines
13301334 my $signoff = 0;
13311335 my $is_patch = 0;
13321336
1337+ my $in_header_lines = 1;
1338+ my $in_commit_log = 0; #Scanning lines before patch
1339+
13331340 our @report = ();
13341341 our $cnt_lines = 0;
13351342 our $cnt_error = 0;
@@ -1497,7 +1504,6 @@ sub process { · 161 unmodified lines
14971504 if ($line =~ /^diff --git.*?(\S+)$/) {
14981505 $realfile = $1;
14991506 $realfile =~ s@^([^/]*)/@@;
1500−
15011507 } elsif ($line =~ /^\+\+\+\s+(\S+)/) {
15021508 $realfile = $1;
15031509 $realfile =~ s@^([^/]*)/@@;
@@ -1536,6 +1542,7 @@ sub process { · 32 unmodified lines
15361542 # Check the patch for a signoff:
15371543 if ($line =~ /^\s*signed-off-by:/i) {
15381544 $signoff++;
1545+ $in_commit_log = 0;
15391546 }
15401547
15411548 # Check signature styles
@@ -1613,6 +1620,21 @@ sub process { · 71 unmodified lines
16131620 "Invalid UTF-8, patch and commit message should be encoded in UTF-8\n" . $hereptr);
16141621 }
16151622
1623+# Check if it's the start of a commit log
1624+# (not a header line and we haven't seen the patch filename)
1625+ if ($in_header_lines && $realfile =~ /^$/ &&
1626+ $rawline !~ /^(commit\b|from\b|\w+:).+$/i) {
1627+ $in_header_lines = 0;
1628+ $in_commit_log = 1;
1629+ }
1630+
1631+# Still not yet in a patch, check for any UTF-8
1632+ if ($in_commit_log && $realfile =~ /^$/ &&
1633+ $rawline =~ /$NON_ASCII_UTF8/) {
1634+ CHK("UTF8_BEFORE_PATCH",
1635+ "8-bit UTF-8 used in possible commit log\n" . $herecurr);
1636+ }
1637+
16161638 # ignore non-hunk lines and lines being removed
16171639 next if (!$hunk_line || $line =~ /^-/);
16181640
@@ -3151,10 +3173,10 @@ sub process { · 1532 unmodified lines
31513173 "consider using a completion\n" . $herecurr);
31523174
31533175 }
3154−# recommend kstrto* over simple_strto*
3155− if ($line =~ /\bsimple_(strto.*?)\s*\(/) {
3176+# recommend kstrto* over simple_strto* and strict_strto*
3177+ if ($line =~ /\b((simple|strict)_(strto(l|ll|ul|ull)))\s*\(/) {
31563178 WARN("CONSIDER_KSTRTO",
3157− "consider using kstrto* in preference to simple_$1\n" . $herecurr);
3179+ "$1 is obsolete, use k$3 instead\n" . $herecurr);
31583180 }
31593181 # check for __initcall(), use device_initcall() explicitly please
31603182 if ($line =~ /^.\s*__initcall\s*\(/) {
security/keys/compat.c+1−1
@@ -38,7 +38,7 @@ long compat_keyctl_instantiate_key_iov( · 37 unmodified lines
3838
3939 ret = compat_rw_copy_check_uvector(WRITE, _payload_iov, ioc,
4040 ARRAY_SIZE(iovstack),
41− iovstack, &iov);
41+ iovstack, &iov, 1);
4242 if (ret < 0)
4343 return ret;
4444 if (ret == 0)
security/keys/encrypted-keys/encrypted.c+1−1
@@ -293,7 +293,7 @@ static char *datablob_format(struct encrypted_key_payload *epayload, · 292 unmodified lines
293293 /* convert the hex encoded iv, encrypted-data and HMAC to ascii */
294294 bufp = &ascii_buf[len];
295295 for (i = 0; i < (asciiblob_len - len) / 2; i++)
296− bufp = pack_hex_byte(bufp, iv[i]);
296+ bufp = hex_byte_pack(bufp, iv[i]);
297297 out:
298298 return ascii_buf;
299299 }
security/keys/keyctl.c+1−1
@@ -1065,7 +1065,7 @@ long keyctl_instantiate_key_iov(key_serial_t id, · 1064 unmodified lines
10651065 goto no_payload;
10661066
10671067 ret = rw_copy_check_uvector(WRITE, _payload_iov, ioc,
1068− ARRAY_SIZE(iovstack), iovstack, &iov);
1068+ ARRAY_SIZE(iovstack), iovstack, &iov, 1);
10691069 if (ret < 0)
10701070 return ret;
10711071 if (ret == 0)
security/keys/trusted.c+1−1
@@ -1098,7 +1098,7 @@ static long trusted_read(const struct key *key, char __user *buffer, · 1097 unmodified lines
10981098
10991099 bufp = ascii_buf;
11001100 for (i = 0; i < p->blob_len; i++)
1101− bufp = pack_hex_byte(bufp, p->blob[i]);
1101+ bufp = hex_byte_pack(bufp, p->blob[i]);
11021102 if ((copy_to_user(buffer, ascii_buf, 2 * p->blob_len)) != 0) {
11031103 kfree(ascii_buf);
11041104 return -EFAULT;
sound/firewire/cmp.c+1−1
@@ -32,7 +32,7 @@ enum bus_reset_handling { · 31 unmodified lines
3232 SUCCEED_ON_BUS_RESET,
3333 };
3434
35−static __attribute__((format(printf, 2, 3)))
35+static __printf(2, 3)
3636 void cmp_error(struct cmp_connection *c, const char *fmt, ...)
3737 {
3838 va_list va;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t