From patchwork Fri May 19 20:46:17 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arend van Spriel X-Patchwork-Id: 9738111 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id E2CEA601A1 for ; Fri, 19 May 2017 20:46:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EB31F2858E for ; Fri, 19 May 2017 20:46:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E0367285A3; Fri, 19 May 2017 20:46:36 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 40F1C2858E for ; Fri, 19 May 2017 20:46:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756901AbdESUqf (ORCPT ); Fri, 19 May 2017 16:46:35 -0400 Received: from lpdvrndsmtp01.broadcom.com ([192.19.229.170]:51163 "EHLO rnd-relay.smtp.broadcom.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754993AbdESUqf (ORCPT ); Fri, 19 May 2017 16:46:35 -0400 Received: from mail-irv-17.broadcom.com (mail-irv-17.lvn.broadcom.net [10.75.224.233]) by rnd-relay.smtp.broadcom.com (Postfix) with ESMTP id 4078630C93B; Fri, 19 May 2017 13:46:32 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.10.3 rnd-relay.smtp.broadcom.com 4078630C93B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=broadcom.com; s=dkimrelay; t=1495226792; bh=SklDtGBtlefWmFeCXCMETWtjTVKmWPpwQTLBMIV9v5M=; h=From:To:Cc:Subject:Date:From; b=PRJ9Y4eoP8YlYU4R19fU73SRAztOV/p54M2ok9+7k5LBq9DN6mVrhBLa/S7Q64q+J dDimwlaS1wvvMtguJshV3FmTPONXGDAwVWXyO9pe0+u7g9FlpCNrWd4/DiYBdBmCLk dF64G8StHNyp/16kEiV/1up5LQ82+9PouosoVr6Y= Received: from jenkins-cam-14.cam.broadcom.com (jenkins-cam-14.cam.broadcom.com [10.177.128.77]) by mail-irv-17.broadcom.com (Postfix) with ESMTP id 09F2D81F2B; Fri, 19 May 2017 13:46:32 -0700 (PDT) Received: by jenkins-cam-14.cam.broadcom.com (Postfix, from userid 25152) id B320EB8283C; Fri, 19 May 2017 21:46:24 +0100 (BST) From: Arend van Spriel To: Johannes Berg Cc: backports@vger.kernel.org, Arend van Spriel Subject: [PATCH] patches: add patch for compat/lib-rhashtable.c Date: Fri, 19 May 2017 21:46:17 +0100 Message-Id: <1495226777-11429-1-git-send-email-arend.vanspriel@broadcom.com> X-Mailer: git-send-email 1.9.1 Sender: backports-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: backports@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The file compat/lib-rhashtable.c is a copy from the backported kernel source lib/rhashtable.c. This patch reverts a recent change to that file, ie. commit 43ca5bc4f72e ("lib/rhashtable.c: simplify a strange allocation pattern"). It introduced the function gfpflags_allow_blocking() introduced in 4.4 kernel and kvmalloc() introduced in 4.12-rc1. Looking at those functions backporting them is complicated so instead add this patch that reverts the change for kernel prior to 4.12. Signed-off-by: Arend van Spriel --- patches/lib-rhashtable.patch | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 patches/lib-rhashtable.patch diff --git a/patches/lib-rhashtable.patch b/patches/lib-rhashtable.patch new file mode 100644 index 0000000..9c262b0 --- /dev/null +++ b/patches/lib-rhashtable.patch @@ -0,0 +1,32 @@ +--- a/compat/lib-rhashtable.c ++++ b/compat/lib-rhashtable.c +@@ -86,11 +86,26 @@ static int alloc_bucket_locks(struct rhashtable *ht, struct bucket_table *tbl, + size = min(size, 1U << tbl->nest); + + if (sizeof(spinlock_t) != 0) { ++#if LINUX_VERSION_IS_LESS(4,12,0) ++ tbl->locks = NULL; ++#ifdef CONFIG_NUMA ++ if (size * sizeof(spinlock_t) > PAGE_SIZE && ++ gfp == GFP_KERNEL) ++ tbl->locks = vmalloc(size * sizeof(spinlock_t)); ++#endif ++ if (gfp != GFP_KERNEL) ++ gfp |= __GFP_NOWARN | __GFP_NORETRY; ++ ++ if (!tbl->locks) ++ tbl->locks = kmalloc_array(size, sizeof(spinlock_t), ++ gfp); ++#else + if (gfpflags_allow_blocking(gfp)) + tbl->locks = kvmalloc(size * sizeof(spinlock_t), gfp); + else + tbl->locks = kmalloc_array(size, sizeof(spinlock_t), + gfp); ++#endif + if (!tbl->locks) + return -ENOMEM; + for (i = 0; i < size; i++) +-- +1.9.1 +