Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mem_watcher:添加打印页面修饰符标志gfp_mask的功能 #868

Merged
merged 8 commits into from
Jul 24, 2024

Conversation

syxl-time
Copy link
Contributor

after

if ((flag & GFP_HIGHUSER) == GFP_HIGHUSER) strcat(combined, "GFP_HIGHUSER | ");
if ((flag & GFP_HIGHUSER_MOVABLE) == GFP_HIGHUSER_MOVABLE) strcat(combined, "GFP_HIGHUSER_MOVABLE | ");
if ((flag & GFP_TRANSHUGE_LIGHT) == GFP_TRANSHUGE_LIGHT) strcat(combined, "GFP_TRANSHUGE_LIGHT | ");
if ((flag & GFP_TRANSHUGE) == GFP_TRANSHUGE) strcat(combined, "GFP_TRANSHUGE | ");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

根据如下定义,你的输出将会是“"GFP_NOIO | GFP_NOFS | GFP_USER”,是否符合你的预期?还是只输出一个GFP_USER就够了?
#define GFP_NOIO (___GFP_RECLAIMABLE)
#define GFP_NOFS (___GFP_RECLAIMABLE | ___GFP_IO)
#define GFP_USER (___GFP_RECLAIMABLE | ___GFP_IO | ___GFP_FS | ___GFP_HARDWALL)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

是都会被打印出来,这样可以看出标志的所有特性

if (flag & ___GFP_THISNODE) strcat(separate, "___GFP_THISNODE | ");
if (flag & ___GFP_ACCOUNT) strcat(separate, "___GFP_ACCOUNT | ");
if (flag & ___GFP_ZEROTAGS) strcat(separate, "___GFP_ZEROTAGS | ");
if (flag & ___GFP_SKIP_KASAN_POISON) strcat(separate, "___GFP_SKIP_KASAN_POISON | ");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

以上if语句,可以定义一个结构体数组,用for循环实现,这样标志变动只需要修改数组即可。如:
gfp_list[] = {
{___GFP_DMA, "___GFP_DMA"},
{___GFP_HIGHMEM, "___GFP_HIGHMEM"},
//...
};

//for (gfp_list)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

改好了师兄,修改为for循环判断标志位了

Copy link
Member

@helight helight left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@chenamy2017 chenamy2017 self-requested a review July 24, 2024 08:35
@chenamy2017 chenamy2017 merged commit e040be4 into linuxkerneltravel:develop Jul 24, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants