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 7048AC369D9 for ; Thu, 1 May 2025 00:41:19 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id BA3FA6B00A4; Wed, 30 Apr 2025 20:41:16 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B51C16B00A6; Wed, 30 Apr 2025 20:41:16 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A1A086B00A7; Wed, 30 Apr 2025 20:41:16 -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 832176B00A4 for ; Wed, 30 Apr 2025 20:41:16 -0400 (EDT) Received: from smtpin23.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 04C2DBE84E for ; Thu, 1 May 2025 00:41:17 +0000 (UTC) X-FDA: 83392485036.23.1FFF74A Received: from mail-qt1-f176.google.com (mail-qt1-f176.google.com [209.85.160.176]) by imf11.hostedemail.com (Postfix) with ESMTP id 2A13A40002 for ; Thu, 1 May 2025 00:41:16 +0000 (UTC) Authentication-Results: imf11.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=KjAoGhpU; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf11.hostedemail.com: domain of laoar.shao@gmail.com designates 209.85.160.176 as permitted sender) smtp.mailfrom=laoar.shao@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1746060076; a=rsa-sha256; cv=none; b=yzvYT+WkHRpgKylsJYYIYow2JE6ZL/E1G68JJePiZjijQg2k5Xxylo5ia6v6wsr0w33tlN 7TFW7SD2dAm8Sh274HS+Eez3ev/ZyI4BBuCdysoYukz0Q/C3ii9xN5jKvD/x+zI4UEiyOU vmKi2HcqcffqnuM2+G4Bz0aG0Q8fUUM= ARC-Authentication-Results: i=1; imf11.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=KjAoGhpU; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf11.hostedemail.com: domain of laoar.shao@gmail.com designates 209.85.160.176 as permitted sender) smtp.mailfrom=laoar.shao@gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1746060076; 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=N+WZXGwb58/3SG5GqLqXNmJuLmQfgaLqqTnUc7KKPYQ=; b=IaMrP4qp6+Sc5v9u4iUGxSg70rb2xW/YtAHLmCd6TuTrBy8qc8x1NYTjtBB/yfHPcM7Bju 4WoZx5oeRugQdoNXHFtLAD21/VfIM2yv0JXUq27AH+9fR6Nkk8oizNNLGG9mKEgi7W0HTW v0ZvqxEGFD0FAXUza5w2Q1XGy+6fNXQ= Received: by mail-qt1-f176.google.com with SMTP id d75a77b69052e-4774193fdffso9047501cf.1 for ; Wed, 30 Apr 2025 17:41:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1746060075; x=1746664875; darn=kvack.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=N+WZXGwb58/3SG5GqLqXNmJuLmQfgaLqqTnUc7KKPYQ=; b=KjAoGhpUKADa+yH6Y/urPLLW4jDQPEsRqJCoda9NsqmfYA55MMhjBmkbsPvWAscZYX BmoKaraldDAE8tB5h7NPX89Z9W0dWWdzdr5t7UfkQYpryGVlWxFc7bEhbfm+zS8JAUqE tVijCWDgP3Ll7IUN40e6B11LDeUawg1iV3VL67NegQ65XJULOxMVmsD58YQafZ7c0oDw sAE6fFy/dnQ3AXcBZkvFx78y9G5KN2MknnJDNpwQHR+4Z+rxZBSzLjeu5fkpwlUhxgOE IIA0B8+iS+I9g65kOGXSiSw3Y66ymjs1xAU2yf/+3WRlCR3BD95/pOl5yM0C1k+oEFbm QKkA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1746060075; x=1746664875; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=N+WZXGwb58/3SG5GqLqXNmJuLmQfgaLqqTnUc7KKPYQ=; b=uij8lar5LTAkPOhrKlIk8NbF3VIihprsKvvDNmj9BV2MCWfHrhOVSxXyD4UiLNpZBX iJSlSUW7ieggChXYy6J9A/rMbSTqKqv7xsMa8XcFUsBLyq8eyCFu2zhWasVJiojo8Sdx 7ns63SedAE5rVmPEpgfFTLvweCykY3hHxNr4lrH69zoQ/OXCtcnbCZQmJXgfvyxG3eQV LhmV7kWxabYGm9l60AP0LeF2W7mqnz5fPM6hUgio88e2OFv5Lv7Rtoo1HT+3xXEtvTWC hdqxc6OvYJkOnz0uydpBkeSBi4va2YJcwSj7egjk7i8GlgvAtI1gK1A6l5dyyfGBnnj1 83tQ== X-Forwarded-Encrypted: i=1; AJvYcCUxAUnIiPG1LUn7GhWxw5f/7cuzQ/tXAHz/L8GOcvvOktZR0BGq+DClzqjtp6SvIszAefPhZrr53g==@kvack.org X-Gm-Message-State: AOJu0YyIt6f5/HhTzIJGG3zU5EUcvhX4x2bOxgqAgns3lqEggEWXhV/z yKNoWfjXw08ATRRF7E3uv9tqf7Ujn8fAkf1RGS5YpD2GfEqU/mC6yuSKbaZKHbkyc0Ru4ZWuw5c damJOBzZTwg6iU+jgTrhCbTfEdf0= X-Gm-Gg: ASbGncs5skzo8RZCj/UAlRgIsHeAEaPlqVd/9/JVyO7UK8Y5o/ZnIC0oKJ9rlWpAGCh AqLL+FZ58jiHIwOCnf8MDQ8dfq0jDRqcsthfyNOS78psWIrZX8TAMhI90rj1LEZoPnAS4mkLTsa YnC+3ocFdjklvNZxP6J3hq2z4= X-Google-Smtp-Source: AGHT+IHkT9mIv6SE6GkHQhPe1AagpNBj3fzSES5u/yUEQMnLFZtUj5ir7WWCl0i0x9xAGmA/XdATAn0uInqcHbodP/Y= X-Received: by 2002:a05:622a:1f8d:b0:476:a6bc:a94d with SMTP id d75a77b69052e-489e4a8df67mr89129631cf.19.1746060075264; Wed, 30 Apr 2025 17:41:15 -0700 (PDT) MIME-Version: 1.0 References: <20250429024139.34365-1-laoar.shao@gmail.com> <42ECBC51-E695-4480-A055-36D08FE61C12@nvidia.com> <20250430175954.GD2020@cmpxchg.org> In-Reply-To: <20250430175954.GD2020@cmpxchg.org> From: Yafang Shao Date: Thu, 1 May 2025 08:40:39 +0800 X-Gm-Features: ATxdqUGuvZE0etm8BHikrEA8IzDx90CAots4PaATaHpw9ej-FRfv6RrSq8cBWFE Message-ID: Subject: Re: [RFC PATCH 0/4] mm, bpf: BPF based THP adjustment To: Johannes Weiner Cc: Zi Yan , akpm@linux-foundation.org, ast@kernel.org, daniel@iogearbox.net, andrii@kernel.org, David Hildenbrand , Baolin Wang , Lorenzo Stoakes , "Liam R. Howlett" , Nico Pache , Ryan Roberts , Dev Jain , bpf@vger.kernel.org, linux-mm@kvack.org, Michal Hocko Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Rspamd-Queue-Id: 2A13A40002 X-Rspam-User: X-Rspamd-Server: rspam07 X-Stat-Signature: oidk6ftooa59bcirbdhcac6zhho3brbg X-HE-Tag: 1746060076-474293 X-HE-Meta: U2FsdGVkX1/aJLDs9Sarjuy6HRqSLBfUV22VWyo/bvkPj3ZHhsLdKHKkvP3g/WM4ZWIR3V+sM+EEY/pk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nhSE5yQlcX3gdZsEEzH18Ai+qFxlPjjxdOM9vchG4tmha6kKWUciQrUMl9BewWnybnsCjpt4zSA/oOEbeiHtCcmOzOxNU7D1g7+TQ/EqrXjycO5Q0XWHMMoDVvuJUGGZuCgwd0t9kK9xUHKOwrS+98XKnkHkZ33+Hk1DpfRexdsMNqeyF2IL1zS1u+80Y0GB3ADxpmti+9/cgNLOSFrcBgrR92V9RiCPEjbSfLmSGWhyzoszlzj2UTo1pyD7UR359HLN4CpK1RSsEMUYn6dOI+KpjQvZ9zYXFUay/VL1lv27nF0MKCknQiw7vSKSHFfmWhaiyD+NVuVUDttOrtnLs8bpkMTsGFhzeyLU= 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 Thu, May 1, 2025 at 2:00=E2=80=AFAM Johannes Weiner = wrote: > > On Wed, Apr 30, 2025 at 10:38:10PM +0800, Yafang Shao wrote: > > On Wed, Apr 30, 2025 at 9:19=E2=80=AFPM Zi Yan wrote: > > > For task-level control, why not using prctl(PR_SET_THP_DISABLE)? > > > > You=E2=80=99ll need to modify the user-space code=E2=80=94and again, th= is likely > > wouldn=E2=80=99t be a concern if you were managing a large fleet of ser= vers. > > These flags are propagated along the process tree, so you only need to > tweak the management software that launches the container > workload. Which is presumably the same entity that would tweak cgroup > settings. Right, we can modify the parent process code. In a containerized environment, that would mean modifying the containerd source code. However, deploying such changes is far from simple: 1. We'd need to deploy the modified containerd to our production servers. 2. All running services would need to be restarted. 3. We'd have to coordinate with teams whose services don=E2=80=99t benefit from THP to ensure their cooperation. 4. Only then could we set =E2=80=9Cthp=3Dalways=E2=80=9D across our product= ion servers. 5. Next, we=E2=80=99d annotate the services that do benefit from THP, resta= rt them, and monitor behavior. 6. If anything goes wrong, we may have to repeat the process. 7. For systemd-managed services, we might need to implement a separate solu= tion. This is a painful and disruptive process. In contrast, with the BPF-based solution, we simply introduce a plugin. Only the services that want to use THP need to restart, and they=E2=80=99re generally willing= to do so since they benefit from it. As you mentioned in another email, this entire process is experimental, so it=E2=80=99s very likely that we=E2=80=99ll encounter unex= pected issues. That=E2=80=99s why flexibility and ease of adjustment are critical. By the way, I have another draft that hooks into the fork() procedure using BPF to adjust per-process attributes of services, aiming to simplify deployment=E2=80=94but that=E2=80=99s a separate topic. > > > > For service-level control, there was a proposal of adding cgroup base= d > > > THP control[1]. You might need a strong use case to convince people. > > > > > > [1] https://lore.kernel.org/linux-mm/20241030083311.965933-1-gutierre= z.asier@huawei-partners.com/ > > > > Thanks for the reference. I've reviewed the related discussion, and if > > I understand correctly, the proposal was rejected by the maintainers. > > Cgroups are for nested trees dividing up resources. They're not a good > fit for arbitrary, non-hierarchical policy settings. Thanks for the explanation. --=20 Regards Yafang