mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-27 14:14:24 +08:00
6ad59a3838
Patch series "mm/damon: misc updates for 6.8". Update comments, tests, and documents for DAMON. This patch (of 6): SeongJae is using his kernel.org account for DAMON development. Update the old email addresses on the comments of DAMON source files. Link: https://lkml.kernel.org/r/20231213190338.54146-1-sj@kernel.org Link: https://lkml.kernel.org/r/20231213190338.54146-2-sj@kernel.org Signed-off-by: SeongJae Park <sj@kernel.org> Cc: Jonathan Corbet <corbet@lwn.net> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
43 lines
874 B
C
43 lines
874 B
C
// SPDX-License-Identifier: GPL-2.0
|
|
/*
|
|
* Common Primitives for DAMON Modules
|
|
*
|
|
* Author: SeongJae Park <sj@kernel.org>
|
|
*/
|
|
|
|
#include <linux/damon.h>
|
|
|
|
#include "modules-common.h"
|
|
|
|
/*
|
|
* Allocate, set, and return a DAMON context for the physical address space.
|
|
* @ctxp: Pointer to save the point to the newly created context
|
|
* @targetp: Pointer to save the point to the newly created target
|
|
*/
|
|
int damon_modules_new_paddr_ctx_target(struct damon_ctx **ctxp,
|
|
struct damon_target **targetp)
|
|
{
|
|
struct damon_ctx *ctx;
|
|
struct damon_target *target;
|
|
|
|
ctx = damon_new_ctx();
|
|
if (!ctx)
|
|
return -ENOMEM;
|
|
|
|
if (damon_select_ops(ctx, DAMON_OPS_PADDR)) {
|
|
damon_destroy_ctx(ctx);
|
|
return -EINVAL;
|
|
}
|
|
|
|
target = damon_new_target();
|
|
if (!target) {
|
|
damon_destroy_ctx(ctx);
|
|
return -ENOMEM;
|
|
}
|
|
damon_add_target(ctx, target);
|
|
|
|
*ctxp = ctx;
|
|
*targetp = target;
|
|
return 0;
|
|
}
|