@@ -38,9 +38,9 @@ DAMON provides below three interfaces for different users.
38
38
debugfs Interface
39
39
=================
40
40
41
- DAMON exports five files, ``attrs ``, ``target_ids ``, ``init_regions ``,
42
- ``schemes `` and ``monitor_on `` under its debugfs directory,
43
- ``<debugfs>/damon/ ``.
41
+ DAMON exports eight files, ``attrs ``, ``target_ids ``, ``init_regions ``,
42
+ ``schemes ``, ``monitor_on ``, `` kdamond_pid ``, `` mk_contexts `` and
43
+ ``rm_contexts `` under its debugfs directory, `` <debugfs>/damon/ ``.
44
44
45
45
46
46
Attributes
@@ -273,6 +273,52 @@ the monitoring is turned on. If you write to the files while DAMON is running,
273
273
an error code such as ``-EBUSY `` will be returned.
274
274
275
275
276
+ Monitoring Thread PID
277
+ ---------------------
278
+
279
+ DAMON does requested monitoring with a kernel thread called ``kdamond ``. You
280
+ can get the pid of the thread by reading the ``kdamond_pid `` file. When the
281
+ monitoring is turned off, reading the file returns ``none ``. ::
282
+
283
+ # cd <debugfs>/damon
284
+ # cat monitor_on
285
+ off
286
+ # cat kdamond_pid
287
+ none
288
+ # echo on > monitor_on
289
+ # cat kdamond_pid
290
+ 18594
291
+
292
+
293
+ Using Multiple Monitoring Threads
294
+ ---------------------------------
295
+
296
+ One ``kdamond `` thread is created for each monitoring context. You can create
297
+ and remove monitoring contexts for multiple ``kdamond `` required use case using
298
+ the ``mk_contexts `` and ``rm_contexts `` files.
299
+
300
+ Writing the name of the new context to the ``mk_contexts `` file creates a
301
+ directory of the name on the DAMON debugfs directory. The directory will have
302
+ DAMON debugfs files for the context. ::
303
+
304
+ # cd <debugfs>/damon
305
+ # ls foo
306
+ # ls: cannot access 'foo': No such file or directory
307
+ # echo foo > mk_contexts
308
+ # ls foo
309
+ # attrs init_regions kdamond_pid schemes target_ids
310
+
311
+ If the context is not needed anymore, you can remove it and the corresponding
312
+ directory by putting the name of the context to the ``rm_contexts `` file. ::
313
+
314
+ # echo foo > rm_contexts
315
+ # ls foo
316
+ # ls: cannot access 'foo': No such file or directory
317
+
318
+ Note that ``mk_contexts ``, ``rm_contexts ``, and ``monitor_on `` files are in the
319
+ root directory only.
320
+
321
+
276
322
.. _tracepoint :
277
323
278
324
Tracepoint for Monitoring Results
0 commit comments