From patchwork Thu Nov 1 10:09:16 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konstantin Khlebnikov X-Patchwork-Id: 10663747 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 327EC13A4 for ; Thu, 1 Nov 2018 10:09:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 076B22B13B for ; Thu, 1 Nov 2018 10:09:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EC8402B13F; Thu, 1 Nov 2018 10:09:27 +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=-3.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6F7A32B13B for ; Thu, 1 Nov 2018 10:09:27 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6D15D6B026D; Thu, 1 Nov 2018 06:09:26 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 6590F6B026E; Thu, 1 Nov 2018 06:09:26 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4FD406B026F; Thu, 1 Nov 2018 06:09:26 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-lf1-f69.google.com (mail-lf1-f69.google.com [209.85.167.69]) by kanga.kvack.org (Postfix) with ESMTP id D54B86B026D for ; Thu, 1 Nov 2018 06:09:25 -0400 (EDT) Received: by mail-lf1-f69.google.com with SMTP id j131so234565lfg.14 for ; Thu, 01 Nov 2018 03:09:25 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:dkim-signature:dkim-signature:subject:from:to :date:message-id:in-reply-to:references:user-agent:mime-version :content-transfer-encoding; bh=5XyzUiMc6T9KjaZost3Qv29MAeVGLlXihBR3zRuGc4E=; b=eQzIzryrzbiXoi/dt9TDDeXIQZBpyi2v/OvuS0FHG4U193zHzTvGHjJzlKQliUJto+ 8e7lBIIXts2s6J1Sl0JVIUygMJjFxnPnGHH1DpVembaTSkjf0vHrw888kH5n814b6sre 7kT6VEvap/T/o2Z5nL4l6mACvaT67/6y0TdbyukDlJnNG/PurxhuV1I4J0vu3O9WsnlD oI+d5MLQ6TbiuorYJIusUFoRjoh5tCozr0mI6RVFPgsKpVmaBZyDMliQGIa8/nGymjMv Ui6SMkUsNGWJLF0GzDSHBnPRTkiNgSK/PbofQoFQOY6Zl+XOQc8KRCkeWQGDJNhj8Zgl Aeag== X-Gm-Message-State: AGRZ1gJ0mVWlA92UcWsVG7ZFQXtoG+rWkm4PpRJoTSZKqHcKvWpR5HHg 9m/c95Gqale2B5uVT9tLi3aNND/fsoCTfnr/MHTGkirvAyzgTyPbQmzVypZ+kLvjVg/hYbSh0B2 DnLFJZYVNhpJwnIuSr0vYSKfAmSw4cBUMAhY1ceYokpL5CEhxcC4cb3gbxiWNPc1CzA== X-Received: by 2002:ac2:4255:: with SMTP id m21-v6mr4064089lfl.6.1541066964861; Thu, 01 Nov 2018 03:09:24 -0700 (PDT) X-Google-Smtp-Source: AJdET5ccdnUFqOzzmX0TXj1zdD0V3JDT0+gZaQVL7y88DDRRCfB47n56j+5baJtY+P5naW1F7JdV X-Received: by 2002:ac2:4255:: with SMTP id m21-v6mr4064056lfl.6.1541066963920; Thu, 01 Nov 2018 03:09:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1541066963; cv=none; d=google.com; s=arc-20160816; b=q0Ufkeo/GI5ty4MEzg5NZ8R/nzMUQP9yZBQdYcuCJFELNT1B3evdugbuYVZSMEBfIE 1JViL6yz+G4p62DqOkC4vE4eDbpC7MA41u28e10XB9Mj6GKTe6brPpNEQaxAsWEKrrk4 2zBeXLkDRyvbU+xGpbvdEnmU/tREqBXKww67Do3GwDQwtAqmFTTRvz4X8QLjeP6vM5sK Ng2tewPVzlmwocWspLEmEf62RrRKpaaHni/XexkQu4I0GgYOlAlnoSE535FMH7KcVGX9 OpT2UbRbXkDZmGE1piXG9z+n4FjzpXs2QZC/gGd8KoNZ6HK/Kb0cVBrTmNQgYmxFy4RT AkXA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:user-agent:references :in-reply-to:message-id:date:to:from:subject:dkim-signature :dkim-signature; bh=5XyzUiMc6T9KjaZost3Qv29MAeVGLlXihBR3zRuGc4E=; b=GFgZVZ3wlORr/C3M0UqtoLBrU1KuSGCOu+chrnl4CEh7pVBylE61QOngVZteYnAKWq FfKGZb5kWcVpewcq0hhq4+ISZWTwSC1P+0M0th1Epwpdg4scg2vxp+ybxmdWw0g1hgcG E7fuyoXNHK9ypgqz55jnJ7kr0n6FYNdgi6nQMaW6PK6i7R+iAT9I77R1702qyNkNEpk7 lLm/+WGo7/LYOKUxqh9y9fvoNFythAWAOfsTKXBD+gk10gTHPrHGFCxRPOKvwEByx9mp ROD0cZVO+TkmxkSBoaWin++3q5q8mBmGueGo3WjF0c1BcipSP1LuR3nzinyHxnEBkjXN toJg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@yandex-team.ru header.s=default header.b=Q2Yv6WhC; dkim=pass header.i=@yandex-team.ru header.s=default header.b=O7mA1xUJ; spf=pass (google.com: domain of khlebnikov@yandex-team.ru designates 37.9.109.47 as permitted sender) smtp.mailfrom=khlebnikov@yandex-team.ru; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=yandex-team.ru Received: from forwardcorp1o.cmail.yandex.net (forwardcorp1o.cmail.yandex.net. [37.9.109.47]) by mx.google.com with ESMTPS id w72si17488088lfd.64.2018.11.01.03.09.23 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 01 Nov 2018 03:09:23 -0700 (PDT) Received-SPF: pass (google.com: domain of khlebnikov@yandex-team.ru designates 37.9.109.47 as permitted sender) client-ip=37.9.109.47; Authentication-Results: mx.google.com; dkim=pass header.i=@yandex-team.ru header.s=default header.b=Q2Yv6WhC; dkim=pass header.i=@yandex-team.ru header.s=default header.b=O7mA1xUJ; spf=pass (google.com: domain of khlebnikov@yandex-team.ru designates 37.9.109.47 as permitted sender) smtp.mailfrom=khlebnikov@yandex-team.ru; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=yandex-team.ru Received: from mxbackcorp1j.mail.yandex.net (mxbackcorp1j.mail.yandex.net [IPv6:2a02:6b8:0:1619::162]) by forwardcorp1o.cmail.yandex.net (Yandex) with ESMTP id 3AF6220F0C; Thu, 1 Nov 2018 13:09:23 +0300 (MSK) Received: from smtpcorp1p.mail.yandex.net (smtpcorp1p.mail.yandex.net [2a02:6b8:0:1472:2741:0:8b6:10]) by mxbackcorp1j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id k7wV3VC2aP-9MZqCVTh; Thu, 01 Nov 2018 13:09:23 +0300 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex-team.ru; s=default; t=1541066963; bh=5XyzUiMc6T9KjaZost3Qv29MAeVGLlXihBR3zRuGc4E=; h=Subject:From:To:Date:Message-ID:In-Reply-To:References; b=Q2Yv6WhCmQ+F34s9zZGoMDNi2IDjGNzQZ1M66CH15Wl1kGTxguVoO5KXjKbzBVZDB 4wLbIYRekvmAUiv88vPDF0/2cwZMgVfcBRgxc/3jntjHTeaYOZgVCM6PnlajKQj7oE W7XCJonCoVdMVOarIKcutasw5M+bOvRUSpuFQf5w= Received: from dynamic-red.dhcp.yndx.net (dynamic-red.dhcp.yndx.net [2a02:6b8:0:40c:2501:1cc0:44e4:e39a]) by smtpcorp1p.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id nCvYi4GcmH-9MJ8BSDV; Thu, 01 Nov 2018 13:09:22 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client certificate not present) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex-team.ru; s=default; t=1541066962; bh=5XyzUiMc6T9KjaZost3Qv29MAeVGLlXihBR3zRuGc4E=; h=Subject:From:To:Date:Message-ID:In-Reply-To:References; b=O7mA1xUJuXTZqsufyCHdYxUxBmtGItp3qxsibGuQJmIBayfBr4ARHMnVTV21O50nM VW5s6HTnr7zT77K478PZc5Fhi/rz3kxo/auhlgKVtFQeiKnhH99oadJeAK53iKJQL/ RkCcpTBc0rt2Sin45D6hjv63Yx5XJifk8EeJ4TqU= Authentication-Results: smtpcorp1p.mail.yandex.net; dkim=pass header.i=@yandex-team.ru Subject: [PATCH 2] mm/kvmalloc: do not call kmalloc for size > KMALLOC_MAX_SIZE From: Konstantin Khlebnikov To: linux-mm@kvack.org, Andrew Morton , Michal Hocko , linux-kernel@vger.kernel.org Date: Thu, 01 Nov 2018 13:09:16 +0300 Message-ID: <154106695670.898059.5301435081426064314.stgit@buzz> In-Reply-To: <154106356066.887821.4649178319705436373.stgit@buzz> References: <154106356066.887821.4649178319705436373.stgit@buzz> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP Allocations over KMALLOC_MAX_SIZE could be served only by vmalloc. Signed-off-by: Konstantin Khlebnikov Acked-by: Michal Hocko Acked-by: Vlastimil Babka --- mm/util.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/mm/util.c b/mm/util.c index 8bf08b5b5760..f5f04fa22814 100644 --- a/mm/util.c +++ b/mm/util.c @@ -392,6 +392,9 @@ void *kvmalloc_node(size_t size, gfp_t flags, int node) gfp_t kmalloc_flags = flags; void *ret; + if (size > KMALLOC_MAX_SIZE) + goto fallback; + /* * vmalloc uses GFP_KERNEL for some internal allocations (e.g page tables) * so the given set of flags has to be compatible. @@ -422,6 +425,7 @@ void *kvmalloc_node(size_t size, gfp_t flags, int node) if (ret || size <= PAGE_SIZE) return ret; +fallback: return __vmalloc_node_flags_caller(size, node, flags, __builtin_return_address(0)); }