From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=74.125.82.198 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1793819029; b=xo1ofyyC5xp5MgcD6I/ye10qMNAZ3lRO12kshvSjEU64NaU0740c6hFBNETnciUtJH/i P6k7UC6Fwr+tIp8m1F52QR/6IPYTaVe8n/9wTW8/JuJJYjSeikqmreUc1WvgmGjLSULpX tlm+O6dzh0/olBSeEHURT1D3axQtpQr2RVt7o6EJYUt6bmBdchmyEWP3eCtZLmdFTHjJ6 YVrZesUEtKHmhrZD+KoaGCjZcJx78zbtZlw7HafmDgV47pcXyibmo5/YuI7do4q4ezFWr 7hVMYZNHm4Nxs4CZ2ZXAerIhHw88f7sT1A+t2sXS7XmyEfJDVQ1PlHJwielKkolPLLQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1793819029; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Gm-Message-State:X-Received:Date:In-Reply-To:Mime-Version: References:X-Mailer:Message-ID:Subject:From:To:Cc:Content-Type; bh=DUcpgfrjS6s9SSnfNEZAg7l7UHGbgZn+gcmgz0ne79Y=; b=HEI+IY0XViNsy8IpNjax+yvtUrnz/wnUGstjGuazIukhZpBRNEm+FelaeXiMcAgCEOrh KZrSYdBGdr12GH5c3RUaXTpfC7Rvql/uOYL1ieYJfYWHKe1Jk7RlWOuCSn+yb7lABR6xz UzBUEkqqOMCIYRY1umPu8bzDjTX1GTvw5U+8DF1b/X7Z8gIGM0iJNr3zq5EtlkF2CipT6 kNwq4idBB1jPKdpKsYKsTn6LVzjswUmky/iOcSsesfWD2vbolyeuDUT6G55TRKveb+8Jy /WZFOeKoGcwVxpPXGg++DiXojLdK+e8FmgeA2q4uXcWEBl6dwcFs968AhV1TLxHLbMg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=google.com; spf=pass smtp.mailfrom=flex--abhishekbapat.bounces.google.com; dkim=pass header.d=google.com header.i=@google.com header.a=rsa-sha256 header.s=20260707 header.b=W3qSnieE; arc=none smtp.remote-ip=74.125.82.198 Received: from mail-dy1-f198.google.com (mail-dy1-f198.google.com [74.125.82.198]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A9008606A32D for ; Wed, 4 Nov 2026 19:03:48 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org A9008606A32D Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--abhishekbapat.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=google.com header.i=@google.com header.a=rsa-sha256 header.s=20260707 header.b=W3qSnieE Received: by mail-dy1-f198.google.com with SMTP id 5a478bee46e88-36a223755e4so3565643eec.0 for ; Wed, 04 Nov 2026 11:03:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20260707; t=1793819028; x=1794423828; darn=vger.kernel.org; h=content-type:cc:to:from:subject:message-id:references:mime-version :in-reply-to:date:from:to:cc:subject:date:message-id:reply-to :content-type; bh=DUcpgfrjS6s9SSnfNEZAg7l7UHGbgZn+gcmgz0ne79Y=; b=W3qSnieEv3jiJcclT8d/SE0uy8PNypTpF80UBiouOmsInqZ9IsEBjx+E2q2cxbxozM E+D2Q9yznKCT6R8XFeit0bZB7mgVUd7TqSn7BYumptuK+yTF5VbyKCFZ2raGc9CQ2PdL 5EGNw+JuGsg38DUPJ6dO2BpyTLdaybBys3KOdMg203gm1TWLF+lF2QoOE/NxYNAp+6N6 c6tXQaEm4rUtkuRGyi7ne6hMHHsGOFGDa+thGyUaUsdI1hkf8+pmm/D80lk6n9wylfiV CW37GOfaPSw4ID9yqzYt/Jtw8C89NorSON5M29/QRiKJaP4jIozUQn/CNzokqyX9q+5k JUrw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1793819028; x=1794423828; h=content-type:cc:to:from:subject:message-id:references:mime-version :in-reply-to:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=DUcpgfrjS6s9SSnfNEZAg7l7UHGbgZn+gcmgz0ne79Y=; b=08V1jCz3VO4kULI41U3IBVIgQLcXkAGKQZskCf5N5A+JZvmwyS963zgqlZUd2XsPDN gCJl1iQ1nRoDlwcq/pQqgr7ju1xLduan1IIUS3/Id5ZEhA+QxQgOZ7Rj5DZCH8lzYHCB 76ZSXmjqE11I3oawr6luluTfWxSdWUo7+HPFHhwh9QmuYIK57mJ7a+LDuhhIR1jxfhnB pIQWiQtLyvmCExKRmkAc3c01X0WK03NsercAn4Id9TK59BmapZAOhd4+3sM8g0mGsP1G OprdK0fBO4WOoCUnghEMd7bWnjo2xyyWT5jFc8pAbN/6Q91k2KbFEO+qMfx+bxktA2fG tzYw== X-Gm-Message-State: APuU4Z9RhpcQBK4rFhiLEHIBt4rVCYG09BE5Zi9jXK4eEy5fKeDsjapB K6GGzzlSeZIufUme9brkmd17r61QjxEQgRb5ira7S8gOh9cGfIoWCSvQZa3NyCjj4h969iWSLXd lk/xUxc4+33pkH4VeTHKVyqviOKO6Hdn2VA== X-Received: from dybgl9.prod.google.com ([2002:a05:7300:e009:b0:36a:c06:2852]) (user=abhishekbapat job=prod-delivery.src-stubby-dispatcher) by 2002:a05:7301:3d17:b0:36c:9af3:22f3 with SMTP id 5a478bee46e88-36c9af33136mr9263147eec.37.1793819025727; Wed, 04 Nov 2026 11:03:45 -0800 (PST) Date: Wed, 4 Nov 2026 19:03:38 +0000 In-Reply-To: X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Mime-Version: 1.0 References: X-Mailer: git-send-email 2.56.0.506.g506a7eabc5-goog Message-ID: <64ce5ba6eedf0950c22d1416b794e83afbab8ea8.1793818636.git.abhishekbapat@google.com> Subject: [PATCH v5 3/5] alloc_tag: Add a flags field to allocinfo_filter From: Abhishek Bapat To: Suren Baghdasaryan , Hao Ge , Andrew Morton Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-trace-kernel@vger.kernel.org, Abhishek Bapat Content-Type: text/plain; charset="UTF-8" struct allocinfo_filter uses a whole __u64 to hold the single boolean used by the accuracy filter. Adding another boolean criterion the same way would grow struct allocinfo_get_at, which changes the ALLOCINFO_IOC_GET_AT ioctl number and breaks the UAPI. Add a `flags` field that shares storage with `inaccurate` through an anonymous union, and use bit 0, ALLOCINFO_FILTER_FLAG_INACCURATE, for the accuracy criterion. New boolean criteria can take the remaining bits without changing the struct layout. Keeping `inaccurate` in the union means userspace built against the older API still compiles, and the values 0 and 1 keep their meaning. Previously any non-zero value selected inaccurate tags; now only bit 0 is checked, so a value such as 2 selects accurate tags instead. Signed-off-by: Abhishek Bapat --- include/uapi/linux/alloc_tag.h | 16 ++++++++++++++-- mm/alloc_tag.c | 2 +- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/include/uapi/linux/alloc_tag.h b/include/uapi/linux/alloc_tag.h index dafcba2f7e2c..2fc843bb06bc 100644 --- a/include/uapi/linux/alloc_tag.h +++ b/include/uapi/linux/alloc_tag.h @@ -68,13 +68,25 @@ enum { #define ALLOCINFO_FILTER_MASKS \ ((1 << (__ALLOCINFO_FILTER_LAST + 1)) - 1) +#define ALLOCINFO_FILTER_FLAG_INACCURATE (1ULL << 0) + struct allocinfo_filter { __u64 mask; /* bitmask of the filter fields used */ struct allocinfo_tag fields; __u64 min_size; __u64 max_size; - /* filter criteria only; see allocinfo_counter.accurate for actual accuracy */ - __u64 inaccurate; + /* + * Filter criteria only; see allocinfo_counter for the actual state. + * Set ALLOCINFO_FILTER_FLAG_* bits in flags for the criteria selected + * in mask. inaccurate is kept as an alias of flags so that userspace + * built against the older API still compiles. Note that only + * ALLOCINFO_FILTER_FLAG_INACCURATE is checked, so a non-zero value + * with bit 0 clear no longer selects inaccurate tags. + */ + union { + __u64 inaccurate; + __u64 flags; + }; }; struct allocinfo_get_at { diff --git a/mm/alloc_tag.c b/mm/alloc_tag.c index 9ff9dd04d692..504c1a85050d 100644 --- a/mm/alloc_tag.c +++ b/mm/alloc_tag.c @@ -306,7 +306,7 @@ static bool matches_filter(struct codetag *ct, struct allocinfo_filter *filter, if (filter->mask & ALLOCINFO_FILTER_MASK_INACCURATE) { inaccurate = alloc_tag_is_inaccurate(ct_to_alloc_tag(ct)); - if (inaccurate != !!(filter->inaccurate)) + if (inaccurate != !!(filter->flags & ALLOCINFO_FILTER_FLAG_INACCURATE)) return false; } -- 2.56.0.506.g506a7eabc5-goog