From 6e63fde0e79938ecd5eba011896451a7a1e999cf Mon Sep 17 00:00:00 2001 From: coolsnowwolf Date: Fri, 12 Oct 2018 12:46:16 +0800 Subject: [PATCH] kernel: support gcc-optimized inlining on all architectures --- target/linux/generic/config-3.18 | 2 +- target/linux/generic/config-4.14 | 12 ++- target/linux/generic/config-4.9 | 8 +- .../600-net-core-add-RPS-balancer.patch | 93 ------------------- .../pending-4.9/220-optimize_inlining.patch | 70 ++++++++++++++ 5 files changed, 87 insertions(+), 98 deletions(-) delete mode 100644 target/linux/generic/hack-4.14/600-net-core-add-RPS-balancer.patch create mode 100644 target/linux/generic/pending-4.9/220-optimize_inlining.patch diff --git a/target/linux/generic/config-3.18 b/target/linux/generic/config-3.18 index 4a4495272..ee4fe40e1 100644 --- a/target/linux/generic/config-3.18 +++ b/target/linux/generic/config-3.18 @@ -654,7 +654,7 @@ CONFIG_CMDLINE="" # CONFIG_COMMON_CLK_QCOM is not set # CONFIG_COMMON_CLK_SI5351 is not set # CONFIG_COMMON_CLK_SI570 is not set -# CONFIG_COMPACTION is not set +CONFIG_COMPACTION=y # CONFIG_COMPAL_LAPTOP is not set # CONFIG_COMPAT_BRK is not set # CONFIG_COMPILE_TEST is not set diff --git a/target/linux/generic/config-4.14 b/target/linux/generic/config-4.14 index 30ff98c09..02a8fa623 100644 --- a/target/linux/generic/config-4.14 +++ b/target/linux/generic/config-4.14 @@ -811,7 +811,7 @@ CONFIG_CMDLINE="" # CONFIG_COMMON_CLK_VERSATILE is not set # CONFIG_COMMON_CLK_XGENE is not set # CONFIG_COMMON_CLK_XLNX_CLKWZRD is not set -# CONFIG_COMPACTION is not set +CONFIG_COMPACTION=y # CONFIG_COMPAL_LAPTOP is not set # CONFIG_COMPAT_BRK is not set # CONFIG_COMPILE_TEST is not set @@ -906,6 +906,7 @@ CONFIG_CRYPTO_BLKCIPHER2=y # CONFIG_CRYPTO_DEV_IMGTEC_HASH is not set # CONFIG_CRYPTO_DEV_MARVELL_CESA is not set # CONFIG_CRYPTO_DEV_MV_CESA is not set +# CONFIG_CRYPTO_DEV_MXC_SCC is not set # CONFIG_CRYPTO_DEV_MXS_DCP is not set # CONFIG_CRYPTO_DEV_NITROX_CNN55XX is not set # CONFIG_CRYPTO_DEV_QAT_C3XXX is not set @@ -917,6 +918,7 @@ CONFIG_CRYPTO_BLKCIPHER2=y # CONFIG_CRYPTO_DEV_QCE is not set # CONFIG_CRYPTO_DEV_SAFEXCEL is not set # CONFIG_CRYPTO_DEV_SAHARA is not set +# CONFIG_CRYPTO_DEV_S5P is not set # CONFIG_CRYPTO_DEV_TALITOS is not set # CONFIG_CRYPTO_DEV_VIRTIO is not set # CONFIG_CRYPTO_DH is not set @@ -1796,6 +1798,7 @@ CONFIG_HZ_100=y # CONFIG_I2C_RCAR is not set # CONFIG_I2C_RK3X is not set # CONFIG_I2C_ROBOTFUZZ_OSIF is not set +# CONFIG_I2C_S3C2410 is not set # CONFIG_I2C_SCMI is not set # CONFIG_I2C_SH_MOBILE is not set # CONFIG_I2C_SIMTEC is not set @@ -1928,6 +1931,7 @@ CONFIG_INOTIFY_USER=y # CONFIG_INPUT_ATI_REMOTE2 is not set # CONFIG_INPUT_ATLAS_BTNS is not set # CONFIG_INPUT_ATMEL_CAPTOUCH is not set +# CONFIG_INPUT_AXP20X_PEK is not set # CONFIG_INPUT_BMA150 is not set # CONFIG_INPUT_CM109 is not set # CONFIG_INPUT_CMA3000 is not set @@ -1952,6 +1956,7 @@ CONFIG_INOTIFY_USER=y # CONFIG_INPUT_KXTJ9 is not set # CONFIG_INPUT_LEDS is not set # CONFIG_INPUT_MATRIXKMAP is not set +# CONFIG_INPUT_MAX8997_HAPTIC is not set CONFIG_INPUT_MISC=y # CONFIG_INPUT_MMA8450 is not set # CONFIG_INPUT_MOUSE is not set @@ -2219,6 +2224,7 @@ CONFIG_KERNFS=y # CONFIG_KEYBOARD_SAMSUNG is not set # CONFIG_KEYBOARD_SH_KEYSC is not set # CONFIG_KEYBOARD_SNVS_PWRKEY is not set +# CONFIG_KEYBOARD_STMPE is not set # CONFIG_KEYBOARD_STOWAWAY is not set # CONFIG_KEYBOARD_SUNKBD is not set # CONFIG_KEYBOARD_TCA6416 is not set @@ -2648,6 +2654,7 @@ CONFIG_MMC_BLOCK_MINORS=8 # CONFIG_MMC_SDHCI_OF_HLWD is not set # CONFIG_MMC_SDHCI_PXAV2 is not set # CONFIG_MMC_SDHCI_PXAV3 is not set +# CONFIG_MMC_SDHCI_S3C is not set # CONFIG_MMC_SDHCI_XENON is not set # CONFIG_MMC_SDRICOH_CS is not set # CONFIG_MMC_SPI is not set @@ -3161,7 +3168,6 @@ CONFIG_NFS_V3=y # CONFIG_NFT_SET_BITMAP is not set # CONFIG_NF_CONNTRACK is not set # CONFIG_NF_CONNTRACK_AMANDA is not set -# CONFIG_NF_CONNTRACK_CHAIN_EVENTS is not set # CONFIG_NF_CONNTRACK_EVENTS is not set # CONFIG_NF_CONNTRACK_FTP is not set # CONFIG_NF_CONNTRACK_H323 is not set @@ -3314,6 +3320,7 @@ CONFIG_NMI_LOG_BUF_SHIFT=13 # CONFIG_OPROFILE is not set # CONFIG_OPROFILE_EVENT_MULTIPLEX is not set # CONFIG_OPT3001 is not set +# CONFIG_OPTIMIZE_INLINING is not set # CONFIG_ORANGEFS_FS is not set # CONFIG_ORION_WATCHDOG is not set # CONFIG_OSF_PARTITION is not set @@ -4667,6 +4674,7 @@ CONFIG_SND_X86=y # CONFIG_SPI_PXA2XX is not set # CONFIG_SPI_PXA2XX_PCI is not set # CONFIG_SPI_ROCKCHIP is not set +# CONFIG_SPI_S3C64XX is not set # CONFIG_SPI_SC18IS602 is not set # CONFIG_SPI_SLAVE is not set # CONFIG_SPI_SPIDEV is not set diff --git a/target/linux/generic/config-4.9 b/target/linux/generic/config-4.9 index c3efcdc66..979028f04 100644 --- a/target/linux/generic/config-4.9 +++ b/target/linux/generic/config-4.9 @@ -764,7 +764,7 @@ CONFIG_CMDLINE="" # CONFIG_COMMON_CLK_SI5351 is not set # CONFIG_COMMON_CLK_SI570 is not set # CONFIG_COMMON_CLK_XLNX_CLKWZRD is not set -# CONFIG_COMPACTION is not set +CONFIG_COMPACTION=y # CONFIG_COMPAL_LAPTOP is not set # CONFIG_COMPAT_BRK is not set # CONFIG_COMPILE_TEST is not set @@ -852,6 +852,7 @@ CONFIG_CRYPTO_BLKCIPHER2=y # CONFIG_CRYPTO_DEV_IMGTEC_HASH is not set # CONFIG_CRYPTO_DEV_MARVELL_CESA is not set # CONFIG_CRYPTO_DEV_MV_CESA is not set +# CONFIG_CRYPTO_DEV_MXC_SCC is not set # CONFIG_CRYPTO_DEV_MXS_DCP is not set # CONFIG_CRYPTO_DEV_QAT_C3XXX is not set # CONFIG_CRYPTO_DEV_QAT_C3XXXVF is not set @@ -1802,6 +1803,7 @@ CONFIG_INOTIFY_USER=y # CONFIG_INPUT_ATI_REMOTE2 is not set # CONFIG_INPUT_ATLAS_BTNS is not set # CONFIG_INPUT_ATMEL_CAPTOUCH is not set +# CONFIG_INPUT_AXP20X_PEK is not set # CONFIG_INPUT_BMA150 is not set # CONFIG_INPUT_CM109 is not set # CONFIG_INPUT_CMA3000 is not set @@ -1826,6 +1828,7 @@ CONFIG_INOTIFY_USER=y # CONFIG_INPUT_KXTJ9 is not set # CONFIG_INPUT_LEDS is not set # CONFIG_INPUT_MATRIXKMAP is not set +# CONFIG_INPUT_MAX8997_HAPTIC is not set CONFIG_INPUT_MISC=y # CONFIG_INPUT_MMA8450 is not set # CONFIG_INPUT_MOUSE is not set @@ -2084,6 +2087,7 @@ CONFIG_KERNFS=y # CONFIG_KEYBOARD_SAMSUNG is not set # CONFIG_KEYBOARD_SH_KEYSC is not set # CONFIG_KEYBOARD_SNVS_PWRKEY is not set +# CONFIG_KEYBOARD_STMPE is not set # CONFIG_KEYBOARD_STOWAWAY is not set # CONFIG_KEYBOARD_SUNKBD is not set # CONFIG_KEYBOARD_TCA6416 is not set @@ -2970,7 +2974,6 @@ CONFIG_NFS_V3=y # CONFIG_NFT_DUP_IPV6 is not set # CONFIG_NF_CONNTRACK is not set # CONFIG_NF_CONNTRACK_AMANDA is not set -# CONFIG_NF_CONNTRACK_CHAIN_EVENTS is not set # CONFIG_NF_CONNTRACK_EVENTS is not set # CONFIG_NF_CONNTRACK_FTP is not set # CONFIG_NF_CONNTRACK_H323 is not set @@ -3116,6 +3119,7 @@ CONFIG_NMI_LOG_BUF_SHIFT=13 # CONFIG_OPROFILE is not set # CONFIG_OPROFILE_EVENT_MULTIPLEX is not set # CONFIG_OPT3001 is not set +# CONFIG_OPTIMIZE_INLINING is not set # CONFIG_ORANGEFS_FS is not set # CONFIG_ORION_WATCHDOG is not set # CONFIG_OSF_PARTITION is not set diff --git a/target/linux/generic/hack-4.14/600-net-core-add-RPS-balancer.patch b/target/linux/generic/hack-4.14/600-net-core-add-RPS-balancer.patch deleted file mode 100644 index 6fc52ee25..000000000 --- a/target/linux/generic/hack-4.14/600-net-core-add-RPS-balancer.patch +++ /dev/null @@ -1,93 +0,0 @@ -From 3e969c9695b45e1a052d43b367096ec99f2f0aac Mon Sep 17 00:00:00 2001 -From: John Crispin -Date: Thu, 10 Aug 2017 15:58:29 +0200 -Subject: [PATCH] net: core: add RPS balancer - -This patch adds a hash bucket based rps hash balancer. - -Signed-off-by: John Crispin ---- - net/core/dev.c | 57 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++- - 1 file changed, 56 insertions(+), 1 deletion(-) - ---- a/net/core/dev.c -+++ b/net/core/dev.c -@@ -3626,6 +3626,58 @@ set_rps_cpu(struct net_device *dev, stru - return rflow; - } - -+#define RPS_TBL_SIZE_SHIFT 10 -+#define RPS_TBL_SIZE (1 << RPS_TBL_SIZE_SHIFT) -+struct rps_table { -+ int core; -+ struct timer_list expire; -+}; -+static struct rps_table rps_table[RPS_TBL_SIZE]; -+static int rps_table_last_core; -+ -+static void rps_table_expire(unsigned long data) -+{ -+ struct rps_table *entry = (struct rps_table *) data; -+ -+ entry->core = -1; -+} -+ -+static int rps_table_core(struct rps_map *map) -+{ -+ int i; -+ -+ for (i = 0; i < map->len; i++) { -+ int cpu = map->cpus[(rps_table_last_core + i + 1) % map->len]; -+ if (cpu_online(cpu)) { -+ rps_table_last_core = cpu; -+ return cpu; -+ } -+ } -+ return map->cpus[0]; -+} -+ -+static int rps_table_lookup(struct rps_map *map, u32 hash) -+{ -+ int bucket = hash & 0x3ff; -+ -+ if (rps_table[bucket].core < 0) -+ rps_table[bucket].core = rps_table_core(map); -+ mod_timer(&rps_table[bucket].expire, jiffies + HZ); -+ -+ return rps_table[bucket].core; -+} -+ -+static void rps_table_init(void) -+{ -+ int i; -+ -+ for (i = 0; i < RPS_TBL_SIZE; i++) { -+ rps_table[i].core = -1; -+ setup_timer(&rps_table[i].expire, rps_table_expire, -+ (unsigned long) &rps_table[i]); -+ } -+} -+ - /* - * get_rps_cpu is called from netif_receive_skb and returns the target - * CPU from the RPS map of the receiving queue for a given skb. -@@ -3715,7 +3767,7 @@ static int get_rps_cpu(struct net_device - try_rps: - - if (map) { -- tcpu = map->cpus[reciprocal_scale(hash, map->len)]; -+ tcpu = rps_table_lookup(map, hash); - if (cpu_online(tcpu)) { - cpu = tcpu; - goto done; -@@ -8800,6 +8852,10 @@ static int __init net_dev_init(void) - sd->backlog.weight = weight_p; - } - -+#ifdef CONFIG_RPS -+ rps_table_init(); -+#endif -+ - dev_boot_phase = 0; - - /* The loopback device is special if any other network devices diff --git a/target/linux/generic/pending-4.9/220-optimize_inlining.patch b/target/linux/generic/pending-4.9/220-optimize_inlining.patch new file mode 100644 index 000000000..75c04ea15 --- /dev/null +++ b/target/linux/generic/pending-4.9/220-optimize_inlining.patch @@ -0,0 +1,70 @@ +--- a/arch/x86/Kconfig.debug ++++ b/arch/x86/Kconfig.debug +@@ -287,20 +287,6 @@ config CPA_DEBUG + ---help--- + Do change_page_attr() self-tests every 30 seconds. + +-config OPTIMIZE_INLINING +- bool "Allow gcc to uninline functions marked 'inline'" +- ---help--- +- This option determines if the kernel forces gcc to inline the functions +- developers have marked 'inline'. Doing so takes away freedom from gcc to +- do what it thinks is best, which is desirable for the gcc 3.x series of +- compilers. The gcc 4.x series have a rewritten inlining algorithm and +- enabling this option will generate a smaller kernel there. Hopefully +- this algorithm is so good that allowing gcc 4.x and above to make the +- decision will become the default in the future. Until then this option +- is there to test gcc for this. +- +- If unsure, say N. +- + config DEBUG_ENTRY + bool "Debug low-level entry code" + depends on DEBUG_KERNEL +--- a/lib/Kconfig.debug ++++ b/lib/Kconfig.debug +@@ -117,6 +117,20 @@ endmenu # "printk and dmesg options" + + menu "Compile-time checks and compiler options" + ++config OPTIMIZE_INLINING ++ bool "Allow gcc to uninline functions marked 'inline'" ++ ---help--- ++ This option determines if the kernel forces gcc to inline the functions ++ developers have marked 'inline'. Doing so takes away freedom from gcc to ++ do what it thinks is best, which is desirable for the gcc 3.x series of ++ compilers. The gcc 4.x series have a rewritten inlining algorithm and ++ enabling this option will generate a smaller kernel there. Hopefully ++ this algorithm is so good that allowing gcc 4.x and above to make the ++ decision will become the default in the future. Until then this option ++ is there to test gcc for this. ++ ++ If unsure, say N. ++ + config DEBUG_INFO + bool "Compile the kernel with debug info" + depends on DEBUG_KERNEL && !COMPILE_TEST +--- a/arch/x86/Kconfig ++++ b/arch/x86/Kconfig +@@ -273,9 +273,6 @@ config ZONE_DMA32 + config AUDIT_ARCH + def_bool y if X86_64 + +-config ARCH_SUPPORTS_OPTIMIZED_INLINING +- def_bool y +- + config ARCH_SUPPORTS_DEBUG_PAGEALLOC + def_bool y + +--- a/include/linux/compiler-gcc.h ++++ b/include/linux/compiler-gcc.h +@@ -89,8 +89,7 @@ + * of extern inline functions at link time. + * A lot of inline functions can cause havoc with function tracing. + */ +-#if !defined(CONFIG_ARCH_SUPPORTS_OPTIMIZED_INLINING) || \ +- !defined(CONFIG_OPTIMIZE_INLINING) || (__GNUC__ < 4) ++#if !defined(CONFIG_OPTIMIZE_INLINING) || (__GNUC__ < 4) + #define inline \ + inline __attribute__((always_inline, unused)) notrace __gnu_inline + #else