irqbalance: sync with upstream (#621)

Signed-off-by: Linhui Liu <liulinhui36@gmail.com>

Signed-off-by: Linhui Liu <liulinhui36@gmail.com>
This commit is contained in:
lovehackintosh 2022-12-08 21:46:59 +08:00 committed by GitHub
parent cf45e01b7f
commit 24a50e6a71
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 94 additions and 61 deletions

View File

@ -5,27 +5,21 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=irqbalance
PKG_VERSION:=1.8.0
PKG_RELEASE:=1
PKG_VERSION:=1.9.2
PKG_RELEASE:=$(AUTORELEASE)
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://github.com/Irqbalance/irqbalance.git
PKG_SOURCE_VERSION:=99ae256d02b35778b406e598beedc8d827cdac18
PKG_MIRROR_HASH:=35a9607ccc7827209cbe5cfeb5d5354ad3c1f95ffdefa866a016758680a40b4e
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
PKG_LICENSE:=GPLv2
PKG_SOURCE_VERSION:=v$(PKG_VERSION)
PKG_MIRROR_HASH:=e2c81725e7b6d711a47d68755a222236d7081726d567aca1c1295e6fe1caa865
PKG_MAINTAINER:=Hannu Nyman <hannu.nyman@iki.fi>
PKG_FIXUP:=autoreconf
PKG_REMOVE_FILES:=autogen.sh
PKG_BUILD_PARALLEL:=1
include $(INCLUDE_DIR)/nls.mk
PKG_LICENSE:=GPL-2.0-or-later
PKG_LICENSE_FILES:=COPYING
include $(INCLUDE_DIR)/package.mk
include $(INCLUDE_DIR)/nls.mk
include $(INCLUDE_DIR)/meson.mk
PKG_BUILD_DEPENDS += glib2
@ -43,34 +37,17 @@ define Package/irqbalance/description
increase performance.
endef
CONFIGURE_ARGS+= \
--disable-numa \
--with-libcap_ng=no \
--with-systemd=no \
--without-irqbalance-ui \
--enable-static=glib2
GLIB2_LIBS="$(STAGING_DIR)/usr/lib/libglib-2.0.a"
ifeq ($(CONFIG_BUILD_NLS),y)
GLIB2_LIBS += $(INTL_LDFLAGS) -lintl
endif
ifeq ($(CONFIG_USE_GLIBC),y)
GLIB2_LIBS += -lpthread
endif
CONFIGURE_VARS += \
GLIB2_LIBS="$(GLIB2_LIBS) \
$(ICONV_LDFLAGS) -liconv"
define Package/irqbalance/conffiles
/etc/config/irqbalance
endef
MESON_ARGS += \
-Dcapng=disabled \
-Dui=disabled
define Package/irqbalance/install
$(INSTALL_DIR) $(1)/usr/sbin
$(INSTALL_BIN) $(PKG_BUILD_DIR)/irqbalance $(1)/usr/sbin/
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/irqbalance $(1)/usr/sbin/
$(INSTALL_DIR) $(1)/etc/init.d
$(INSTALL_BIN) ./files/irqbalance.init $(1)/etc/init.d/irqbalance
$(INSTALL_DIR) $(1)/etc/config

View File

@ -1,6 +1,10 @@
config irqbalance 'irqbalance'
option enabled '0'
# Level at which irqbalance partitions cache domains.
# Default is 2 (L2$).
#option deepestcache '2'
# The default value is 10 seconds
#option interval '10'

View File

@ -16,7 +16,8 @@ start_service() {
config_get_bool enabled irqbalance enabled 0
[ "$enabled" -gt 0 ] || return 0
mkdir -p /var/run/irqbalance
# 2 is the default
config_get deepestcache irqbalance deepestcache 2
# 10 is the default
config_get interval irqbalance interval 10
@ -30,7 +31,7 @@ start_service() {
config_list_foreach irqbalance banirq handle_banirq_value
procd_open_instance "irqbalance"
procd_set_param command /usr/sbin/irqbalance -f -t "$interval" "$banirq"
procd_set_param command /usr/sbin/irqbalance -f -c "$deepestcache" -t "$interval" "$banirq"
procd_set_param respawn
procd_close_instance
}

View File

@ -0,0 +1,73 @@
From 35072fc06b9efe923f6ac1bd73b67c33d3ae619b Mon Sep 17 00:00:00 2001
From: Rosen Penev <rosenp@gmail.com>
Date: Fri, 10 Jun 2022 23:14:27 -0700
Subject: [PATCH] add meson
Signed-off-by: Rosen Penev <rosenp@gmail.com>
---
meson.build | 43 +++++++++++++++++++++++++++++++++++++++++++
meson_options.txt | 11 +++++++++++
2 files changed, 54 insertions(+)
create mode 100644 meson.build
create mode 100644 meson_options.txt
--- /dev/null
+++ b/meson.build
@@ -0,0 +1,43 @@
+project('irqbalance', 'c',
+ version : '1.9.0',
+ default_options : ['warning_level=1']
+)
+
+cc = meson.get_compiler('c')
+
+glib_dep = dependency('glib-2.0', static: true)
+m_dep = cc.find_library('m', required: false)
+capng_dep = dependency('libcap-ng', required: get_option('capng'))
+ncurses_dep = dependency('curses', required: get_option('ui'))
+systemd_dep = dependency('libsystemd', required: get_option('systemd'))
+
+cdata = configuration_data()
+cdata.set('HAVE_GETOPT_LONG', cc.has_function('getopt_long'))
+cdata.set('HAVE_IRQBALANCEUI', ncurses_dep.found())
+cdata.set('HAVE_NUMA_H', cc.has_header('numa.h'))
+cdata.set('HAVE_LIBCAP_NG', capng_dep.found())
+cdata.set('HAVE_LIBSYSTEMD', systemd_dep.found())
+cdata.set_quoted('VERSION', meson.project_version())
+cfile = configure_file(
+ output: 'config.h',
+ configuration: cdata
+)
+
+if cdata.get('HAVE_IRQBALANCEUI')
+ add_project_arguments('-D_GNU_SOURCE', language: 'c')
+endif
+
+
+executable('irqbalance',
+ 'activate.c',
+ 'bitmap.c',
+ 'classify.c',
+ 'cputree.c',
+ 'irqbalance.c',
+ 'irqlist.c',
+ 'numa.c',
+ 'placement.c',
+ 'procinterrupts.c',
+ dependencies: [ glib_dep, m_dep, capng_dep, ncurses_dep, systemd_dep ],
+ install : true
+)
--- /dev/null
+++ b/meson_options.txt
@@ -0,0 +1,11 @@
+option('capng', type : 'feature',
+ description : 'Build with libcap-ng support',
+)
+
+option('systemd', type : 'feature',
+ description : 'Build with systemd support',
+)
+
+option('ui', type : 'feature',
+ description : 'Build the UI component',
+)

View File

@ -1,6 +1,6 @@
--- a/configure.ac
+++ b/configure.ac
@@ -32,7 +32,7 @@ PKG_CHECK_MODULES([NCURSESW], [ncursesw]
@@ -41,7 +41,7 @@ PKG_CHECK_MODULES([NCURSESW], [ncursesw]
AS_IF([test "x$has_ncursesw" = "xyes"], [
AC_SUBST([NCURSESW_CFLAGS])
AC_SUBST([NCURSESW_LIBS])

View File

@ -1,22 +0,0 @@
--- a/irqbalance.h
+++ b/irqbalance.h
@@ -165,7 +165,7 @@ extern unsigned int log_mask;
#endif /* HAVE_LIBSYSTEMD */
#define SOCKET_PATH "irqbalance"
-#define SOCKET_TMPFS "/run/irqbalance"
+#define SOCKET_TMPFS "/var/run/irqbalance"
extern int process_one_line(char *path, void (*cb)(char *line, void *data), void *data);
extern void get_mask_from_bitmap(char *line, void *mask);
--- a/ui/irqbalance-ui.h
+++ b/ui/irqbalance-ui.h
@@ -8,7 +8,7 @@
#include <glib-unix.h>
#define SOCKET_PATH "irqbalance"
-#define SOCKET_TMPFS "/run/irqbalance"
+#define SOCKET_TMPFS "/var/run/irqbalance"
#define STATS "stats"
#define SET_SLEEP "settings sleep "