|
@@ -680,9 +680,6 @@ static int __compact_pgdat(pg_data_t *pgdat, struct compact_control *cc)
|
|
int zoneid;
|
|
int zoneid;
|
|
struct zone *zone;
|
|
struct zone *zone;
|
|
|
|
|
|
- /* Flush pending updates to the LRU lists */
|
|
|
|
- lru_add_drain_all();
|
|
|
|
-
|
|
|
|
for (zoneid = 0; zoneid < MAX_NR_ZONES; zoneid++) {
|
|
for (zoneid = 0; zoneid < MAX_NR_ZONES; zoneid++) {
|
|
|
|
|
|
zone = &pgdat->node_zones[zoneid];
|
|
zone = &pgdat->node_zones[zoneid];
|
|
@@ -727,17 +724,12 @@ int compact_pgdat(pg_data_t *pgdat, int order)
|
|
|
|
|
|
static int compact_node(int nid)
|
|
static int compact_node(int nid)
|
|
{
|
|
{
|
|
- pg_data_t *pgdat;
|
|
|
|
struct compact_control cc = {
|
|
struct compact_control cc = {
|
|
.order = -1,
|
|
.order = -1,
|
|
.sync = true,
|
|
.sync = true,
|
|
};
|
|
};
|
|
|
|
|
|
- if (nid < 0 || nid >= nr_node_ids || !node_online(nid))
|
|
|
|
- return -EINVAL;
|
|
|
|
- pgdat = NODE_DATA(nid);
|
|
|
|
-
|
|
|
|
- return __compact_pgdat(pgdat, &cc);
|
|
|
|
|
|
+ return __compact_pgdat(NODE_DATA(nid), &cc);
|
|
}
|
|
}
|
|
|
|
|
|
/* Compact all nodes in the system */
|
|
/* Compact all nodes in the system */
|
|
@@ -745,6 +737,9 @@ static int compact_nodes(void)
|
|
{
|
|
{
|
|
int nid;
|
|
int nid;
|
|
|
|
|
|
|
|
+ /* Flush pending updates to the LRU lists */
|
|
|
|
+ lru_add_drain_all();
|
|
|
|
+
|
|
for_each_online_node(nid)
|
|
for_each_online_node(nid)
|
|
compact_node(nid);
|
|
compact_node(nid);
|
|
|
|
|
|
@@ -777,7 +772,14 @@ ssize_t sysfs_compact_node(struct device *dev,
|
|
struct device_attribute *attr,
|
|
struct device_attribute *attr,
|
|
const char *buf, size_t count)
|
|
const char *buf, size_t count)
|
|
{
|
|
{
|
|
- compact_node(dev->id);
|
|
|
|
|
|
+ int nid = dev->id;
|
|
|
|
+
|
|
|
|
+ if (nid >= 0 && nid < nr_node_ids && node_online(nid)) {
|
|
|
|
+ /* Flush pending updates to the LRU lists */
|
|
|
|
+ lru_add_drain_all();
|
|
|
|
+
|
|
|
|
+ compact_node(nid);
|
|
|
|
+ }
|
|
|
|
|
|
return count;
|
|
return count;
|
|
}
|
|
}
|