Skip to content

Commit 9521127

Browse files
committed
Merge branch 'akpm' (Andrew's patch-bomb)
Merge first batch of patches from Andrew Morton: "A few misc things and all the MM queue" * emailed from Andrew Morton <akpm@linux-foundation.org>: (92 commits) memcg: avoid THP split in task migration thp: add HPAGE_PMD_* definitions for !CONFIG_TRANSPARENT_HUGEPAGE memcg: clean up existing move charge code mm/memcontrol.c: remove unnecessary 'break' in mem_cgroup_read() mm/memcontrol.c: remove redundant BUG_ON() in mem_cgroup_usage_unregister_event() mm/memcontrol.c: s/stealed/stolen/ memcg: fix performance of mem_cgroup_begin_update_page_stat() memcg: remove PCG_FILE_MAPPED memcg: use new logic for page stat accounting memcg: remove PCG_MOVE_LOCK flag from page_cgroup memcg: simplify move_account() check memcg: remove EXPORT_SYMBOL(mem_cgroup_update_page_stat) memcg: kill dead prev_priority stubs memcg: remove PCG_CACHE page_cgroup flag memcg: let css_get_next() rely upon rcu_read_lock() cgroup: revert ss_id_lock to spinlock idr: make idr_get_next() good for rcu_read_lock() memcg: remove unnecessary thp check in page stat accounting memcg: remove redundant returns memcg: enum lru_list lru ...
2 parents 5375871 + 1272485 commit 9521127

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

77 files changed

+1902
-1235
lines changed

Documentation/filesystems/proc.txt

+30-2
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ Table 1-4: Contents of the stat files (as of 2.6.30-rc7)
290290
rsslim current limit in bytes on the rss
291291
start_code address above which program text can run
292292
end_code address below which program text can run
293-
start_stack address of the start of the stack
293+
start_stack address of the start of the main process stack
294294
esp current value of ESP
295295
eip current value of EIP
296296
pending bitmap of pending signals
@@ -325,7 +325,7 @@ address perms offset dev inode pathname
325325
a7cb1000-a7cb2000 ---p 00000000 00:00 0
326326
a7cb2000-a7eb2000 rw-p 00000000 00:00 0
327327
a7eb2000-a7eb3000 ---p 00000000 00:00 0
328-
a7eb3000-a7ed5000 rw-p 00000000 00:00 0
328+
a7eb3000-a7ed5000 rw-p 00000000 00:00 0 [stack:1001]
329329
a7ed5000-a8008000 r-xp 00000000 03:00 4222 /lib/libc.so.6
330330
a8008000-a800a000 r--p 00133000 03:00 4222 /lib/libc.so.6
331331
a800a000-a800b000 rw-p 00135000 03:00 4222 /lib/libc.so.6
@@ -357,11 +357,39 @@ is not associated with a file:
357357

358358
[heap] = the heap of the program
359359
[stack] = the stack of the main process
360+
[stack:1001] = the stack of the thread with tid 1001
360361
[vdso] = the "virtual dynamic shared object",
361362
the kernel system call handler
362363

363364
or if empty, the mapping is anonymous.
364365

366+
The /proc/PID/task/TID/maps is a view of the virtual memory from the viewpoint
367+
of the individual tasks of a process. In this file you will see a mapping marked
368+
as [stack] if that task sees it as a stack. This is a key difference from the
369+
content of /proc/PID/maps, where you will see all mappings that are being used
370+
as stack by all of those tasks. Hence, for the example above, the task-level
371+
map, i.e. /proc/PID/task/TID/maps for thread 1001 will look like this:
372+
373+
08048000-08049000 r-xp 00000000 03:00 8312 /opt/test
374+
08049000-0804a000 rw-p 00001000 03:00 8312 /opt/test
375+
0804a000-0806b000 rw-p 00000000 00:00 0 [heap]
376+
a7cb1000-a7cb2000 ---p 00000000 00:00 0
377+
a7cb2000-a7eb2000 rw-p 00000000 00:00 0
378+
a7eb2000-a7eb3000 ---p 00000000 00:00 0
379+
a7eb3000-a7ed5000 rw-p 00000000 00:00 0 [stack]
380+
a7ed5000-a8008000 r-xp 00000000 03:00 4222 /lib/libc.so.6
381+
a8008000-a800a000 r--p 00133000 03:00 4222 /lib/libc.so.6
382+
a800a000-a800b000 rw-p 00135000 03:00 4222 /lib/libc.so.6
383+
a800b000-a800e000 rw-p 00000000 00:00 0
384+
a800e000-a8022000 r-xp 00000000 03:00 14462 /lib/libpthread.so.0
385+
a8022000-a8023000 r--p 00013000 03:00 14462 /lib/libpthread.so.0
386+
a8023000-a8024000 rw-p 00014000 03:00 14462 /lib/libpthread.so.0
387+
a8024000-a8027000 rw-p 00000000 00:00 0
388+
a8027000-a8043000 r-xp 00000000 03:00 8317 /lib/ld-linux.so.2
389+
a8043000-a8044000 r--p 0001b000 03:00 8317 /lib/ld-linux.so.2
390+
a8044000-a8045000 rw-p 0001c000 03:00 8317 /lib/ld-linux.so.2
391+
aff35000-aff4a000 rw-p 00000000 00:00 0
392+
ffffe000-fffff000 r-xp 00000000 00:00 0 [vdso]
365393

366394
The /proc/PID/smaps is an extension based on maps, showing the memory
367395
consumption for each of the process's mappings. For each of mappings there

Documentation/kernel-parameters.txt

+7
Original file line numberDiff line numberDiff line change
@@ -2635,6 +2635,13 @@ bytes respectively. Such letter suffixes can also be entirely omitted.
26352635
to facilitate early boot debugging.
26362636
See also Documentation/trace/events.txt
26372637

2638+
transparent_hugepage=
2639+
[KNL]
2640+
Format: [always|madvise|never]
2641+
Can be used to control the default behavior of the system
2642+
with respect to transparent hugepages.
2643+
See Documentation/vm/transhuge.txt for more details.
2644+
26382645
tsc= Disable clocksource stability checks for TSC.
26392646
Format: <string>
26402647
[x86] reliable: mark tsc clocksource as reliable, this

Documentation/vm/page-types.c

+2
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@
9898
#define KPF_HWPOISON 19
9999
#define KPF_NOPAGE 20
100100
#define KPF_KSM 21
101+
#define KPF_THP 22
101102

102103
/* [32-] kernel hacking assistances */
103104
#define KPF_RESERVED 32
@@ -147,6 +148,7 @@ static const char *page_flag_names[] = {
147148
[KPF_HWPOISON] = "X:hwpoison",
148149
[KPF_NOPAGE] = "n:nopage",
149150
[KPF_KSM] = "x:ksm",
151+
[KPF_THP] = "t:thp",
150152

151153
[KPF_RESERVED] = "r:reserved",
152154
[KPF_MLOCKED] = "m:mlocked",

Documentation/vm/pagemap.txt

+4
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ There are three components to pagemap:
6060
19. HWPOISON
6161
20. NOPAGE
6262
21. KSM
63+
22. THP
6364

6465
Short descriptions to the page flags:
6566

@@ -97,6 +98,9 @@ Short descriptions to the page flags:
9798
21. KSM
9899
identical memory pages dynamically shared between one or more processes
99100

101+
22. THP
102+
contiguous pages which construct transparent hugepages
103+
100104
[IO related page flags]
101105
1. ERROR IO error occurred
102106
3. UPTODATE page has up-to-date data

arch/sparc/kernel/signal32.c

+1-6
Original file line numberDiff line numberDiff line change
@@ -776,7 +776,6 @@ static inline int handle_signal32(unsigned long signr, struct k_sigaction *ka,
776776
siginfo_t *info,
777777
sigset_t *oldset, struct pt_regs *regs)
778778
{
779-
sigset_t blocked;
780779
int err;
781780

782781
if (ka->sa.sa_flags & SA_SIGINFO)
@@ -787,11 +786,7 @@ static inline int handle_signal32(unsigned long signr, struct k_sigaction *ka,
787786
if (err)
788787
return err;
789788

790-
sigorsets(&blocked, &current->blocked, &ka->sa.sa_mask);
791-
if (!(ka->sa.sa_flags & SA_NOMASK))
792-
sigaddset(&blocked, signr);
793-
set_current_blocked(&blocked);
794-
789+
block_sigmask(ka, signr);
795790
tracehook_signal_handler(signr, info, ka, regs, 0);
796791

797792
return 0;

arch/sparc/kernel/signal_32.c

+1-6
Original file line numberDiff line numberDiff line change
@@ -465,7 +465,6 @@ static inline int
465465
handle_signal(unsigned long signr, struct k_sigaction *ka,
466466
siginfo_t *info, sigset_t *oldset, struct pt_regs *regs)
467467
{
468-
sigset_t blocked;
469468
int err;
470469

471470
if (ka->sa.sa_flags & SA_SIGINFO)
@@ -476,11 +475,7 @@ handle_signal(unsigned long signr, struct k_sigaction *ka,
476475
if (err)
477476
return err;
478477

479-
sigorsets(&blocked, &current->blocked, &ka->sa.sa_mask);
480-
if (!(ka->sa.sa_flags & SA_NOMASK))
481-
sigaddset(&blocked, signr);
482-
set_current_blocked(&blocked);
483-
478+
block_sigmask(ka, signr);
484479
tracehook_signal_handler(signr, info, ka, regs, 0);
485480

486481
return 0;

arch/sparc/kernel/signal_64.c

+1-5
Original file line numberDiff line numberDiff line change
@@ -479,18 +479,14 @@ static inline int handle_signal(unsigned long signr, struct k_sigaction *ka,
479479
siginfo_t *info,
480480
sigset_t *oldset, struct pt_regs *regs)
481481
{
482-
sigset_t blocked;
483482
int err;
484483

485484
err = setup_rt_frame(ka, regs, signr, oldset,
486485
(ka->sa.sa_flags & SA_SIGINFO) ? info : NULL);
487486
if (err)
488487
return err;
489-
sigorsets(&blocked, &current->blocked, &ka->sa.sa_mask);
490-
if (!(ka->sa.sa_flags & SA_NOMASK))
491-
sigaddset(&blocked, signr);
492-
set_current_blocked(&blocked);
493488

489+
block_sigmask(ka, signr);
494490
tracehook_signal_handler(signr, info, ka, regs, 0);
495491

496492
return 0;

arch/x86/kernel/sys_x86_64.c

+17-17
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ arch_get_unmapped_area_topdown(struct file *filp, const unsigned long addr0,
195195
{
196196
struct vm_area_struct *vma;
197197
struct mm_struct *mm = current->mm;
198-
unsigned long addr = addr0;
198+
unsigned long addr = addr0, start_addr;
199199

200200
/* requested length too big for entire address space */
201201
if (len > TASK_SIZE)
@@ -223,25 +223,14 @@ arch_get_unmapped_area_topdown(struct file *filp, const unsigned long addr0,
223223
mm->free_area_cache = mm->mmap_base;
224224
}
225225

226+
try_again:
226227
/* either no address requested or can't fit in requested address hole */
227-
addr = mm->free_area_cache;
228-
229-
/* make sure it can fit in the remaining address space */
230-
if (addr > len) {
231-
unsigned long tmp_addr = align_addr(addr - len, filp,
232-
ALIGN_TOPDOWN);
233-
234-
vma = find_vma(mm, tmp_addr);
235-
if (!vma || tmp_addr + len <= vma->vm_start)
236-
/* remember the address as a hint for next time */
237-
return mm->free_area_cache = tmp_addr;
238-
}
239-
240-
if (mm->mmap_base < len)
241-
goto bottomup;
228+
start_addr = addr = mm->free_area_cache;
242229

243-
addr = mm->mmap_base-len;
230+
if (addr < len)
231+
goto fail;
244232

233+
addr -= len;
245234
do {
246235
addr = align_addr(addr, filp, ALIGN_TOPDOWN);
247236

@@ -263,6 +252,17 @@ arch_get_unmapped_area_topdown(struct file *filp, const unsigned long addr0,
263252
addr = vma->vm_start-len;
264253
} while (len < vma->vm_start);
265254

255+
fail:
256+
/*
257+
* if hint left us with no space for the requested
258+
* mapping then try again:
259+
*/
260+
if (start_addr != mm->mmap_base) {
261+
mm->free_area_cache = mm->mmap_base;
262+
mm->cached_hole_size = 0;
263+
goto try_again;
264+
}
265+
266266
bottomup:
267267
/*
268268
* A failed mmap() very likely causes application failure,

arch/x86/kernel/vm86_32.c

+2
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,7 @@ static void mark_screen_rdonly(struct mm_struct *mm)
172172
spinlock_t *ptl;
173173
int i;
174174

175+
down_write(&mm->mmap_sem);
175176
pgd = pgd_offset(mm, 0xA0000);
176177
if (pgd_none_or_clear_bad(pgd))
177178
goto out;
@@ -190,6 +191,7 @@ static void mark_screen_rdonly(struct mm_struct *mm)
190191
}
191192
pte_unmap_unlock(pte, ptl);
192193
out:
194+
up_write(&mm->mmap_sem);
193195
flush_tlb();
194196
}
195197

arch/x86/mm/hugetlbpage.c

+11-17
Original file line numberDiff line numberDiff line change
@@ -308,10 +308,11 @@ static unsigned long hugetlb_get_unmapped_area_topdown(struct file *file,
308308
{
309309
struct hstate *h = hstate_file(file);
310310
struct mm_struct *mm = current->mm;
311-
struct vm_area_struct *vma, *prev_vma;
312-
unsigned long base = mm->mmap_base, addr = addr0;
311+
struct vm_area_struct *vma;
312+
unsigned long base = mm->mmap_base;
313+
unsigned long addr = addr0;
313314
unsigned long largest_hole = mm->cached_hole_size;
314-
int first_time = 1;
315+
unsigned long start_addr;
315316

316317
/* don't allow allocations above current base */
317318
if (mm->free_area_cache > base)
@@ -322,6 +323,8 @@ static unsigned long hugetlb_get_unmapped_area_topdown(struct file *file,
322323
mm->free_area_cache = base;
323324
}
324325
try_again:
326+
start_addr = mm->free_area_cache;
327+
325328
/* make sure it can fit in the remaining address space */
326329
if (mm->free_area_cache < len)
327330
goto fail;
@@ -337,22 +340,14 @@ static unsigned long hugetlb_get_unmapped_area_topdown(struct file *file,
337340
if (!vma)
338341
return addr;
339342

340-
/*
341-
* new region fits between prev_vma->vm_end and
342-
* vma->vm_start, use it:
343-
*/
344-
prev_vma = vma->vm_prev;
345-
if (addr + len <= vma->vm_start &&
346-
(!prev_vma || (addr >= prev_vma->vm_end))) {
343+
if (addr + len <= vma->vm_start) {
347344
/* remember the address as a hint for next time */
348345
mm->cached_hole_size = largest_hole;
349346
return (mm->free_area_cache = addr);
350-
} else {
347+
} else if (mm->free_area_cache == vma->vm_end) {
351348
/* pull free_area_cache down to the first hole */
352-
if (mm->free_area_cache == vma->vm_end) {
353-
mm->free_area_cache = vma->vm_start;
354-
mm->cached_hole_size = largest_hole;
355-
}
349+
mm->free_area_cache = vma->vm_start;
350+
mm->cached_hole_size = largest_hole;
356351
}
357352

358353
/* remember the largest hole we saw so far */
@@ -368,10 +363,9 @@ static unsigned long hugetlb_get_unmapped_area_topdown(struct file *file,
368363
* if hint left us with no space for the requested
369364
* mapping then try again:
370365
*/
371-
if (first_time) {
366+
if (start_addr != base) {
372367
mm->free_area_cache = base;
373368
largest_hole = 0;
374-
first_time = 0;
375369
goto try_again;
376370
}
377371
/*

arch/x86/mm/numa_emulation.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ static int __init emu_setup_memblk(struct numa_meminfo *ei,
6060
eb->nid = nid;
6161

6262
if (emu_nid_to_phys[nid] == NUMA_NO_NODE)
63-
emu_nid_to_phys[nid] = pb->nid;
63+
emu_nid_to_phys[nid] = nid;
6464

6565
pb->start += size;
6666
if (pb->start >= pb->end) {

arch/xtensa/kernel/signal.c

+11-24
Original file line numberDiff line numberDiff line change
@@ -260,10 +260,7 @@ asmlinkage long xtensa_rt_sigreturn(long a0, long a1, long a2, long a3,
260260
goto badframe;
261261

262262
sigdelsetmask(&set, ~_BLOCKABLE);
263-
spin_lock_irq(&current->sighand->siglock);
264-
current->blocked = set;
265-
recalc_sigpending();
266-
spin_unlock_irq(&current->sighand->siglock);
263+
set_current_blocked(&set);
267264

268265
if (restore_sigcontext(regs, frame))
269266
goto badframe;
@@ -336,8 +333,8 @@ gen_return_code(unsigned char *codemem)
336333
}
337334

338335

339-
static void setup_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
340-
sigset_t *set, struct pt_regs *regs)
336+
static int setup_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
337+
sigset_t *set, struct pt_regs *regs)
341338
{
342339
struct rt_sigframe *frame;
343340
int err = 0;
@@ -422,12 +419,11 @@ static void setup_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
422419
current->comm, current->pid, signal, frame, regs->pc);
423420
#endif
424421

425-
return;
422+
return 0;
426423

427424
give_sigsegv:
428-
if (sig == SIGSEGV)
429-
ka->sa.sa_handler = SIG_DFL;
430-
force_sig(SIGSEGV, current);
425+
force_sigsegv(sig, current);
426+
return -EFAULT;
431427
}
432428

433429
/*
@@ -449,11 +445,8 @@ asmlinkage long xtensa_rt_sigsuspend(sigset_t __user *unewset,
449445
return -EFAULT;
450446

451447
sigdelsetmask(&newset, ~_BLOCKABLE);
452-
spin_lock_irq(&current->sighand->siglock);
453448
saveset = current->blocked;
454-
current->blocked = newset;
455-
recalc_sigpending();
456-
spin_unlock_irq(&current->sighand->siglock);
449+
set_current_blocked(&newset);
457450

458451
regs->areg[2] = -EINTR;
459452
while (1) {
@@ -536,17 +529,11 @@ int do_signal(struct pt_regs *regs, sigset_t *oldset)
536529

537530
/* Whee! Actually deliver the signal. */
538531
/* Set up the stack frame */
539-
setup_frame(signr, &ka, &info, oldset, regs);
540-
541-
if (ka.sa.sa_flags & SA_ONESHOT)
542-
ka.sa.sa_handler = SIG_DFL;
532+
ret = setup_frame(signr, &ka, &info, oldset, regs);
533+
if (ret)
534+
return ret;
543535

544-
spin_lock_irq(&current->sighand->siglock);
545-
sigorsets(&current->blocked, &current->blocked, &ka.sa.sa_mask);
546-
if (!(ka.sa.sa_flags & SA_NODEFER))
547-
sigaddset(&current->blocked, signr);
548-
recalc_sigpending();
549-
spin_unlock_irq(&current->sighand->siglock);
536+
block_sigmask(&ka, signr);
550537
if (current->ptrace & PT_SINGLESTEP)
551538
task_pt_regs(current)->icountlevel = 1;
552539

0 commit comments

Comments
 (0)