sched: ems: ontime: Modify to initialize the boundary value by ratio
authorDaeyeong Lee <daeyeong.lee@samsung.com>
Mon, 18 Jun 2018 02:44:00 +0000 (11:44 +0900)
committerCosmin Tanislav <demonsingur@gmail.com>
Mon, 22 Apr 2024 17:24:56 +0000 (20:24 +0300)
Change-Id: Iab4450579898d8b5d561d00f7c627d7c88ce88ab
Signed-off-by: Daeyeong Lee <daeyeong.lee@samsung.com>
kernel/sched/ems/ontime.c

index bb21451a80b8c27b098bd69945507c1919e3e70f..b5516d8c9e058a186ec056f08dfe7576e98b343a 100644 (file)
@@ -785,16 +785,16 @@ out:
        pr_err("ONTIME(%s): failed to create sysfs node\n", __func__);
        return -EINVAL;
 }
-late_initcall(ontime_sysfs_init);
 
 /****************************************************************/
 /*                     initialization                          */
 /****************************************************************/
-static void
+static void __init
 parse_ontime(struct device_node *dn, struct ontime_cond *cond, int cnt)
 {
        struct device_node *ontime, *coregroup;
        char name[15];
+       unsigned long capacity;
        unsigned int prop;
        int res = 0;
 
@@ -808,12 +808,14 @@ parse_ontime(struct device_node *dn, struct ontime_cond *cond, int cnt)
                goto disable;
        cond->coregroup = cnt;
 
+       capacity = capacity_orig_of(cpumask_first(&cond->cpus));
+
        /* If any of ontime parameter isn't, disable ontime of this coregroup */
        res |= of_property_read_u32(coregroup, "upper-boundary", &prop);
-       cond->upper_boundary = prop;
+       cond->upper_boundary = capacity * prop / 100;
 
        res |= of_property_read_u32(coregroup, "lower-boundary", &prop);
-       cond->lower_boundary = prop;
+       cond->lower_boundary = capacity * prop / 100;
 
        res |= of_property_read_u32(coregroup, "coverage-ratio", &prop);
        cond->coverage_ratio = prop;
@@ -825,6 +827,7 @@ parse_ontime(struct device_node *dn, struct ontime_cond *cond, int cnt)
        return;
 
 disable:
+       pr_err("ONTIME(%s): failed to parse ontime node\n", __func__);
        cond->enabled = false;
        cond->upper_boundary = ULONG_MAX;
        cond->lower_boundary = 0;
@@ -855,7 +858,9 @@ static int __init init_ontime(void)
                list_add_tail(&cond->list, &cond_list);
        }
 
+       ontime_sysfs_init();
+
        of_node_put(dn);
        return 0;
 }
-pure_initcall(init_ontime);
+late_initcall(init_ontime);