From mboxrd@z Thu Jan 1 00:00:00 1970 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1B6CAC4345F for ; Fri, 12 Apr 2024 14:14:49 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7A7176B008C; Fri, 12 Apr 2024 10:14:49 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 7572F6B0096; Fri, 12 Apr 2024 10:14:49 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5F80B6B009A; Fri, 12 Apr 2024 10:14:49 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 3AA1A6B008C for ; Fri, 12 Apr 2024 10:14:49 -0400 (EDT) Received: from smtpin29.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id BFADCA0E9A for ; Fri, 12 Apr 2024 14:14:48 +0000 (UTC) X-FDA: 82001075856.29.E025C11 Received: from mail-pl1-f169.google.com (mail-pl1-f169.google.com [209.85.214.169]) by imf14.hostedemail.com (Postfix) with ESMTP id 6CAD0100017 for ; Fri, 12 Apr 2024 14:14:46 +0000 (UTC) Authentication-Results: imf14.hostedemail.com; dkim=pass header.d=shopee.com header.s=shopee.com header.b=f467Eyb6; dmarc=pass (policy=reject) header.from=shopee.com; spf=pass (imf14.hostedemail.com: domain of haifeng.xu@shopee.com designates 209.85.214.169 as permitted sender) smtp.mailfrom=haifeng.xu@shopee.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1712931286; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=6BN1Urc2kyfk8pciJnttFzTHhad5ozLJgp9UClqWWGc=; b=vrtTXbS74G8Q2WffacTyWMl+CQKE9tgPhdU/i6EribPM3pbmotgs5GztlVWdOKkhTUX7C5 cyZeiEE+6Lxn2CtiAJ/C/pBLumc3JE/rUA0i7V7c++3RWqPixK8hGH5L6Y+gieJMLqiKn2 91VBvXmtZYm7FEr/0XVULh2VJBuq8zI= ARC-Authentication-Results: i=1; imf14.hostedemail.com; dkim=pass header.d=shopee.com header.s=shopee.com header.b=f467Eyb6; dmarc=pass (policy=reject) header.from=shopee.com; spf=pass (imf14.hostedemail.com: domain of haifeng.xu@shopee.com designates 209.85.214.169 as permitted sender) smtp.mailfrom=haifeng.xu@shopee.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1712931286; a=rsa-sha256; cv=none; b=mO9nhkOnJVSlhbdQHLy/VFWAdCAKsmNwgDvFw5pNcQcaz+AaT69lEFnZwV3jyhvwDT2GvS u8XdFxYI6m1qK3N1jdCIhHInHX4L6LMDxSmhYkO/9rc1msPeKnXU/Td4DoGp9IBNpAxmm1 ss9p/90zOxAGMKJ1aIDrNa/gKd5XvrA= Received: by mail-pl1-f169.google.com with SMTP id d9443c01a7336-1e3ca4fe4cfso6556415ad.2 for ; Fri, 12 Apr 2024 07:14:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=shopee.com; s=shopee.com; t=1712931285; x=1713536085; darn=kvack.org; h=content-transfer-encoding:in-reply-to:from:references:cc:to:subject :user-agent:mime-version:date:message-id:from:to:cc:subject:date :message-id:reply-to; bh=6BN1Urc2kyfk8pciJnttFzTHhad5ozLJgp9UClqWWGc=; b=f467Eyb6xsAww9kCDhYAtbUsT9+xdwr5niYL0JSRonqluwDPeiRyXb4mtctfy3BZ8M CW7/TNVy4aEtHY/nQ7zBePWkyoXtxlhFGLsBh5clf1QfjwWJVOsBRW5xDwBRUQGANjri WTU9bRhHp5qiUlPihmk5fJ/OdkNt3mgyArpaoOQNxFvifgJW01/9Fn0bXTo+wAJ+psvD rKyBly1Hc6gW4A6Zvpj8n3T1jvzV1wY7uCa2ga0axgLaWp69cVCpypaNxkWQS9ht2RVg duuLMX6QOstsRlVHR0Fl2gRYWW4AkcaliczPEx+63AamW5og0w8XsS+pCtvVgx2WsO+J Eg+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712931285; x=1713536085; h=content-transfer-encoding:in-reply-to:from:references:cc:to:subject :user-agent:mime-version:date:message-id:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=6BN1Urc2kyfk8pciJnttFzTHhad5ozLJgp9UClqWWGc=; b=N4gFJcDD5pxi/NoqLIAmlz1eR3Qe0d7OhnruB2dnXaTmdTGd7EauVpfVqKVUhbHj+F WSbEGiWZa4E7oKYgIs+5Qc7g64T/ohUACWweQBXTdzZG9dmvOgiqjXVDnDjuNfU1UrFv wWvcYrtMulHVozoTCK9Wykc2a76ab0t1V03v9Z1nsy0/Gvd/f9taHIGQu9C/KP3tFk3w 162Nx3ThZ7U4XoTgjRCivKmEDSWyX492gRNFSBGyEQpaR7v8wBj1rs9Frt4kY/hFt8a0 pZcxqGUAjWdhxDRWFjjESeA+nS8IQTwYc1+MnNLvv5Aui7u/OBAmhwbGVYNig+VmE+cj knXQ== X-Forwarded-Encrypted: i=1; AJvYcCWi6HjaUjTReQPvTOCUwatkV89rcIlUmSHbZorQ0TfoBr0qG8S5wryLDTzD54YOO6g/wl0AhYy/DtjEKihiVPHsoeE= X-Gm-Message-State: AOJu0Yz65vLpPWmKJbnxMj4uGBnkoFrxfXpYP3D5g2VtkP/1yzbJGkJ5 hsg8ndlJmZwPrQdjhJZoQKVP8LCtmVCSb7WTIgIoGfcliUc+StMv7FBq/+G2KIAuwaM9kd+gEJH bxe8qIw== X-Google-Smtp-Source: AGHT+IEhGtHgIeYGGSLbc6oBN7XL53bKvS2DDTDcLXzi+9IoqV4JySk3icBGad6yh6P05adENL02Wg== X-Received: by 2002:a17:903:184:b0:1e3:e0a2:ccc3 with SMTP id z4-20020a170903018400b001e3e0a2ccc3mr3364272plg.30.1712931285262; Fri, 12 Apr 2024 07:14:45 -0700 (PDT) Received: from [10.12.171.228] ([103.114.192.135]) by smtp.gmail.com with ESMTPSA id d7-20020a170902654700b001e20afa1038sm3098061pln.8.2024.04.12.07.14.41 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 12 Apr 2024 07:14:44 -0700 (PDT) Message-ID: <2031ea8c-29a0-4514-b042-7c0eabb4f443@shopee.com> Date: Fri, 12 Apr 2024 22:14:39 +0800 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] slub: Clear __GFP_COMP flag when allocating 0 order page To: Matthew Wilcox , Vlastimil Babka Cc: "Christoph Lameter (Ampere)" , penberg@kernel.org, rientjes@google.com, iamjoonsoo.kim@lge.com, akpm@linux-foundation.org, roman.gushchin@linux.dev, 42.hyeyoo@gmail.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org References: <20240411091832.608280-1-haifeng.xu@shopee.com> <5482360c-0a0b-e5f5-b88e-4a6ec4d43f7d@linux.com> <5d3c4a5e-0c27-4058-adf1-91e9602e5ccb@suse.cz> From: Haifeng Xu In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 6CAD0100017 X-Rspam-User: X-Rspamd-Server: rspam02 X-Stat-Signature: 8uke5nqeasbuc99pdocqcjttgh86abi9 X-HE-Tag: 1712931286-44053 X-HE-Meta: U2FsdGVkX19+IoF+AI+VGYpm9Uj8LGVz9rLQx7u7ro2FglYjBkzfsLNEp2Oyp2331R3aJx34H1yqkM1NhIua3gaWU1Gv/2lAAWCEGdiEtwGCQdedFg140jq/M9cdbLYbOUGZO+5ayzu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uUfXB+AcfDrXS9PP8IWhIgt2TTkElSOT2cckrQrF/QLAyqRbWv2hm09VWuI6n/5amJAXTmiUQ2WFVoUsE1BNZyhFEHsli2cKXPcTQnK2QVzo+qwxG5Z5GNv5hDlVd1YqTkcD04GZATJAgIaAAvkIsNsdwxJVNi7CHrFBJ7AADnELEoB22gX4Qeq8gXfvg58lNjESSi/XMwK6H8ZwD2KU1dpmxnuhQaRivlguuDvz0c7fIyYyqjclB87Di2ag6M4Bbl0naiGz3qyfjFq32EhiDuY04cibdw417n67e22o4SAW9FeVzCE= 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: List-Subscribe: List-Unsubscribe: On 2024/4/12 20:17, Matthew Wilcox wrote: > On Fri, Apr 12, 2024 at 10:01:29AM +0200, Vlastimil Babka wrote: >> On 4/11/24 6:51 PM, Christoph Lameter (Ampere) wrote: >>> On Thu, 11 Apr 2024, Haifeng Xu wrote: >>> >>>> @@ -1875,6 +1875,13 @@ static inline struct slab *alloc_slab_page(gfp_t flags, int node, >>>> struct slab *slab; >>>> unsigned int order = oo_order(oo); >>>> >>>> + /* >>>> + * If fallback to the minimum order allocation and the order is 0, >>>> + * clear the __GFP_COMP flag. >>>> + */ >>>> + if (order == 0) >>>> + flags = flags & ~__GFP_COMP; >>> >>> >>> This would be better placed in allocate_slab() when the need for a >>> fallback to a lower order is detected after the first call to alloc_slab_page(). >> >> Yeah. Although I don't really see the harm of __GFP_COMP with order-0 in the >> first place, if the only issue is that the error output might be confusing. >> I'd also hope we should eventually get rid of those odd non-__GFP_COMP >> high-order allocations and then can remove the flag. > > The patch seems pointless to me. I wouldn't clear the flag. If > somebody finds it confusing, that's really just their expectations being > wrong. folio_alloc() sets __GFP_COMP on all allocations, whether or not > they're order 0. If we don't care about the warnings at all, then higher-order and lower-order allocations can set __GFP_COMP when creating a new slab, just like folio_alloc(). If so, there is no need to check the order in calculate_sizes() and we can set __GFP_COMP in kmem_cache by default. diff --git a/mm/slub.c b/mm/slub.c index e7bf1a1a31a8..49a3ebefab86 100644 --- a/mm/slub.c +++ b/mm/slub.c @@ -4461,9 +4461,7 @@ static int calculate_sizes(struct kmem_cache *s) if ((int)order < 0) return 0; - s->allocflags = 0; - if (order) - s->allocflags |= __GFP_COMP; + s->allocflags = __GFP_COMP; if (s->flags & SLAB_CACHE_DMA) s->allocflags |= GFP_DMA;