From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f50.google.com (mail-wm1-f50.google.com [209.85.128.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9DCA1288510 for ; Fri, 5 Dec 2025 21:49:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.50 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764971385; cv=none; b=sRhp/NnH0Q1eze1XnACkkX3UY7o0pdXZyGAqfUySPFU7xOySMVOrrh5VkbiyAFHKJzngBIF+NOW39xvqNKh6VI/PLYWvOtljCvRUaN6pTHeORjQspjo5pXU90dijSvNHtff4i03Lj39iTTnc46qmRVLwqkXAdkqSOp7RiCPlUnA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764971385; c=relaxed/simple; bh=5BTiTQ6yjwy91KNuvYVgYpcoNrrw1vzGPjYrAICbQWk=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=aMO7/wWyil17jmzyk7erQxUNxXfw5O3cjIKtGAqa7zATrCUcn1WugCDp2rmUZY6VPGyBPGO1rmgUcqU0LlZdBosW1oQV8nQ9SgvODxueh8TQRcAtzXs5oBiSxeHkkbvdoDJsT3pU/mkyrnyP+MiESiL+oxAUVeCcaPjXgPszMks= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=RUC9V6dn; arc=none smtp.client-ip=209.85.128.50 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="RUC9V6dn" Received: by mail-wm1-f50.google.com with SMTP id 5b1f17b1804b1-477b5e0323bso20872185e9.0 for ; Fri, 05 Dec 2025 13:49:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1764971382; x=1765576182; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=Jg2IlBOaipbx+REzjwQxo7FYRDY4dPE4UvMiKLmPXw4=; b=RUC9V6dn+zZnogAx5wPdIixRBP9VVFOJ9MNzs0djlexmJYiTmu8CUvl8tZzpQmn3/n ajwetU4kt0XLjyodfpM51km7s1JvS4hQjGdE4gHysG7MFHB/tznjEyLg+0gSHIx89i+8 QgaJnU6YdkDxp1+yKNMhouZAe8zmmBXRV9IlhtYJCLcySo7SIQAvsygjdahXxX3UeNaG dloBNbgIHXQBkouXA3+GGApto54HZTXbniZ+NronYSgP4QZYOef9tmcNLQ791vhEkSFx u/qgrEAwlhNnSe1LshTxydXcSau4aBwg40SxYrUpk4dYYKuBlciRCj9xqcQUnDz6Y0sW RcWQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1764971382; x=1765576182; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=Jg2IlBOaipbx+REzjwQxo7FYRDY4dPE4UvMiKLmPXw4=; b=ZlpOwhdKCjqlPhc2Of6a6WTTPTGVGc0AdRE2SQJagnqW5ePurNUYuzenkF7BG0aU/t iyFpXGMmoz9iI4ssTupJ81EPuV8e3dE33eI9dyTXWC3gHR+XLbIIgtEoEuMXoiBKBLSv PWOc9oBLL5PhJxRHDYBI3kxQRML+KasWEygllxisLPkLC214deRKi1/RwgmqX9GNetN2 NeyE8EmXDGROFtETUoKlCzoITZchNa+PKcOxkKisGP699cI0sDowWkfxbpA6vvPmtcVD VbPhGzA/pVKu7qU8MQbVALp7KqDLrBhznqW0vfcoQhNw3LqO+C20FhZH6OCyzNNoLPFy gNnQ== X-Forwarded-Encrypted: i=1; AJvYcCVj5IrRFlXDmtTFQ+oYaUJfUkZMWdYYLXfkHPfuo4yVEyAoS0iGy2Gvz6x8IpsRDt/L2dQ2CtCEvzDCYzs=@vger.kernel.org X-Gm-Message-State: AOJu0YyNV8YZ5wQNWZpf//+9ItOPr7QfQ5cka+R37qliZXAKnGOfMd+L vatMiKbYWOtkSWSEsgmoODYRByomgGUA23uc7Q+uYEgkg5UHdUIMGzDv X-Gm-Gg: ASbGncsa3nI1+PDvqoEIZMajQBrs9OI6RpAT0jDjSjV+XOpEsWzs6yYPKE8BV0HpZKP 8+2C55KfgxSs+R9m5RgjWm0xrw89uyDfE1oA2MIAQiWPdscSiJte68XwthzYIMUUDAnnBzp4jWq Bhk8kTS4Tsx8svferHXNbE97Z2IPWo6j7wNKQEo+GF/ImAlGPKtq2GEC1pJ6OLK2BqILJajsOfr 6SpO2bRxWuP7ZNWK47aqWer+17J0e0XjaUR/V6KvJY5CGjx3ZUGXPwurokx4XZ7RwXPuYRFO1lN ADaBwdfU9FSifnqF01FKyQ/K738BRTL9a/O8EkXOGp1B0pqIaNTANq12n/dihqJ8mgkXlcvFL9s WxqXpNe3eCYJPJ9GWkR7AlMiQtXo0HFKLpBtbfwlr03QnESExkWqSst6toCUsa9vxbRrl+c7B+f ZlxY9oxC1wt7oXhxcWE6LsQBnfCUVUptRZDsQQJzJo+8QM5F6VV8F3 X-Google-Smtp-Source: AGHT+IEXCZuoM84HhNS1eLJlWXekMpaS1VlrpCR/D7Zc3iaqO3aJpq46P8vsFICE49WYqTzV9M9fsg== X-Received: by 2002:a05:6000:4308:b0:42b:3ed2:c086 with SMTP id ffacd0b85a97d-42f89eafab4mr836299f8f.4.1764971381797; Fri, 05 Dec 2025 13:49:41 -0800 (PST) Received: from pumpkin (82-69-66-36.dsl.in-addr.zen.co.uk. [82.69.66.36]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-42f7cc090bdsm11152502f8f.19.2025.12.05.13.49.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Dec 2025 13:49:41 -0800 (PST) Date: Fri, 5 Dec 2025 21:49:40 +0000 From: David Laight To: Lorenzo Stoakes Cc: Andrew Morton , David Hildenbrand , "Liam R . Howlett" , Vlastimil Babka , Mike Rapoport , Suren Baghdasaryan , Michal Hocko , oliver.sang@intel.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] mm: avoid use of BIT() macro for initialising VMA flags Message-ID: <20251205214940.211a2de2@pumpkin> In-Reply-To: <4eea9138-3853-457d-9113-e3caa7f00437@lucifer.local> References: <20251205175037.1287366-1-lorenzo.stoakes@oracle.com> <20251205184342.2cfcc73e@pumpkin> <4eea9138-3853-457d-9113-e3caa7f00437@lucifer.local> X-Mailer: Claws Mail 4.1.1 (GTK 3.24.38; arm-unknown-linux-gnueabihf) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit On Fri, 5 Dec 2025 19:18:56 +0000 Lorenzo Stoakes wrote: > On Fri, Dec 05, 2025 at 06:43:42PM +0000, David Laight wrote: > > On Fri, 5 Dec 2025 17:50:37 +0000 > > Lorenzo Stoakes wrote: > > > > > Commit 2b6a3f061f11 ("mm: declare VMA flags by bit") significantly changed > > > how VMA flags are declared, utilising an enum of VMA bit values and > > > ifdef-fery VM_xxx flag declarations via macro. > > > > > > As part of this change, it uses INIT_VM_FLAG() to define VM_xxx flags from > > > the newly introduced VMA bit numbers. > > > > > > However, use of this macro results in apparently unfortunate macro > > > expansion and resulted in a performance degradation.This appears to be due > > > to the (__force int), which is required for the sparse typechecking to > > > work. > > > > Does sparse complain if you just add 0? As in: > > #define INIT_VM_FLAG(name) BIT(VMA_ ## name ## _BIT + 0u) > > > > That should change the type without affecting what BIT() expands to. > > Thanks, checked that and unfortunately that doesn't satisfy sparse :) Oh - it is that __bitwise that causes grief. > I don't think it's too crazy to use 1UL << here, just very frustrating (TM) > that this is an issue. Did you try getting DECLARE_VMA_BIT to define both the bit number and the bit flag and put them both into the anonymous enum? Or are there other reasons for not doing that? > > Add rant about the compiler thinking anon enums are doing anything other than defining constants. David > > Cheers, Lorenzo