Skip to content

Commit 85e97be

Browse files
committed
Merge branch 'akpm' (patches from Andrew)
Merge misc fixes from Andrew Morton: "8 fixes" * emailed patches from Andrew Morton <akpm@linux-foundation.org>: mm/slub.c: run free_partial() outside of the kmem_cache_node->list_lock rmap: fix compound check logic in page_remove_file_rmap mm, rmap: fix false positive VM_BUG() in page_add_file_rmap() mm/page_alloc.c: recalculate some of node threshold when on/offline memory mm/page_alloc.c: fix wrong initialization when sysctl_min_unmapped_ratio changes thp: move shmem_huge_enabled() outside of SYSFS ifdef revert "ARM: keystone: dts: add psci command definition" rapidio: dereferencing an error pointer
2 parents 7de2499 + 6039892 commit 85e97be

File tree

6 files changed

+60
-39
lines changed

6 files changed

+60
-39
lines changed

arch/arm/boot/dts/keystone.dtsi

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -70,14 +70,6 @@
7070
cpu_on = <0x84000003>;
7171
};
7272

73-
psci {
74-
compatible = "arm,psci";
75-
method = "smc";
76-
cpu_suspend = <0x84000001>;
77-
cpu_off = <0x84000002>;
78-
cpu_on = <0x84000003>;
79-
};
80-
8173
soc {
8274
#address-cells = <1>;
8375
#size-cells = <1>;

drivers/rapidio/rio_cm.c

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1080,8 +1080,8 @@ static int riocm_send_ack(struct rio_channel *ch)
10801080
static struct rio_channel *riocm_ch_accept(u16 ch_id, u16 *new_ch_id,
10811081
long timeout)
10821082
{
1083-
struct rio_channel *ch = NULL;
1084-
struct rio_channel *new_ch = NULL;
1083+
struct rio_channel *ch;
1084+
struct rio_channel *new_ch;
10851085
struct conn_req *req;
10861086
struct cm_peer *peer;
10871087
int found = 0;
@@ -1155,6 +1155,7 @@ static struct rio_channel *riocm_ch_accept(u16 ch_id, u16 *new_ch_id,
11551155

11561156
spin_unlock_bh(&ch->lock);
11571157
riocm_put_channel(ch);
1158+
ch = NULL;
11581159
kfree(req);
11591160

11601161
down_read(&rdev_sem);
@@ -1172,7 +1173,7 @@ static struct rio_channel *riocm_ch_accept(u16 ch_id, u16 *new_ch_id,
11721173
if (!found) {
11731174
/* If peer device object not found, simply ignore the request */
11741175
err = -ENODEV;
1175-
goto err_nodev;
1176+
goto err_put_new_ch;
11761177
}
11771178

11781179
new_ch->rdev = peer->rdev;
@@ -1184,15 +1185,16 @@ static struct rio_channel *riocm_ch_accept(u16 ch_id, u16 *new_ch_id,
11841185

11851186
*new_ch_id = new_ch->id;
11861187
return new_ch;
1188+
1189+
err_put_new_ch:
1190+
spin_lock_bh(&idr_lock);
1191+
idr_remove(&ch_idr, new_ch->id);
1192+
spin_unlock_bh(&idr_lock);
1193+
riocm_put_channel(new_ch);
1194+
11871195
err_put:
1188-
riocm_put_channel(ch);
1189-
err_nodev:
1190-
if (new_ch) {
1191-
spin_lock_bh(&idr_lock);
1192-
idr_remove(&ch_idr, new_ch->id);
1193-
spin_unlock_bh(&idr_lock);
1194-
riocm_put_channel(new_ch);
1195-
}
1196+
if (ch)
1197+
riocm_put_channel(ch);
11961198
*new_ch_id = 0;
11971199
return ERR_PTR(err);
11981200
}

mm/page_alloc.c

Lines changed: 35 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4757,6 +4757,8 @@ int local_memory_node(int node)
47574757
}
47584758
#endif
47594759

4760+
static void setup_min_unmapped_ratio(void);
4761+
static void setup_min_slab_ratio(void);
47604762
#else /* CONFIG_NUMA */
47614763

47624764
static void set_zonelist_order(void)
@@ -5878,9 +5880,6 @@ static void __paginginit free_area_init_core(struct pglist_data *pgdat)
58785880
zone->managed_pages = is_highmem_idx(j) ? realsize : freesize;
58795881
#ifdef CONFIG_NUMA
58805882
zone->node = nid;
5881-
pgdat->min_unmapped_pages += (freesize*sysctl_min_unmapped_ratio)
5882-
/ 100;
5883-
pgdat->min_slab_pages += (freesize * sysctl_min_slab_ratio) / 100;
58845883
#endif
58855884
zone->name = zone_names[j];
58865885
zone->zone_pgdat = pgdat;
@@ -6801,6 +6800,12 @@ int __meminit init_per_zone_wmark_min(void)
68016800
setup_per_zone_wmarks();
68026801
refresh_zone_stat_thresholds();
68036802
setup_per_zone_lowmem_reserve();
6803+
6804+
#ifdef CONFIG_NUMA
6805+
setup_min_unmapped_ratio();
6806+
setup_min_slab_ratio();
6807+
#endif
6808+
68046809
return 0;
68056810
}
68066811
core_initcall(init_per_zone_wmark_min)
@@ -6842,43 +6847,58 @@ int watermark_scale_factor_sysctl_handler(struct ctl_table *table, int write,
68426847
}
68436848

68446849
#ifdef CONFIG_NUMA
6850+
static void setup_min_unmapped_ratio(void)
6851+
{
6852+
pg_data_t *pgdat;
6853+
struct zone *zone;
6854+
6855+
for_each_online_pgdat(pgdat)
6856+
pgdat->min_unmapped_pages = 0;
6857+
6858+
for_each_zone(zone)
6859+
zone->zone_pgdat->min_unmapped_pages += (zone->managed_pages *
6860+
sysctl_min_unmapped_ratio) / 100;
6861+
}
6862+
6863+
68456864
int sysctl_min_unmapped_ratio_sysctl_handler(struct ctl_table *table, int write,
68466865
void __user *buffer, size_t *length, loff_t *ppos)
68476866
{
6848-
struct pglist_data *pgdat;
6849-
struct zone *zone;
68506867
int rc;
68516868

68526869
rc = proc_dointvec_minmax(table, write, buffer, length, ppos);
68536870
if (rc)
68546871
return rc;
68556872

6873+
setup_min_unmapped_ratio();
6874+
6875+
return 0;
6876+
}
6877+
6878+
static void setup_min_slab_ratio(void)
6879+
{
6880+
pg_data_t *pgdat;
6881+
struct zone *zone;
6882+
68566883
for_each_online_pgdat(pgdat)
68576884
pgdat->min_slab_pages = 0;
68586885

68596886
for_each_zone(zone)
6860-
zone->zone_pgdat->min_unmapped_pages += (zone->managed_pages *
6861-
sysctl_min_unmapped_ratio) / 100;
6862-
return 0;
6887+
zone->zone_pgdat->min_slab_pages += (zone->managed_pages *
6888+
sysctl_min_slab_ratio) / 100;
68636889
}
68646890

68656891
int sysctl_min_slab_ratio_sysctl_handler(struct ctl_table *table, int write,
68666892
void __user *buffer, size_t *length, loff_t *ppos)
68676893
{
6868-
struct pglist_data *pgdat;
6869-
struct zone *zone;
68706894
int rc;
68716895

68726896
rc = proc_dointvec_minmax(table, write, buffer, length, ppos);
68736897
if (rc)
68746898
return rc;
68756899

6876-
for_each_online_pgdat(pgdat)
6877-
pgdat->min_slab_pages = 0;
6900+
setup_min_slab_ratio();
68786901

6879-
for_each_zone(zone)
6880-
zone->zone_pgdat->min_slab_pages += (zone->managed_pages *
6881-
sysctl_min_slab_ratio) / 100;
68826902
return 0;
68836903
}
68846904
#endif

mm/rmap.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1284,8 +1284,9 @@ void page_add_file_rmap(struct page *page, bool compound)
12841284
VM_BUG_ON_PAGE(!PageSwapBacked(page), page);
12851285
__inc_node_page_state(page, NR_SHMEM_PMDMAPPED);
12861286
} else {
1287-
if (PageTransCompound(page)) {
1288-
VM_BUG_ON_PAGE(!PageLocked(page), page);
1287+
if (PageTransCompound(page) && page_mapping(page)) {
1288+
VM_WARN_ON_ONCE(!PageLocked(page));
1289+
12891290
SetPageDoubleMap(compound_head(page));
12901291
if (PageMlocked(page))
12911292
clear_page_mlock(compound_head(page));
@@ -1303,7 +1304,7 @@ static void page_remove_file_rmap(struct page *page, bool compound)
13031304
{
13041305
int i, nr = 1;
13051306

1306-
VM_BUG_ON_PAGE(compound && !PageTransHuge(page), page);
1307+
VM_BUG_ON_PAGE(compound && !PageHead(page), page);
13071308
lock_page_memcg(page);
13081309

13091310
/* Hugepages are not counted in NR_FILE_MAPPED for now. */

mm/shmem.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3975,7 +3975,9 @@ static ssize_t shmem_enabled_store(struct kobject *kobj,
39753975

39763976
struct kobj_attribute shmem_enabled_attr =
39773977
__ATTR(shmem_enabled, 0644, shmem_enabled_show, shmem_enabled_store);
3978+
#endif /* CONFIG_TRANSPARENT_HUGE_PAGECACHE && CONFIG_SYSFS */
39783979

3980+
#ifdef CONFIG_TRANSPARENT_HUGE_PAGECACHE
39793981
bool shmem_huge_enabled(struct vm_area_struct *vma)
39803982
{
39813983
struct inode *inode = file_inode(vma->vm_file);
@@ -4006,7 +4008,7 @@ bool shmem_huge_enabled(struct vm_area_struct *vma)
40064008
return false;
40074009
}
40084010
}
4009-
#endif /* CONFIG_TRANSPARENT_HUGE_PAGECACHE && CONFIG_SYSFS */
4011+
#endif /* CONFIG_TRANSPARENT_HUGE_PAGECACHE */
40104012

40114013
#else /* !CONFIG_SHMEM */
40124014

mm/slub.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3629,20 +3629,24 @@ static void list_slab_objects(struct kmem_cache *s, struct page *page,
36293629
*/
36303630
static void free_partial(struct kmem_cache *s, struct kmem_cache_node *n)
36313631
{
3632+
LIST_HEAD(discard);
36323633
struct page *page, *h;
36333634

36343635
BUG_ON(irqs_disabled());
36353636
spin_lock_irq(&n->list_lock);
36363637
list_for_each_entry_safe(page, h, &n->partial, lru) {
36373638
if (!page->inuse) {
36383639
remove_partial(n, page);
3639-
discard_slab(s, page);
3640+
list_add(&page->lru, &discard);
36403641
} else {
36413642
list_slab_objects(s, page,
36423643
"Objects remaining in %s on __kmem_cache_shutdown()");
36433644
}
36443645
}
36453646
spin_unlock_irq(&n->list_lock);
3647+
3648+
list_for_each_entry_safe(page, h, &discard, lru)
3649+
discard_slab(s, page);
36463650
}
36473651

36483652
/*

0 commit comments

Comments
 (0)