Re: [PATCH] mm/damon: Remove duplicate get_monitoring_region() definitions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




在 2022/9/8 上午4:59, SeongJae Park 写道:
On Wed, 7 Sep 2022 17:27:12 +0000 SeongJae Park <sj@xxxxxxxxxx> wrote:

[...]
diff --git a/mm/damon/ops-common.c b/mm/damon/ops-common.c
index b1335de200e7..01938f33038d 100644
--- a/mm/damon/ops-common.c
+++ b/mm/damon/ops-common.c
@@ -172,3 +172,31 @@ int damon_hot_score(struct damon_ctx *c, struct damon_region *r,

  	return hotness;
  }
+
+static inline int walk_system_ram(struct resource *res, void *arg)
+{
+	struct damon_addr_range *a = arg;
+
+	if (a->end - a->start < resource_size(res)) {
+		a->start = res->start;
+		a->end = res->end;
+	}
+	return 0;
+}
+
+/*
+ * Find biggest 'System RAM' resource and store its start and end address in
+ * @start and @end, respectively.  If no System RAM is found, returns false.
+ */
+bool get_monitoring_region(unsigned long *start, unsigned long *end)
+{
+	struct damon_addr_range arg = {};
+
+	walk_system_ram_res(0, ULONG_MAX, &arg, walk_system_ram);
+	if (arg.end <= arg.start)
+		return false;
+
+	*start = arg.start;
+	*end = arg.end;
+	return true;
+}
'ops-common.c' is for code that common in monitoring operations
implementations.  I'd prefer to have yet another source file for the DAMON
modules including reclaim and lru_sort, say, 'modules-common.c'.
Or, putting it in damon/core.c might make more sense.
Ok,  i will fix them in my next patch, thanks.


Thanks,
SJ

[...]




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux