forked from ~ljy/RK356X_SDK_RELEASE

hc
2023-12-11 072de836f53be56a70cecf70b43ae43b7ce17376
kernel/kernel/sched/loadavg.c
....@@ -75,6 +75,7 @@
7575 loads[1] = (avenrun[1] + offset) << shift;
7676 loads[2] = (avenrun[2] + offset) << shift;
7777 }
78
+EXPORT_SYMBOL_GPL(get_avenrun);
7879
7980 long calc_load_fold_active(struct rq *this_rq, long adjust)
8081 {
....@@ -231,21 +232,34 @@
231232 return calc_load_idx & 1;
232233 }
233234
234
-void calc_load_nohz_start(void)
235
+static void calc_load_nohz_fold(struct rq *rq)
235236 {
236
- struct rq *this_rq = this_rq();
237237 long delta;
238238
239
- /*
240
- * We're going into NO_HZ mode, if there's any pending delta, fold it
241
- * into the pending NO_HZ delta.
242
- */
243
- delta = calc_load_fold_active(this_rq, 0);
239
+ delta = calc_load_fold_active(rq, 0);
244240 if (delta) {
245241 int idx = calc_load_write_idx();
246242
247243 atomic_long_add(delta, &calc_load_nohz[idx]);
248244 }
245
+}
246
+
247
+void calc_load_nohz_start(void)
248
+{
249
+ /*
250
+ * We're going into NO_HZ mode, if there's any pending delta, fold it
251
+ * into the pending NO_HZ delta.
252
+ */
253
+ calc_load_nohz_fold(this_rq());
254
+}
255
+
256
+/*
257
+ * Keep track of the load for NOHZ_FULL, must be called between
258
+ * calc_load_nohz_{start,stop}().
259
+ */
260
+void calc_load_nohz_remote(struct rq *rq)
261
+{
262
+ calc_load_nohz_fold(rq);
249263 }
250264
251265 void calc_load_nohz_stop(void)
....@@ -268,7 +282,7 @@
268282 this_rq->calc_load_update += LOAD_FREQ;
269283 }
270284
271
-static long calc_load_nohz_fold(void)
285
+static long calc_load_nohz_read(void)
272286 {
273287 int idx = calc_load_read_idx();
274288 long delta = 0;
....@@ -323,7 +337,7 @@
323337 }
324338 #else /* !CONFIG_NO_HZ_COMMON */
325339
326
-static inline long calc_load_nohz_fold(void) { return 0; }
340
+static inline long calc_load_nohz_read(void) { return 0; }
327341 static inline void calc_global_nohz(void) { }
328342
329343 #endif /* CONFIG_NO_HZ_COMMON */
....@@ -334,7 +348,7 @@
334348 *
335349 * Called from the global timer code.
336350 */
337
-void calc_global_load(unsigned long ticks)
351
+void calc_global_load(void)
338352 {
339353 unsigned long sample_window;
340354 long active, delta;
....@@ -346,7 +360,7 @@
346360 /*
347361 * Fold the 'old' NO_HZ-delta to include all NO_HZ CPUs.
348362 */
349
- delta = calc_load_nohz_fold();
363
+ delta = calc_load_nohz_read();
350364 if (delta)
351365 atomic_long_add(delta, &calc_load_tasks);
352366