Skip to content

Commit cb6f873

Browse files
committed
Merge branch 'akpm' (patches from Andrew)
Merge yet more updates from Andrew Morton: "A few final bits: - large changes to vmalloc, yielding large performance benefits - tweak the console-flush-on-panic code - a few fixes" * emailed patches from Andrew Morton <[email protected]>: panic: add an option to replay all the printk message in buffer initramfs: don't free a non-existent initrd fs/writeback.c: use rcu_barrier() to wait for inflight wb switches going into workqueue when umount mm/compaction.c: correct zone boundary handling when isolating pages from a pageblock mm/vmap: add DEBUG_AUGMENT_LOWEST_MATCH_CHECK macro mm/vmap: add DEBUG_AUGMENT_PROPAGATE_CHECK macro mm/vmalloc.c: keep track of free blocks for vmap allocation
2 parents ff8583d + de6da1e commit cb6f873

File tree

10 files changed

+889
-257
lines changed

10 files changed

+889
-257
lines changed

Documentation/admin-guide/kernel-parameters.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3212,6 +3212,7 @@
32123212
bit 2: print timer info
32133213
bit 3: print locks info if CONFIG_LOCKDEP is on
32143214
bit 4: print ftrace buffer
3215+
bit 5: print all printk messages in buffer
32153216

32163217
panic_on_warn panic() instead of WARN(). Useful to cause kdump
32173218
on a WARN().

arch/powerpc/kernel/traps.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ extern void panic_flush_kmsg_end(void)
179179
kmsg_dump(KMSG_DUMP_PANIC);
180180
bust_spinlocks(0);
181181
debug_locks_off();
182-
console_flush_on_panic();
182+
console_flush_on_panic(CONSOLE_FLUSH_PENDING);
183183
}
184184

185185
static unsigned long oops_begin(struct pt_regs *regs)

fs/fs-writeback.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -523,15 +523,16 @@ static void inode_switch_wbs(struct inode *inode, int new_wb_id)
523523

524524
isw->inode = inode;
525525

526-
atomic_inc(&isw_nr_in_flight);
527-
528526
/*
529527
* In addition to synchronizing among switchers, I_WB_SWITCH tells
530528
* the RCU protected stat update paths to grab the i_page
531529
* lock so that stat transfer can synchronize against them.
532530
* Let's continue after I_WB_SWITCH is guaranteed to be visible.
533531
*/
534532
call_rcu(&isw->rcu_head, inode_switch_wbs_rcu_fn);
533+
534+
atomic_inc(&isw_nr_in_flight);
535+
535536
goto out_unlock;
536537

