-
Notifications
You must be signed in to change notification settings - Fork 173
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
Conversation
syxl-time
commented
Jul 19, 2024
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 | "); |
There was a problem hiding this comment.
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)
There was a problem hiding this comment.
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 | "); |
There was a problem hiding this comment.
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)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
改好了师兄,修改为for循环判断标志位了
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM