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 7E9A2C3DA6D for ; Tue, 20 May 2025 14:46:27 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 177DF6B009E; Tue, 20 May 2025 10:46:27 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 14F336B009F; Tue, 20 May 2025 10:46:27 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 066106B00A0; Tue, 20 May 2025 10:46:27 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id D0B166B009E for ; Tue, 20 May 2025 10:46:26 -0400 (EDT) Received: from smtpin07.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 4FE2B14056F for ; Tue, 20 May 2025 14:46:26 +0000 (UTC) X-FDA: 83463561972.07.ADC60DE Received: from mail-ej1-f44.google.com (mail-ej1-f44.google.com [209.85.218.44]) by imf18.hostedemail.com (Postfix) with ESMTP id 22E4D1C000B for ; Tue, 20 May 2025 14:46:23 +0000 (UTC) Authentication-Results: imf18.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=K+WsApnJ; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf18.hostedemail.com: domain of usamaarif642@gmail.com designates 209.85.218.44 as permitted sender) smtp.mailfrom=usamaarif642@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1747752384; a=rsa-sha256; cv=none; b=8gO11xOfwJDpG6X3yfGepII9cczlYlFYThDDm2ViW3MI0gNhLLqorzXi8npD7ycQZLHovC eD0gtIafO9GdgDpN3G/YjlCkZX0cz9Tv8BNM5hcPohI2X6zvMSkYTUJhKNkWXcjQi3Q4le SLkElKww1kEt5+PbuWFjYhnNSDA9wbQ= ARC-Authentication-Results: i=1; imf18.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=K+WsApnJ; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf18.hostedemail.com: domain of usamaarif642@gmail.com designates 209.85.218.44 as permitted sender) smtp.mailfrom=usamaarif642@gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1747752384; 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=6dWJrrqlojSOkRw/l4VR7WIaD+BGjU0xxd1XUG+aV9k=; b=Yo1u+DlOO00Mpv98OZI+KhJYyfmvUBjFB3C3tax5VM+2dEowC6XxBZLkf8LCgbqUmB0rZ0 DG+6tpzIe0TbuTn/I2P7Y/0WMLbOpPfLGafyTZ1PgTZ4nPc5GQLXYRUNXlAOwR3erASzuQ 3N12nQ8wcatdMvzQ6Ts4lkhn4QjP3/8= Received: by mail-ej1-f44.google.com with SMTP id a640c23a62f3a-acbb85ce788so1141329666b.3 for ; Tue, 20 May 2025 07:46:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1747752382; x=1748357182; darn=kvack.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=6dWJrrqlojSOkRw/l4VR7WIaD+BGjU0xxd1XUG+aV9k=; b=K+WsApnJbdDccFHtcNTpwtjAvtEf4KkkGWUAeJ+jiwsfcj2IRCOKyJvHquQYcJGagR e1wlzVLcnU7zwDHYSXrhs7NWW20ztomSuWsk1kmjhvBhL4REjX9N4AChdxFMNwDhTK7E X2t9Z5+Q5hfOcmTZT354pGA6qqd8xqJfnRlR+KKDqvllruwGf/3/fLnQYW/tl5V4Nke4 ZeMx7GRGSAO7oqKWFaVfif5ph1FahUGW7ricbSY5SOStPt82RgmrehsresuQAq1ak/PD 8qJu9YiadHqstW1s0DpZi/ftR0haqLNQLB7zBgss2pzGKLda2BMJny3wmmEVUx+BLHNV adWw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1747752382; x=1748357182; h=content-transfer-encoding:in-reply-to:from:content-language :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=6dWJrrqlojSOkRw/l4VR7WIaD+BGjU0xxd1XUG+aV9k=; b=rG15PAZj03O5+9+R7uZGAi6HT3FRAcjNn2qoFTjHElxDxKc6BPXX+6vHmVzZ+4Tqbs HAWDUBAh2ADZ9spUzAe+Htq2cl8xG1j7etj5yf+dtn8WwQ54axNTkRDx9MoQBIxJHKDb g1Y0DLNwQrBmCgq50vN8MZ3ooAMSljPLkK67oCZX0lO4OuLdmrkFQQ27JgJSRZFOOD1n aTOc9kLV7zqelzDrIVBlVqnWr3/Kel3vsrFxhQtwhotSn3m5IMIOVxeF0+E7k+uuFtwM PSiS5q2C9YSUaUrYpH/AjMNWXKZKkV6l1uL0VCSamwgFEzobRBUcvdXzTv1cIOR8WT6A JTsA== X-Forwarded-Encrypted: i=1; AJvYcCXfzAC4NRGhaTGl2/0/1cNDomriJ3f8uAthEPlUWdP4n5lFHIJTL/J6vwciYkQi+BqqIXUy8TrlIA==@kvack.org X-Gm-Message-State: AOJu0YxW1oWaYh6xFNdlBrncxDEJ6cbJZRyhJAUkosHpr5mcnoxhBQfo dvXDgZ+jHgTi/Db/97sPCg6eq+jT8cLRddgOAgjVfe5a7Pq68OvA+upx X-Gm-Gg: ASbGncsgRToGgTKFReso3NRnOlM6zZuWbAUWySWtdq7U9hCrR7cU8HFJ6UWfsTlT4f0 6moTBqS1tpAfUh58m5ZP+3aMDivakB0WMkwIWbZXYvKrY4xeEsPPVg3V7F+B9vRsQZz3F72zj6i uCwkWME864Yhs1d+XvrLSFW/IGX4fNSjlAoig7SP+fEf3gL7Zty455h1i/J06RpT/ScCMmZrEGl 0a9VteqiieB7z6tXUUXYeTLrdBA77HEL9z3zRIkwYuvRoEdFXYU/ROw0KmlP26cSUGaRrs+DWGN 2Pfi6/sp3IFFJ42RRXzJ/rFFs2wkpRNI1lXCgcFsjlES1GPZjVFen49R7gpmpvTUQwMwe/s8Qdt yr3bKG4oo9tIMX2LTYZj/4UzB X-Google-Smtp-Source: AGHT+IEqkOJNoilUVgingHglwr91JrYy8YeFcEi/+1/1hWhNcxirT8La5zrk2H4NYsAlOSPX631XIg== X-Received: by 2002:a17:907:39c:b0:ad5:3ce3:6efb with SMTP id a640c23a62f3a-ad53ce3e815mr1208518066b.25.1747752382228; Tue, 20 May 2025 07:46:22 -0700 (PDT) Received: from ?IPV6:2a03:83e0:1126:4:1c0a:f3ac:4087:51c8? ([2620:10d:c092:500::7:66a9]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-ad52d4967c9sm738675966b.129.2025.05.20.07.46.21 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 20 May 2025 07:46:21 -0700 (PDT) Message-ID: <7f3974b0-d201-453d-846e-563547cf3fdc@gmail.com> Date: Tue, 20 May 2025 15:46:21 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [RFC PATCH v2 0/5] mm, bpf: BPF based THP adjustment To: Lorenzo Stoakes Cc: Yafang Shao , Matthew Wilcox , Nico Pache , akpm@linux-foundation.org, david@redhat.com, ziy@nvidia.com, baolin.wang@linux.alibaba.com, Liam.Howlett@oracle.com, ryan.roberts@arm.com, dev.jain@arm.com, hannes@cmpxchg.org, gutierrez.asier@huawei-partners.com, ast@kernel.org, daniel@iogearbox.net, andrii@kernel.org, bpf@vger.kernel.org, linux-mm@kvack.org References: <20250520060504.20251-1-laoar.shao@gmail.com> <2345b8b9-b084-4661-8b55-61fd7fc7de57@lucifer.local> <82f7bca5-384f-41e5-a0fc-0e1e8e260607@gmail.com> Content-Language: en-US From: Usama Arif In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: 22E4D1C000B X-Rspam-User: X-Stat-Signature: 777gm36q4wg55y4ofshfuubwabp8h4xb X-HE-Tag: 1747752383-451130 X-HE-Meta: U2FsdGVkX1+MhNqmvUhOcUfxXR2CINPCUAHfHmck6CAaGnZ550Zi7ZLd/o/C5MdJumXkgKKI/MrKkvouiwEG/+iowlvRU0PFVDRslnm5aafQ34FLoOqvEQzTV2gasMibs2JCDtwLgNFuU2sV/SgzhFRqjOwGKKjwmEQtJvQWwUhY3XCWQGf/KqanrqE5D+OaeHaVaCgTF0yh4qCyP3IQ6qpMeM24s6ShX2FloUZlsaYdfkrYxcJVrKPFgSbbk1QYLT5QyFqm8svAiKgHNL+gmGVrR9PY6dLJRsc6YA0r1OxgNkvnp8PXcwCmbmmwuiIlz6z1BzvsLnwKpc2Ddb8J3OckxPuWMCPL9TPskpexwK7qh0I9nn97Jn5oX9vN8pXfXkOrKIeRO3KulZguEzE4TjcmCzrFik6JT153Z5VeWj0cHNhKxpBVjoFkLIxH/TzHqJjDXyHTOHL3e/jdYnUZ+AlNWwCz9CTKVBkdD4YBPOnYmkU08n5dfGStjw/ktKRwuAfyZDLDO965T4LJIKklixcOQw5AY5h+byFdgmKFooULMotWXQ3r9/AHaVKGSkc/7msMEjjhPo28KUqhRwTovsW7kqRFAXWf2Qwp7XT8XPzNmDHoT87jEGrit6vki0nkghwC4UlnHsQvSsh32Iuckzzg1yBCAKSJByC8Pt7siX2+R1rScYyui7GWJlQW+LlUayN//VA3LRO/RrK8y/vYgNF8kjWRgERNLGbQnRZ0oY2xz0pK67mmdiuqCX329gGrLGuN8ZjMDaNlWjP5I3nUVSdnpPSerrQiond3iz9LwrR8arIx17WLN26vCpXJ/CVmGKHlBe04Q/e6YViyqTl+OA2dIdEeUrJtw9dNUUeip5O2+/e9zNoYKJUGBfjaXyPMUyagct7K1kKk1K73ONAHwWgptQrGsphfVYlZ0mlCABXH0uuplor2rWKmcK6LCU1HftVemmgfdVBZVMQcKhJ gfwxqPFT NZlN3eezJ17QxkOTwJspSSd/mBTvJNWrXDOQuMWPEgR/xYNWnCGsMgkwHfAF6elfVM2fjLqHI/28wklfiuqm7iVq2MMEvQ+w3AqUpNBBtPp4QQnn0dM0xviY+NIY+Z3ATUeN65cB4mM8n18IJGxraRjsJ/2m73XMWk1Zx6ZpDegpEOIB15rnSA9ER3bzeNUwvRyLvdIsxlBfT/Daa3OIf/BBNw1vKJUY3I/KoJBlgeOiTencvk5dWaATZRDdJxg0W/EfthHekVY32G1ab0Sce28L337CqHuJRcl8XAVXQhRZLG3t+BLl2rmzjNUNYXpRMUp3BIUhMwrMNAZdVJZ7A3VpoMNl8ltmp9GDSWju+A1xGl3ffeDUpmazHt6wyJ+K0AEyY3m2z/XDbLIb5XQO3Vx5LNUGo143M+3FCx0kRmLYOyj/Nq6/xn245KOCYLu7Anc8fSWBy0Toi2AxrbllH5WravTZw3IlFJSXQJxNVWYw14aArHhUIb5wZrjVG4RjCrBw9PCEc7RDd7C5rDp679dcERuMq0I5DXmSZFFH0jdQBdV9dt5JQ9rjJ7yHPS3vKXS40kFyM9LIo8wjYWbGhgLe2O4wbUmsyqU96UBlkFatGa9/0kbKUAfXsIZP8dc+ayzflgeXVDzb6uF/Ferl6Khm4bg== 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 20/05/2025 15:35, Lorenzo Stoakes wrote: > On Tue, May 20, 2025 at 03:32:16PM +0100, Usama Arif wrote: >> >> >> On 20/05/2025 15:22, Lorenzo Stoakes wrote: >>> On Tue, May 20, 2025 at 10:08:03PM +0800, Yafang Shao wrote: >>>> On Tue, May 20, 2025 at 9:10 PM Matthew Wilcox wrote: >>>>> >>>>> On Tue, May 20, 2025 at 03:25:07PM +0800, Yafang Shao wrote: >>>>>> The challenge we face is that our system administration team doesn't >>>>>> permit enabling THP globally in production by setting it to "madvise" >>>>>> or "always". As a result, we can only experiment with your feature on >>>>>> our test servers at this stage. >>>>> >>>>> That's a you problem. >>>> >>>> perhaps. >>>> >>>>> You need to figure out how to influence your >>>>> sysadmin team to change their mind; whether it's by talking to their >>>>> superiors or persuading them directly. >>>> >>>> I believe that "practicing" matters more than "talking" or "persuading". >>>> I’m surprised your suggestion relies on "talking" ;-) >>>> If I understand correctly, we all agree that "talk is cheap", right? >>>> >>>>> It's not a justification for why >>>>> upstream should take this patch. >>>> >>>> I believe Johannes has clearly explained the challenges the community >>>> is currently facing [0]. >>>> >>>> [0]. https://lore.kernel.org/linux-mm/20250430174521.GC2020@cmpxchg.org/ >>> >>> (Sorry to interject on your conversation, but :) >>> >>> I don't think anybody denies we have issues in configuring this stuff >>> sensibly. A global-only control isn't going to cut it in the real world it >>> seems. >>> >>> To me as you say yourself, definining the ABI/API here is what really matters, >>> and we're right now inundated with several series all at once (you wait for one >>> bus then 3 come at once... :). >>> >>> So this I think, should be the question. >>> >>> I like the idea of just exposing something like madvise(), which is something >>> we're going to maintain indefinitely. >>> >>> Though any such exposure would in my view would need to be opt-in i.e. have a >>> list of MADV_... options that are accepted, as we'd need to very cautiously >>> determine which are safe from this context. >>> >>> Of course then this leads to the whole thing (and I really know very little >>> about BPF internals - obviously happy to understand more) of whether we can just >>> use the madvise() code direct or what locking we can do or how all that works. >>> >>> At any rate, a custom thing that is specific as 'switch mode for mTHP pages of >>> size X to Y' is just something I'd rather us not tie ourselves to. >>> >>>> >>>> >>>> -- >>>> Regards >>>> >>>> Yafang >>> >>> What do you think re: bpf vs. something like my proposed process_madvise() >>> extensions or Usama's proposed prctl()? >>> >>> Simpler, but really just using madvise functionality and having a means of >>> defaulting across fork/exec (notwithstanding Jann's concerns in this area). >> >> Unfortunately I think the issue is that neither prctl or process_madvise would work >> for Yafangs usecase? Its usecase 3 mentioned in [1], i.e. >> global system policy=never, process wants "madvise" policy for itself. >> Will let Yafang confirm. >> >> [1] https://lore.kernel.org/all/13b68fa0-8755-43d8-8504-d181c2d46134@gmail.com/ >> > > Yeah I really object to that case. I explicitly said on your series I > object to it, I believe David did too. Yes, I am not for it as well, which is why my series never tried to do it :) As I mentioned in my series several times (unfortunately too many to count) hugepage_global_enabled always evaluated to false when THP is never. > > Never should mean never. > > It's a NACK if that's what this is about unless I'm missing something here. > > I agree global settings are not fine-grained enough, but 'sys admins refuse > to do X so we want to ignore what they do' is... really not right at all.