什么是“以色列"?在内核线程转储中 [英] What is "isra" in the kernel thread dump

查看:148
本文介绍了什么是“以色列"?在内核线程转储中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Linux内核调用堆栈转储通常包含以".isra.NNN"结尾的函数名称,其中NNN是一些数字.例如,请参见此处

Linux kernel call stack dump often includes function names that ends with ".isra.NNN" where NNN is some numbers. For example, see here and here.

那是什么意思,数字代表什么?

What does that mean, what does the number signify?

推荐答案

isra是在执行gcc选项-fipa-sra编译器优化时添加到函数名称的后缀.

isra is the suffix added to the function name when gcc option -fipa-sra compiler optimization being carried out.

gcc手册:

-fipa-sra

执行过程间标量替换集合,清除未使用的集合 参数和引用传递的参数替换为传递的参数 按值.

Perform interprocedural scalar replacement of aggregates, removal of unused parameters and replacement of parameters passed by reference by parameters passed by value.

在级别-O2-O3-Os上启用.

在此选项下优化的所有功能均在名称后附加了isra.我深入研究了gcc代码,并发现了附加字符串的函数.

All functions that are optimized under this option have isra appended to their names. I digged into gcc code and found out the function that was appending the string.

tree
clone_function_name (tree decl, const char *suffix)
{
  tree name = DECL_ASSEMBLER_NAME (decl);
  size_t len = IDENTIFIER_LENGTH (name);
  char *tmp_name, *prefix;

  prefix = XALLOCAVEC (char, len + strlen (suffix) + 2);
  memcpy (prefix, IDENTIFIER_POINTER (name), len);
  strcpy (prefix + len + 1, suffix);
#ifndef NO_DOT_IN_LABEL
  prefix[len] = '.';
#elif !defined NO_DOLLAR_IN_LABEL
  prefix[len] = '$';
#else
  prefix[len] = '_';
#endif
  ASM_FORMAT_PRIVATE_NAME (tmp_name, prefix, clone_fn_id_num++);
  return get_identifier (tmp_name);
}

这里,参数2 const char *suffix"isra",请注意函数宏ASM_FORMAT_PRIVATE_NAME的底部,该宏将clone_fn_id_num++作为其第三个参数.这是在"isra"之后找到的任意数字.顾名思义,它就是在此编译器选项下克隆的函数的计数(或者可以是跟踪所有克隆函数的全局计数器).

Here, argument 2, const char *suffix, is "isra" and notice at the bottom of the function macro ASM_FORMAT_PRIVATE_NAME which takes clone_fn_id_num++ as its 3rd argument. This is the arbitrary number found after "isra". This going by its name is the count of functions that are cloned under this compiler option (or may be a global counter that keeps track of all cloned functions).

如果您想了解更多信息,请在文件gcc/tree-sra.c中搜索modify_function,该文件又调用cgraph_function_versioning(),该文件将"isra"作为最后一个参数传递.

If you want to understand more, search for modify_function in file gcc/tree-sra.c which in turn calls cgraph_function_versioning() which passes "isra" as its last argument.

这篇关于什么是“以色列"?在内核线程转储中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