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 0752DC3ABDD for ; Tue, 20 May 2025 14:32:22 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 63C5F6B008C; Tue, 20 May 2025 10:32:22 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 5ED0C6B0099; Tue, 20 May 2025 10:32:22 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5041D6B009A; Tue, 20 May 2025 10:32:22 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 328356B008C for ; Tue, 20 May 2025 10:32:22 -0400 (EDT) Received: from smtpin28.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id DC8CB1A04FD for ; Tue, 20 May 2025 14:32:21 +0000 (UTC) X-FDA: 83463526482.28.B41519C Received: from mail-ed1-f43.google.com (mail-ed1-f43.google.com [209.85.208.43]) by imf26.hostedemail.com (Postfix) with ESMTP id C4F7614001E for ; Tue, 20 May 2025 14:32:19 +0000 (UTC) Authentication-Results: imf26.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=cZ2mcyp1; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf26.hostedemail.com: domain of usamaarif642@gmail.com designates 209.85.208.43 as permitted sender) smtp.mailfrom=usamaarif642@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1747751539; a=rsa-sha256; cv=none; b=DOMFkJ7x8lzZkPYkE390x8sDUf6643+KICdSGQ1PSm0QPM6vO4+b6Sd9dccmUnW1Wlj1ji S3O2xil/BarnYWi42mg4D3qtonx/md8saAt99TqfM5Co6fvc8xBpnk2OOYg5d01GWZb9kW LdiMshBv0hyevHL3gQ9lqoxifHXq+Xc= ARC-Authentication-Results: i=1; imf26.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=cZ2mcyp1; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf26.hostedemail.com: domain of usamaarif642@gmail.com designates 209.85.208.43 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=1747751539; 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=Lh4Pm0sp8IajUI4dOEci5cZ7CVnfMTUBQkzonbEseWs=; b=l0FrmCsZqoSCvwRLDgRG3gwLUgmnWFtYX68gbSQLagPdFanVIQN53/j3IDx/LDfhYcS8MZ g3aRZGEPbD1huuvzXh46jW06ohNd+Xm1ZtFhgv2ppSsU/bhhkvKUad7xhLU7FR2mBz18aC aUsc14YVr7BqRP2Pd9FOCh96g8hy79s= Received: by mail-ed1-f43.google.com with SMTP id 4fb4d7f45d1cf-5f3f04b5dbcso8139800a12.1 for ; Tue, 20 May 2025 07:32:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1747751538; x=1748356338; 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=Lh4Pm0sp8IajUI4dOEci5cZ7CVnfMTUBQkzonbEseWs=; b=cZ2mcyp1lAd+n1RjmYWl7UoP/F15fLRdwD8VZ/B2/25unPbLjawy44VOh1wT3IUOkW ohL1LP2zVENCl7o3dIOD+GUWVm+V9aq+YEWEUqTshWZPCxYSU9ugc8RRbq2+4Z+1XwKh P/Fl28a4JVBUuwaZAwS4pnB/EllmAz/btXSg63XFhMJl3R+T/si7d6YZwIKJMzMTbYQ/ A45KDDXARa+9NzCNGhIvERb6rWqj5FRkBfzG7LVy6WGUKrzH//Wvo0aM8+oHl45nRAz4 qxUOtLvP4V0UNGuDOHmGq4yjGp2VeHKOpXi40Sb4SqxfpGhya+Rczd41VnDG0QvxcU49 mEgg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1747751538; x=1748356338; 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=Lh4Pm0sp8IajUI4dOEci5cZ7CVnfMTUBQkzonbEseWs=; b=lSLN1uZdM6rSDu8Ntww2tJclJ0E54/3JXwiGxAiUdmm3hDKRjet3dF3IHnTI4erBSx 08ui1HMDxmqbpq4+sJiwCApYFQ2e+znHE388+3W4jSk17HuLkUjY78r4+NZBE1oV+RRI lYu6eC1TZKz9bWlZmmHNluSGEIcD29Spi+kTtC52FN/OrbQrztFm9VfSxlqL8fUdjI5r 1GBZa+ulZpLyaNB9rqfvD87cqyB9mLKDr2dCVlmkXTSTToVwviHXmL/HoLdaAKbeyP4y cqy21ftkPH5GS9s2qBOLqNVaePLn+wiGPmhnXm8CtcRYcSEKoC2amS6A+Ph2tQ2W3sYC OorQ== X-Forwarded-Encrypted: i=1; AJvYcCUAg/hFRuZYJ9CfzcozaZJTCrHgptdu15GQKYMqYFg18VQ3GRKDE8HrixKtmhSFebmUgcBobO6dGA==@kvack.org X-Gm-Message-State: AOJu0Yz5pkvP4EyV17mODcO/DoCzKMyKItpCrujk6cVrPL5WtVv8M0wt FBoBZV/Q6zn5nTHvNr3pfR0sAq9ntaRcACBOb2kH7ifUcMROtQB2sbba X-Gm-Gg: ASbGnctzaC6yrRr2uPPv4WrJXkOWa9rAQozn7Bq44YM9cK3ZdMzMdHRL0nwZSVaPFoq 1x2KtoInH6A+VeqxxTlFw6UbO6qYEME57dWGo4ajvjAiQ6fwEcYTRrRmg4t+CTonmVrkPxT90ht /JJgC+Nf07BmyuugJlMSG9IoLDt2W8svy6lVsjl858yeaEyV1b9Wdk3ydQMu+oRvfFJmrtygnzg 2MUtT7yfcbztqOH+UdyWsKO7SyBTC464SBrzriYEjGjEldwJViM23Uzfo3xdTNeCM/wb0SlVJ0X gougFEEIgiKEW9e68/4TZEFR5yNFvnzA3axglHv0+DnD+FmzxCx+IoInfSuGkdqctD7CJmvMGAq 6F6ULvJw6Id77rXo8kb2Lyic9 X-Google-Smtp-Source: AGHT+IGfufzI3ipSzXSZFxZNhnZTBDsEoGZVdRNO8UaZUfj3D2VJARvPViUibgD0CIz8pQtzSjB0Tw== X-Received: by 2002:a17:907:7d89:b0:ad5:2378:dd66 with SMTP id a640c23a62f3a-ad52d5757cfmr1610059966b.39.1747751537652; Tue, 20 May 2025 07:32:17 -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 4fb4d7f45d1cf-60203c21233sm1497986a12.71.2025.05.20.07.32.16 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 20 May 2025 07:32:17 -0700 (PDT) Message-ID: <82f7bca5-384f-41e5-a0fc-0e1e8e260607@gmail.com> Date: Tue, 20 May 2025 15:32:16 +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 , Yafang Shao Cc: 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> Content-Language: en-US From: Usama Arif In-Reply-To: <2345b8b9-b084-4661-8b55-61fd7fc7de57@lucifer.local> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspam-User: X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: C4F7614001E X-Stat-Signature: 43h9kunptyde6npz7zt74nek4reomhyh X-HE-Tag: 1747751539-756312 X-HE-Meta: U2FsdGVkX1+UI6jr9/huVp9gWrgBDI/ElFFopPLOjXW+mBag15y/VParKSLV7TAlkBMcM3ZDLdj8xISuyXuJefyUp4QVfe4u/LTZIJTcOMGBQg9dQR7/Sdf/WM+WPgnTxSAwtKFHIvxp5Tm6whdUJIOIv8DSpqQ6YmqlXpacFUXIUjeu7QtXGY0XiTxlN8ucLArnL7uhjGH+UQxnY1CZYowCFM8mdwBADcdefcqSDb6DV08zOD7K7s0vhd3muNOlbxTpULWQqv2d7UUAEACIAtWwKo+vcSd3xF09hAdOOeaSQArSMVjdeuSHP/ppd1CTsMNwBh+X2wDakF7Da6br8VGvwv//DnOH6NimNtqHTYoYzRDIL8Yqyvz1qiWnL818Sdxsj6NiNfBCSxZzvVfWNllJAQb2oo55Q+1jD/B7faXfYo9tAisGjLOhq0/If/V+anApnmwpufraKcapf2tnOL+H/7W1v/r8bR6k35czwIVPgbmbSkJ9QHmb1VsexrnObOKvljXbWN0IBusoSc3akf1l6/MtKuB99W+SFrbDzT6lmumf+bWVU7/lOg2FZALMFsI0SCXA+hhVDmTUE1nPj7hSyPOy/cRV5MIXt8uWKD12UPgHUbozmKeT+r9r9lXxzB7Glf/1qZ0et2COhVxxejAAHPjdEEvWwgu359ALPPRAfrO/nDkD/EXfSfHyLIUWS2kkSS7YZwAn0gXcX8acLUtjDnWhseO9n3QpyDnLPSVhgJAi6L9zxGogDhS7zVHh53qE3St2VCNGsD7XOGx7+a4+pS5EEizWbPehoBpnN2wpMmeLLlhnyBbhbcFkrwjGO6APgmqsW+51wlpOkf4OM+tKQ9JL5Y8A5I/ddnNj6iUupOVWamLyU2nXleHGYrkJWNiUN9SkOaNuLM6Ri++iIZD2QsDIHLCzx3Hp/20m1lVxgXBP/vNNWQygV89TkSrCgLSQDTg1ZjSqoIksj3F d96ZeBbX RhIq9dYM9nDN/xRyFKg/rsTBA9NV2QxSElB8QM3JnS6ce7tg9cDMPlq1VOoCbMvPInw2bJQfAxeL/djdE8q50yqECpFlnrVMxkChdvgTff6oo0HqUmizH5M++nBKT1YWQp4DuRSpqaZ+J2Rsv2r+3D/rJSsrXRYnjMwpobms0OwiWzQThHWT3FBVczTdTwGWc2in8H1ybzJpDpzU75YwUhRmDRddCbIPZdh0dqTvFi+IOvMRvYcLxh0/6pu89TTNOZqkOeip4Q4KAdcX7BDMbhF31ntNt0PrXwYWySwGr/0qLM/kxHlny51aNK4+40hsuRfKDwVk97STlOQzScmM7C8pMGW8+7ylv13WivsVEpQj/qCC8NvJfu3/o5Fz+Js1Ejhl59dFM5ANsrDSMqgEM2ux2V1MVJNxsxiv6/zUXDWjZuFb5bDSXiq2cm/gS1PKorPT6zoxFNNEiBMJqrTXm/k2qTWKkxFgT9z6UhPjkgLawSbcmKjPC6sokvLR5gJwyYcQwyEpgbT87xe2mu3UB4StETGxP7ZGzNSatBzZkVoD/Qeab0VzPmpq2OeGr1d7Te4U8XtzJd1/B7FGrlUuPBKx3MpQdWa8GD0zN4Dx2AwQmpm9GprlD9T9IQV+fx2pKYxn3xg5JzgMztJNDRQRYJ83wCQ== 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: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/