-
Yonghong Song authored
Currently, for every table of a module, corresponding key/value sscanf/snprintf functions will be generated. These functions are mostly used for python API to facilitate passing keys between python and C++. It is a known issue that these sscanf/snprintf functions can consume a lot of system resources esp. memory for large arrays. Commit 22eae8c6 ("Use late-binding to finalize snprintf/sscanf") avoids unnecessary code generation for snprintf/sscanf until they are called. Even with this commit, however, the overhead can still be significant for large arrays. For example, the following large array, #define TCP6_RXMIT_BUCKET_BITS 18 struct tcp6_rxmit_tbl { __u64 buckets[1 << TCP6_RXMIT_BUCKET_BITS]; }; BPF_ARRAY(rxmit_marking_map, struct tcp6_rxmit_tbl, 1); is used inside Facebook. If it is added to examples/cpp/HelloWorld.cpp, the HelloWorld RSS memory will increase from 7MB to 370MB. This patch add a BPFModule API and a C++ API to disable rw_engine sscanf/snprintf function through additional constructor parameters. rw_engine support for Python is not affected. Signed-off-by: Yonghong Song <yhs@fb.com>
db7b8eb0