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 603F3D5CCB3 for ; Wed, 30 Oct 2024 14:58:13 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E48B08D0005; Wed, 30 Oct 2024 10:58:12 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id DF7938D0001; Wed, 30 Oct 2024 10:58:12 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CBEBB8D0005; Wed, 30 Oct 2024 10:58:12 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id ADC4D8D0001 for ; Wed, 30 Oct 2024 10:58:12 -0400 (EDT) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 51842A0C21 for ; Wed, 30 Oct 2024 14:58:12 +0000 (UTC) X-FDA: 82730573730.02.5A180EA Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) by imf13.hostedemail.com (Postfix) with ESMTP id 6866E20006 for ; Wed, 30 Oct 2024 14:57:42 +0000 (UTC) Authentication-Results: imf13.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei-partners.com; spf=pass (imf13.hostedemail.com: domain of gutierrez.asier@huawei-partners.com designates 185.176.79.56 as permitted sender) smtp.mailfrom=gutierrez.asier@huawei-partners.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1730300160; a=rsa-sha256; cv=none; b=4dIc67G6M/gEJy6WInUhNXbVZw6tO3lP7M7Hy1JMNap6Uch0IqQhaIviXtp/MSMpTqINAe HyINzfkOnP/sSmPE/U15exN3kzlCyx+9ftHodE4/wJVwLr++gtCp0JcxswXvjC3XI4oGxv YezOX3JnDJ4trDy9e+6NGP8rEb7nNnQ= ARC-Authentication-Results: i=1; imf13.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei-partners.com; spf=pass (imf13.hostedemail.com: domain of gutierrez.asier@huawei-partners.com designates 185.176.79.56 as permitted sender) smtp.mailfrom=gutierrez.asier@huawei-partners.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1730300160; 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; bh=6+NMOLOB3I6lqntKWWnWjyA0i0R7TfmIvJNO5kLJOlE=; b=IXCIzORuFOhNaifKkfiwjkn/ujsSe2/IQ9LPy3nl24znyKYjL6c1Qoqj6v7KzX1lhx4poj su8Ow4J8GJNwdJBHE4XqwpsgbmYmeDuGnU02i8xLLAXBE2H4kwIFit6YqihXQ7Shs4xtiu 3c84YTTU1LCjSPso0d1iNMEE/W2vUhU= Received: from mail.maildlp.com (unknown [172.18.186.216]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4Xdqvy6zmCz6HJg7; Wed, 30 Oct 2024 22:56:46 +0800 (CST) Received: from mscpeml500003.china.huawei.com (unknown [7.188.49.51]) by mail.maildlp.com (Postfix) with ESMTPS id 52EAE140A35; Wed, 30 Oct 2024 22:58:05 +0800 (CST) Received: from [10.123.123.154] (10.123.123.154) by mscpeml500003.china.huawei.com (7.188.49.51) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1258.34; Wed, 30 Oct 2024 17:58:04 +0300 Message-ID: Date: Wed, 30 Oct 2024 17:58:04 +0300 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [RFC PATCH 0/3] Cgroup-based THP control To: Michal Hocko CC: , , , , , , , , , , , , , , , , , , , , , , References: <20241030083311.965933-1-gutierrez.asier@huawei-partners.com> <770bf300-1dbb-42fc-8958-b9307486178e@huawei-partners.com> Content-Language: en-US From: Gutierrez Asier In-Reply-To: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.123.123.154] X-ClientProxiedBy: mscpeml500003.china.huawei.com (7.188.49.51) To mscpeml500003.china.huawei.com (7.188.49.51) X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: 6866E20006 X-Stat-Signature: ib4m3cp4motom5hr6uuuqtiznqcko85b X-Rspam-User: X-HE-Tag: 1730300262-622917 X-HE-Meta: U2FsdGVkX1/0307ChVgJBMKhB7VbGQl1ppiOtVlfaPgv2Y6eZBpRp59A1VH0tQ6wdHWVWdFJY51llGr41TXU43ijdG0MXXEj3YT6ztcN6MHKOlpZZTpE6/3gygvorww1w8Sd7DnkdI+kl1Jn+xVJLa1zLWgUKq+dcMybEv1HtPTsbmXb1cCcS2GcRMdEOZsTcSegzTVn3/ht93lKrLvaZGPaErB831WEaavnNPjLcDyNfo+SLaVy+HgtC2CUDOthUFQbE0lyNYQ3QVaUZJVDiLeLXDiq9QRl0g8YiPWlANM+Lrg1SX/wCNKe9Fg9WS6OM2HM4a96EZtWvPqvuN6eKTB3SDFDDngRaFJtzX0ypg2jhDY9V8MIbbC0nHPT/UgVmfifMYsxbFx2OwgtYYBhvaQ/YRxLIradE+BG5vkAIGdpljon0PQVoxiJ7HbtFpQ8b1qelYEGoKXnUA3HBZO4r99tmklaSnuwL/B04ee8J7L9OLyDZrJ1g2Ja9pefbmT2E8FbeRCP2VQvTmMX0sDcWQl+NQAn8zEy6X5bOb7uNxSrn4MvnwvQCfKZBq7ptan3Nllf81mtVkQrkshcWoIFmRjrkw/DOCEVDUN51aT0I5OLb9fTVPLkq+hNVf3TV8cdf2uht/uBirZrQIF8UiRmyBX74Srqvda8yKpsBRTPSav2f/ff3PczlVbsnKBc//mJy0bGv7E/lsVm/jCClt/h7VrBb83A+iMXFDkJZ/3f1kyIu9el44fT7OXXG17qugSs9N5+H9zriQloDxtO1Ak/bOtNjFJyh5epErzK22UGVqerzG8MjpcZCWgHFWjMIzW/9TkYsuuHAbr67zbvPNocVwd0HDOy30hHaR9gWrVjlJyEL4zz78Vn0Ja3HnJT26ru4jXkLLautiQ02tylVVRJR0I6E6wq7BytPKHUrWsUfyGUaJ1RQKfgQg0XtniW5vlV8IT+9EkY2/LRkqjEFz/ 9zpmbM3P gK9u6nLlpHVu2whudT+RL0qFULjPEkQEVG2xHs1wQuGKmLkXW+trvdxr3S0pcxdZeAtTop1kCGgvtddt57FUoEKlCg1TYNBnj9l9HgEhGmYaVADLAHS0IBbDwU4HyQkNhGpsYWm0zycG75jXPr0GrZmApLInuTsTe6ON0MgCClGss88FQkhtdjRKv0YBoKYbpxI7Uh5ZYEFSZL/AD/px/tOT0t40wB/N0ejC2Sn/IEgsn69U= 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 10/30/2024 4:27 PM, Michal Hocko wrote: > On Wed 30-10-24 15:51:00, Gutierrez Asier wrote: >> >> >> On 10/30/2024 11:38 AM, Michal Hocko wrote: >>> On Wed 30-10-24 16:33:08, gutierrez.asier@huawei-partners.com wrote: >>>> From: Asier Gutierrez >>>> >>>> Currently THP modes are set globally. It can be an overkill if only some >>>> specific app/set of apps need to get benefits from THP usage. Moreover, various >>>> apps might need different THP settings. Here we propose a cgroup-based THP >>>> control mechanism. >>>> >>>> THP interface is added to memory cgroup subsystem. Existing global THP control >>>> semantics is supported for backward compatibility. When THP modes are set >>>> globally all the changes are propagated to memory cgroups. However, when a >>>> particular cgroup changes its THP policy, the global THP policy in sysfs remains >>>> the same. >>> >>> Do you have any specific examples where this would be benefitial? >> >> Now we're mostly focused on database scenarios (MySQL, Redis). > > That seems to be more process than workload oriented. Why the existing > per-process tuning doesn't work? > > [...] 1st Point We're trying to provide a transparent mechanism, but all the existing per-process methods require to modify an app itself (MADV_HUGE, MADV_COLLAPSE, hugetlbfs) Moreover we're using file-backed THPs too (for .text mostly), which make it for user-space developers even more complicated. >>>> Child cgroups inherit THP settings from parent cgroup upon creation. Particular >>>> cgroup mode changes aren't propagated to child cgroups. >>> >>> So this breaks hierarchical property, doesn't it? In other words if a >>> parent cgroup would like to enforce a certain policy to all descendants >>> then this is not really possible. >> >> The first idea was to have some flexibility when changing THP policies. >> >> I will submit a new patch set which will enforce the cgroup hierarchy and change all >> the children recursively. > > What is the expected semantics then? 2nd point (on semantics) 1. Children inherit the THP policy upon creation 2. Parent's policy changes are propagated to all the children 3. Children can set the policy independently -- Asier Gutierrez Huawei