From patchwork Thu Oct 28 21:36:04 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Morton X-Patchwork-Id: 12591221 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C9882C433EF for ; Thu, 28 Oct 2021 21:36:08 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 6B890610CA for ; Thu, 28 Oct 2021 21:36:08 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 6B890610CA Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linux-foundation.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id B68C16B0072; Thu, 28 Oct 2021 17:36:07 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B183E6B0073; Thu, 28 Oct 2021 17:36:07 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A2ECA940007; Thu, 28 Oct 2021 17:36:07 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0219.hostedemail.com [216.40.44.219]) by kanga.kvack.org (Postfix) with ESMTP id 7DA716B0072 for ; Thu, 28 Oct 2021 17:36:07 -0400 (EDT) Received: from smtpin15.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 05BC931ED0 for ; Thu, 28 Oct 2021 21:36:07 +0000 (UTC) X-FDA: 78747154374.15.709AE75 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf27.hostedemail.com (Postfix) with ESMTP id 92126700024C for ; Thu, 28 Oct 2021 21:36:06 +0000 (UTC) Received: by mail.kernel.org (Postfix) with ESMTPSA id 3670160FF2; Thu, 28 Oct 2021 21:36:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1635456965; bh=jxWwOHabNnscVRy+r9kwuAbCzrielvvANPWmTQgJG2M=; h=Date:From:To:Subject:In-Reply-To:From; b=Wcg1c+P1+TuytgC/ZMbnWsQRbXL6nwTrL1/EZnjBmoXN1YRT1PCfDLu3GnJIii2W/ xqPjXLNo9vhAaYm4usQcJzI6noEWQDo3mcPIrdciN4Vsdetf3g/leZwnpyVSE7EYcr fKubFsnjk9W0y32YZhspBIQNjvjzeBrZFxiovHq0= Date: Thu, 28 Oct 2021 14:36:04 -0700 From: Andrew Morton To: akpm@linux-foundation.org, david@redhat.com, guro@fb.com, hannes@cmpxchg.org, linux-mm@kvack.org, mhocko@suse.com, mm-commits@vger.kernel.org, shakeelb@google.com, torvalds@linux-foundation.org, vvs@virtuozzo.com Subject: [patch 01/11] memcg: page_alloc: skip bulk allocator for __GFP_ACCOUNT Message-ID: <20211028213604.wxCte4LAl%akpm@linux-foundation.org> In-Reply-To: <20211028143506.5f5d5e2cd1f768a1da864844@linux-foundation.org> User-Agent: s-nail v14.8.16 X-Stat-Signature: 4rnup8c4xp73ip6yfquxg3tpu6d7b5pk Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=korg header.b=Wcg1c+P1; spf=pass (imf27.hostedemail.com: domain of akpm@linux-foundation.org designates 198.145.29.99 as permitted sender) smtp.mailfrom=akpm@linux-foundation.org; dmarc=none X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 92126700024C X-HE-Tag: 1635456966-995319 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: From: Shakeel Butt Subject: memcg: page_alloc: skip bulk allocator for __GFP_ACCOUNT commit 5c1f4e690eec ("mm/vmalloc: switch to bulk allocator in __vmalloc_area_node()") switched to bulk page allocator for order 0 allocation backing vmalloc. However bulk page allocator does not support __GFP_ACCOUNT allocations and there are several users of kvmalloc(__GFP_ACCOUNT). For now make __GFP_ACCOUNT allocations bypass bulk page allocator. In future if there is workload that can be significantly improved with the bulk page allocator with __GFP_ACCCOUNT support, we can revisit the decision. Link: https://lkml.kernel.org/r/20211014151607.2171970-1-shakeelb@google.com Fixes: 5c1f4e690eec ("mm/vmalloc: switch to bulk allocator in __vmalloc_area_node()") Signed-off-by: Shakeel Butt Reported-by: Vasily Averin Tested-by: Vasily Averin Acked-by: David Hildenbrand Acked-by: Michal Hocko Acked-by: Roman Gushchin Acked-by: Johannes Weiner Signed-off-by: Andrew Morton --- mm/page_alloc.c | 4 ++++ 1 file changed, 4 insertions(+) --- a/mm/page_alloc.c~memcg-page_alloc-skip-bulk-allocator-for-__gfp_account +++ a/mm/page_alloc.c @@ -5223,6 +5223,10 @@ unsigned long __alloc_pages_bulk(gfp_t g if (unlikely(page_array && nr_pages - nr_populated == 0)) goto out; + /* Bulk allocator does not support memcg accounting. */ + if (memcg_kmem_enabled() && (gfp & __GFP_ACCOUNT)) + goto failed; + /* Use the single page allocator for one page. */ if (nr_pages - nr_populated == 1) goto failed;