mbox series

[v3,0/3] Improve efficiency of detecting duplicate in libselinux

Message ID 20230308095308.60661-1-wanghuizhao1@huawei.com (mailing list archive)
Headers show
Series Improve efficiency of detecting duplicate in libselinux | expand

Message

Huizhao Wang March 8, 2023, 9:53 a.m. UTC
changes in v3:
  1. fix bug to detect duplicate items when mode is set to 0. Therefore,
     `k->mode` is deleted from the hash calculation. More information on the
     https://lore.kernel.org/selinux/a236c473-4f18-c882-2197-f49195d84051@huawei.com/
  2. add new macro definition SHRINK_MULTIS. This macro is used to control
     the `hashtab_len`.
  3. modify the algorithm complexity in the commit message.
  4. fix `hash_table` leak in failed malloc.

v2: https://lore.kernel.org/selinux/20230217084458.40597-1-wanghuizhao1@huawei.com/

v1: https://lore.kernel.org/selinux/20230209114253.120485-1-wanghuizhao1@huawei.com/


wanghuizhao (3):
  libselinux: migrating hashtab from policycoreutils
  libselinux: adapting hashtab to libselinux
  libselinux: performance optimization for duplicate detection

 libselinux/src/hashtab.c    | 234 ++++++++++++++++++++++++++++++++++++++++++++
 libselinux/src/hashtab.h    | 117 ++++++++++++++++++++++
 libselinux/src/label_file.c | 120 ++++++++++++++++++-----
 3 files changed, 447 insertions(+), 24 deletions(-)
 create mode 100644 libselinux/src/hashtab.c
 create mode 100644 libselinux/src/hashtab.h