Message ID | 20230628115910.3817966-2-houtao@huaweicloud.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | Add benchmark for bpf memory allocator | expand |
On Wed, Jun 28, 2023 at 4:41 AM Hou Tao <houtao@huaweicloud.com> wrote: > > From: Hou Tao <houtao1@huawei.com> > > max() will be used by the following htab-mem benchmark patch. > > Signed-off-by: Hou Tao <houtao1@huawei.com> > --- > tools/testing/selftests/bpf/bpf_util.h | 7 +++++++ > 1 file changed, 7 insertions(+) > > diff --git a/tools/testing/selftests/bpf/bpf_util.h b/tools/testing/selftests/bpf/bpf_util.h > index 10587a29b967..e87e9f8c13a7 100644 > --- a/tools/testing/selftests/bpf/bpf_util.h > +++ b/tools/testing/selftests/bpf/bpf_util.h > @@ -59,4 +59,11 @@ static inline void bpf_strlcpy(char *dst, const char *src, size_t sz) > (offsetof(TYPE, MEMBER) + sizeof_field(TYPE, MEMBER)) > #endif > > +#ifndef min > +#define min(x, y) ((x) < (y) ? (x) : (y)) > +#endif > +#ifndef max > +#define max(x, y) ((x) < (y) ? (y) : (x)) > +#endif That's for user space only? Just use the standard MIN/MAX macros.
Hi, On 6/29/2023 2:02 AM, Alexei Starovoitov wrote: > On Wed, Jun 28, 2023 at 4:41 AM Hou Tao <houtao@huaweicloud.com> wrote: >> From: Hou Tao <houtao1@huawei.com> >> >> max() will be used by the following htab-mem benchmark patch. >> >> Signed-off-by: Hou Tao <houtao1@huawei.com> >> --- >> tools/testing/selftests/bpf/bpf_util.h | 7 +++++++ >> 1 file changed, 7 insertions(+) >> >> diff --git a/tools/testing/selftests/bpf/bpf_util.h b/tools/testing/selftests/bpf/bpf_util.h >> index 10587a29b967..e87e9f8c13a7 100644 >> --- a/tools/testing/selftests/bpf/bpf_util.h >> +++ b/tools/testing/selftests/bpf/bpf_util.h >> @@ -59,4 +59,11 @@ static inline void bpf_strlcpy(char *dst, const char *src, size_t sz) >> (offsetof(TYPE, MEMBER) + sizeof_field(TYPE, MEMBER)) >> #endif >> >> +#ifndef min >> +#define min(x, y) ((x) < (y) ? (x) : (y)) >> +#endif >> +#ifndef max >> +#define max(x, y) ((x) < (y) ? (y) : (x)) >> +#endif > That's for user space only? > Just use the standard MIN/MAX macros. > . Yes. Will update and remove this prepare patch.
diff --git a/tools/testing/selftests/bpf/bpf_util.h b/tools/testing/selftests/bpf/bpf_util.h index 10587a29b967..e87e9f8c13a7 100644 --- a/tools/testing/selftests/bpf/bpf_util.h +++ b/tools/testing/selftests/bpf/bpf_util.h @@ -59,4 +59,11 @@ static inline void bpf_strlcpy(char *dst, const char *src, size_t sz) (offsetof(TYPE, MEMBER) + sizeof_field(TYPE, MEMBER)) #endif +#ifndef min +#define min(x, y) ((x) < (y) ? (x) : (y)) +#endif +#ifndef max +#define max(x, y) ((x) < (y) ? (y) : (x)) +#endif + #endif /* __BPF_UTIL__ */