Skip to content

Commit

Permalink
mm: cma add remove_sysfs()
Browse files Browse the repository at this point in the history
As a part of the delete chain when (other) mm sysfs creation failed in
sysfs_node.c

Bug: 230567291
Test: test together with compaction duration metric (Bug 229927848)
Signed-off-by: Robin Hsu <[email protected]>
Change-Id: I94176153b8f44884ac7a10cc43192bd2d088ecee
Signed-off-by: celtare21 <[email protected]>
  • Loading branch information
Robin Hsu authored and celtare21 committed Dec 16, 2022
1 parent 527f666 commit 860bd75
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 5 deletions.
16 changes: 13 additions & 3 deletions drivers/soc/google/pixel_stat/mm/cma.c
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ static int add_cma_sysfs(struct cma *cma, void *data)
return 0;
}

static int remove_cma_sysfs(struct cma *cma, void *data)
static int remove_cma_sysfs_one(struct cma *cma, void *data)
{
int cma_idx = *((int *)data);

Expand All @@ -310,7 +310,17 @@ static int remove_cma_sysfs(struct cma *cma, void *data)
return 0;
}

int pixel_mm_cma_sysfs(struct kobject *mm_kobj)
void remove_cma_sysfs(void)
{
int cma_idx;

for (cma_idx = 0; cma_idx < MAX_CMA_AREAS; cma_idx++) {
kobject_put(&stats[cma_idx]->kobj);
stats[cma_idx] = NULL;
}
}

int create_cma_sysfs(struct kobject *mm_kobj)
{
int ret;
int cma_idx = 0;
Expand All @@ -321,7 +331,7 @@ int pixel_mm_cma_sysfs(struct kobject *mm_kobj)

ret = cma_for_each_area(add_cma_sysfs, &cma_idx);
if (ret)
cma_for_each_area(remove_cma_sysfs, &cma_idx);
cma_for_each_area(remove_cma_sysfs_one, &cma_idx);

return ret;
}
3 changes: 2 additions & 1 deletion drivers/soc/google/pixel_stat/mm/cma.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@

struct kobject;

int pixel_mm_cma_sysfs(struct kobject *mm_kobj);
int create_cma_sysfs(struct kobject *mm_kobj);
void remove_cma_sysfs(void);
void vh_cma_alloc_start(void *data, s64 *ts);
void vh_cma_alloc_finish(void *data, struct cma *cma, struct page *page,
unsigned long count, unsigned int align,
Expand Down
2 changes: 1 addition & 1 deletion drivers/soc/google/pixel_stat/mm/sysfs_node.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ int pixel_mm_sysfs(void)
if (ret)
goto remove_stat_sysfs;

ret = pixel_mm_cma_sysfs(pixel_stat_mm_kobj);
ret = create_cma_sysfs(pixel_stat_mm_kobj);
if (ret)
goto remove_vmscan_sysfs;

Expand Down

0 comments on commit 860bd75

Please sign in to comment.