537538
out_free:
@@ -901,7 +902,11 @@ static void bdi_split_work_to_wbs(struct backing_dev_info *bdi,
901902
void cgroup_writeback_umount(void)
902903
{
903904
if (atomic_read(&isw_nr_in_flight)) {
904-
synchronize_rcu();
905+
/*
906+
* Use rcu_barrier() to wait for all pending callbacks to
907+
* ensure that all in-flight wb switches are in the workqueue.
908+
*/
909+
rcu_barrier();
905910
flush_workqueue(isw_wq);
906911
}
907912
}

include/linux/console.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,11 @@ struct console {
166166
extern int console_set_on_cmdline;
167167
extern struct console *early_console;
168168

169+
enum con_flush_mode {
170+
CONSOLE_FLUSH_PENDING,
171+
CONSOLE_REPLAY_ALL,
172+
};
173+
169174
extern int add_preferred_console(char *name, int idx, char *options);
170175
extern void register_console(struct console *);
171176
extern int unregister_console(struct console *);
@@ -175,7 +180,7 @@ extern int console_trylock(void);
175180
extern void console_unlock(void);
176181
extern void console_conditional_schedule(void);
177182
extern void console_unblank(void);
178-
extern void console_flush_on_panic(void);
183+
extern void console_flush_on_panic(enum con_flush_mode mode);
179184
extern struct tty_driver *console_device(int *);
180185
extern void console_stop(struct console *);
181186
extern void console_start(struct console *);

include/linux/vmalloc.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,16 @@ struct vm_struct {
5050
struct vmap_area {
5151
unsigned long va_start;
5252
unsigned long va_end;
53+
54+
/*
55+
* Largest available free size in subtree.
56+
*/
57+
unsigned long subtree_max_size;
5358
unsigned long flags;
5459
struct rb_node rb_node; /* address sorted rbtree */
5560
struct list_head list; /* address sorted list */
5661
struct llist_node purge_list; /* "lazy purge" list */
5762
struct vm_struct *vm;
58-
struct rcu_head rcu_head;
5963
};
6064

6165
/*

init/initramfs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -669,7 +669,7 @@ static int __init populate_rootfs(void)
669669
* If the initrd region is overlapped with crashkernel reserved region,
670670
* free only memory that is not part of crashkernel region.
671671
*/
672-
if (!do_retain_initrd && !kexec_free_initrd())
672+
if (!do_retain_initrd && initrd_start && !kexec_free_initrd())
673673
free_initrd_mem(initrd_start, initrd_end);
674674
initrd_start = 0;
675675
initrd_end = 0;

kernel/panic.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ EXPORT_SYMBOL_GPL(panic_timeout);
5151
#define PANIC_PRINT_TIMER_INFO 0x00000004
5252
#define PANIC_PRINT_LOCK_INFO 0x00000008
5353
#define PANIC_PRINT_FTRACE_INFO 0x00000010
54+
#define PANIC_PRINT_ALL_PRINTK_MSG 0x00000020
5455
unsigned long panic_print;
5556

5657
ATOMIC_NOTIFIER_HEAD(panic_notifier_list);
@@ -134,6 +135,9 @@ EXPORT_SYMBOL(nmi_panic);
134135

135136
static void panic_print_sys_info(void)
136137
{
138+
if (panic_print & PANIC_PRINT_ALL_PRINTK_MSG)
139+
console_flush_on_panic(CONSOLE_REPLAY_ALL);
140+
137141
if (panic_print & PANIC_PRINT_TASK_INFO)
138142
show_state();
139143

@@ -277,7 +281,7 @@ void panic(const char *fmt, ...)
277281
* panic() is not being callled from OOPS.
278282
*/
279283
debug_locks_off();
280-
console_flush_on_panic();
284+
console_flush_on_panic(CONSOLE_FLUSH_PENDING);
281285

282286
panic_print_sys_info();
283287

kernel/printk/printk.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2535,10 +2535,11 @@ void console_unblank(void)
25352535

25362536
/**
25372537
* console_flush_on_panic - flush console content on panic
2538+
* @mode: flush all messages in buffer or just the pending ones
25382539
*
25392540
* Immediately output all pending messages no matter what.
25402541
*/
2541-
void console_flush_on_panic(void)
2542+
void console_flush_on_panic(enum con_flush_mode mode)
25422543
{
25432544
/*
25442545
* If someone else is holding the console lock, trylock will fail
@@ -2549,6 +2550,15 @@ void console_flush_on_panic(void)
25492550
*/
25502551
console_trylock();
25512552
console_may_schedule = 0;
2553+
2554+
if (mode == CONSOLE_REPLAY_ALL) {
2555+
unsigned long flags;
2556+
2557+
logbuf_lock_irqsave(flags);
2558+
console_seq = log_first_seq;
2559+
console_idx = log_first_idx;
2560+
logbuf_unlock_irqrestore(flags);
2561+
}
25522562
console_unlock();
25532563
}
25542564

mm/compaction.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1230,7 +1230,7 @@ fast_isolate_around(struct compact_control *cc, unsigned long pfn, unsigned long
12301230

12311231
/* Pageblock boundaries */
12321232
start_pfn = pageblock_start_pfn(pfn);
1233-
end_pfn = min(start_pfn + pageblock_nr_pages, zone_end_pfn(cc->zone));
1233+
end_pfn = min(pageblock_end_pfn(pfn), zone_end_pfn(cc->zone)) - 1;
12341234

12351235
/* Scan before */
12361236
if (start_pfn != pfn) {
@@ -1241,7 +1241,7 @@ fast_isolate_around(struct compact_control *cc, unsigned long pfn, unsigned long
12411241

12421242
/* Scan after */
12431243
start_pfn = pfn + nr_isolated;
1244-
if (start_pfn != end_pfn)
1244+
if (start_pfn < end_pfn)
12451245
isolate_freepages_block(cc, &start_pfn, end_pfn, &cc->freepages, 1, false);
12461246

12471247
/* Skip this pageblock in the future as it's full or nearly full */

0 commit comments

Comments
 (0)