Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1ac57cdc authored by qctecmdr's avatar qctecmdr Committed by Gerrit - the friendly Code Review server
Browse files

Merge "soc: qcom: memoffline: use a freezable unbounded workqueue for migration"

parents 959d2271 0c803ec1
Loading
Loading
Loading
Loading
+18 −2
Original line number Diff line number Diff line
@@ -48,6 +48,7 @@ static u32 offline_granule;
static bool is_rpm_controller;
static bool has_pend_offline_req;
static atomic_long_t totalram_pages_with_offline = ATOMIC_INIT(0);
static struct workqueue_struct *migrate_wq;

#define MODULE_CLASS_NAME	"mem-offline"
#define MIGRATE_TIMEOUT_SEC	(20)
@@ -971,6 +972,13 @@ static ssize_t show_mem_stats(struct kobject *kobj,
static struct kobj_attribute stats_attr =
		__ATTR(stats, 0444, show_mem_stats, NULL);

static ssize_t show_anon_migrate(struct kobject *kobj,
					struct kobj_attribute *attr, char *buf)
{
	return scnprintf(buf, PAGE_SIZE, "%lu\n",
				atomic_read(&target_migrate_pages));
}

static ssize_t store_anon_migrate(struct kobject *kobj,
				struct kobj_attribute *attr, const char *buf,
				size_t size)
@@ -984,7 +992,7 @@ static ssize_t store_anon_migrate(struct kobject *kobj,
	atomic_add(val, &target_migrate_pages);

	if (!work_pending(&fill_movable_zone_work))
		queue_work(system_unbound_wq, &fill_movable_zone_work);
		queue_work(migrate_wq, &fill_movable_zone_work);

	return size;
}
@@ -993,7 +1001,7 @@ static struct kobj_attribute offline_granule_attr =
		__ATTR(offline_granule, 0444, show_mem_offline_granule, NULL);

static struct kobj_attribute anon_migration_size_attr =
		__ATTR(anon_migrate, 0220, NULL, store_anon_migrate);
		__ATTR(anon_migrate, 0644, show_anon_migrate, store_anon_migrate);

static struct attribute *mem_root_attrs[] = {
		&stats_attr.attr,
@@ -1124,6 +1132,14 @@ static int mem_offline_driver_probe(struct platform_device *pdev)
	if (bypass_send_msg)
		pr_info("mem-offline: bypass mode\n");

	migrate_wq = alloc_workqueue("reverse_migrate_wq",
					WQ_UNBOUND | WQ_FREEZABLE, 0);
	if (!migrate_wq) {
		pr_err("Failed to create the worker for reverse migration\n");
		ret = -ENOMEM;
		goto err_sysfs_remove_group;
	}

	return 0;

err_sysfs_remove_group: