From patchwork Fri Jul 21 06:55:16 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Chia-Lin Kao (AceLan)" X-Patchwork-Id: 9856231 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 558EC60392 for ; Fri, 21 Jul 2017 06:55:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 31CA62876B for ; Fri, 21 Jul 2017 06:55:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2352828778; Fri, 21 Jul 2017 06:55:22 +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.3 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, 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 582242876B for ; Fri, 21 Jul 2017 06:55:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751016AbdGUGzU (ORCPT ); Fri, 21 Jul 2017 02:55:20 -0400 Received: from mail-pg0-f68.google.com ([74.125.83.68]:33600 "EHLO mail-pg0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750793AbdGUGzU (ORCPT ); Fri, 21 Jul 2017 02:55:20 -0400 Received: by mail-pg0-f68.google.com with SMTP id z1so4678323pgs.0 for ; Thu, 20 Jul 2017 23:55:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:subject:date:message-id; bh=6Xn38IrlXnkgu9KAQLRP2mRA0dvu+NY5zt0DVFw9oys=; b=mYUTsLWsuBjHEP0pblHw0nUYilyXvNcres/fBkN6fXoUtxrmHNglCOcvsXVCPuug/e 9ApZf2OpFCRvyoH4FAfaYc0XLBFY7FbK7l1jCnBCGd6qNOvsJOHOuFhSGZmRil9YxOmJ 64m/wIgpFUMnX4bUhFv4QEInVs+ZS2/mfMADb2KvGU9tSxWB5VQmAH3znmkZgd8MTya3 iwTLcmUfBvysXMiWipu4xzcbajOv+8yvcwysvFZtSO4HlmowqyvMPypufnzQr0wI8flK L/7I9bV7skxMrzz65jIIO/rGoM4jFoVw5M+NKoBlrMKna5QnL2drkoFYGDpqqk5wxTs+ f9Sg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:subject:date:message-id; bh=6Xn38IrlXnkgu9KAQLRP2mRA0dvu+NY5zt0DVFw9oys=; b=UI74zE7Th/isVdhGYg3ZX/8y8HBgemOHxFoBtfa9CY3E88S4Re5QSx+jZFemj3yJvI gFDCBpeZGxj7cYa4ddvhiDg7LM0Zule/euajIocMM2oUocewn4iczEQezS9eCEqORL8t wzv5uYY2gkB2PGoK+t/rDcXHhQ1Xwt8QTag8K1v6sTSPqaeDhTQd0xZt6NAfDe22ZB1L Uxbnxh1LypWL4tEPlYEjJdOfnCI/5pCFSffmJmK4iaUcwb1uOwG+/daaG9mowjT/WvVJ kWwY3DR+WILd8yysv+S4WzbUIDLIA9q8wxs5KGhUkqHJrG/rWAh95mLp+b9zetH/b4RZ p5Sw== X-Gm-Message-State: AIVw110NabR+Mrx+64hcMYdttV//o77lrLal8EPa4fDqLeXYHOwz+kZo BCNMqsP3b1LSnbFYxTY= X-Received: by 10.98.204.136 with SMTP id j8mr6396506pfk.275.1500620119424; Thu, 20 Jul 2017 23:55:19 -0700 (PDT) Received: from localhost ([175.41.48.77]) by smtp.gmail.com with ESMTPSA id f2sm6583851pgc.17.2017.07.20.23.55.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 20 Jul 2017 23:55:18 -0700 (PDT) From: AceLan Kao To: hauke@hauke-m.de, mcgrof@kernel.org, backports@vger.kernel.org Subject: [PATCH] backport: add some new kv[mz]alloc function Date: Fri, 21 Jul 2017 14:55:16 +0800 Message-Id: <1500620116-20476-1-git-send-email-acelan.kao@canonical.com> X-Mailer: git-send-email 2.7.4 Sender: backports-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: backports@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP add some new kv[mz]alloc functions which introduced after v4.12 by this commit commit a7c3e901a46ff54c016d040847eda598a9e3e653 Author: Michal Hocko Date: Mon May 8 15:57:09 2017 -0700 mm: introduce kv[mz]alloc helpers Signed-off-by: AceLan Kao --- backport/backport-include/linux/mm.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/backport/backport-include/linux/mm.h b/backport/backport-include/linux/mm.h index 3234b37..8125310 100644 --- a/backport/backport-include/linux/mm.h +++ b/backport/backport-include/linux/mm.h @@ -123,4 +123,20 @@ static inline bool page_is_pfmemalloc(struct page *page) } #endif /* < 4.2 */ +#if LINUX_VERSION_IS_LESS(4,12,0) +extern void *kvmalloc_node(size_t size, gfp_t flags, int node); +static inline void *kvmalloc(size_t size, gfp_t flags) +{ + return kvmalloc_node(size, flags, NUMA_NO_NODE); +} +static inline void *kvzalloc_node(size_t size, gfp_t flags, int node) +{ + return kvmalloc_node(size, flags | __GFP_ZERO, node); +} +static inline void *kvzalloc(size_t size, gfp_t flags) +{ + return kvmalloc(size, flags | __GFP_ZERO); +} +#endif /* < 4.12.0 */ + #endif /* __BACKPORT_MM_H */