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 50DD6C433F5 for ; Mon, 9 May 2022 11:26:48 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A69786B0071; Mon, 9 May 2022 07:26:47 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 9F34D6B0073; Mon, 9 May 2022 07:26:47 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8473F6B0074; Mon, 9 May 2022 07:26:47 -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 6F4966B0071 for ; Mon, 9 May 2022 07:26:47 -0400 (EDT) Received: from smtpin30.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 3C28C21044 for ; Mon, 9 May 2022 11:26:47 +0000 (UTC) X-FDA: 79445977254.30.676FF2B Received: from mail-pg1-f181.google.com (mail-pg1-f181.google.com [209.85.215.181]) by imf22.hostedemail.com (Postfix) with ESMTP id 37CE1C009C for ; Mon, 9 May 2022 11:26:45 +0000 (UTC) Received: by mail-pg1-f181.google.com with SMTP id t13so11765788pgn.8 for ; Mon, 09 May 2022 04:26:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=message-id:date:from:to:cc:subject:references:mime-version :content-disposition:in-reply-to; bh=0Ms5dtQehfkw1mFFz53YAav8LEpkzzlzEpCcB6kSnvY=; b=MVsp2jjiHNDmg59AzmpxFmJ7JTasWhUSVTYxRGAhW/4rn2RZgVAzmY6rO8TowyTJAc FRAAowpSFJ73ZVtwXcM6SzbbrEpMWO4jA96IwSUd4/toiWyZwJd+kVCybGjjHZXhU9fK UuggCJ5SWapCGbLK8LkRCuUXDXr5RQYuW+XEfCvfJCJYNsNg/zVn/XIWfwQ+3qZiNMH1 97LvMixlZ7SMQ1s2a18HesTT052QM5dR2Ek1eOEDtImvaAHHlFzhloQkJ+MHrkGouvI1 MGqhXhXrX5KMpOwtQAjOaDdea+K0oLRKdEh1kas3SspjdjBUHiC2UjT31YJxQkqVVm4e /eTQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:from:to:cc:subject:references :mime-version:content-disposition:in-reply-to; bh=0Ms5dtQehfkw1mFFz53YAav8LEpkzzlzEpCcB6kSnvY=; b=Zlyaf6ynNdkmL4rr2y6yQuRmpU8ygLTUEAnDxHQzz6uSf0rLWek8AEnA/sW9J6qNZ8 ChEzntzYSPmRfyd7G6MCUumzH4l4hVLpXtRklUhwDY9VLsO04G5Om461RnS9RUFywI++ CEcw7VleBeYr6rzmr9vl4XoyJEXK98tb1I+fJewcs7EKejZ8Y1RHjBbSbziPXG9pYQsc DJPEEUSaDLfTuH3drmxzq9GsI21A0JI+Vus1rzRplhbhqrzG6GGnRRDm2B3F/A7U5yUZ /rOxdhecTFcVd8Ad1zO9TQ8O0bprD0Rz7kV1YWN85QdRhOn4GEfFm86EkaIjGVPjFQUt aopw== X-Gm-Message-State: AOAM532utDXN8kGIlEuwr3Q1NaQXT9DMZj5/3pW4E/aqiPe2E4j3PfGU pWtUTxdFl0iF9PfYWJzeaH8= X-Google-Smtp-Source: ABdhPJxolDEt0Adrw+QGt/t5j16jYKevYnRFb403wZBw1BSJWcDPihVMAV64uYXj/wt+1jrVzyqcoA== X-Received: by 2002:aa7:9085:0:b0:50d:35ae:271 with SMTP id i5-20020aa79085000000b0050d35ae0271mr15404202pfa.42.1652095605860; Mon, 09 May 2022 04:26:45 -0700 (PDT) Received: from localhost ([193.203.214.57]) by smtp.gmail.com with ESMTPSA id p9-20020a1709028a8900b0015e8d4eb1d5sm6845311plo.31.2022.05.09.04.26.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 May 2022 04:26:45 -0700 (PDT) Message-ID: <6278fa75.1c69fb81.9c598.f794@mx.google.com> X-Google-Original-Message-ID: <20220509112643.GA1147603@cgel.zte@gmail.com> Date: Mon, 9 May 2022 11:26:43 +0000 From: CGEL To: Michal Hocko Cc: akpm@linux-foundation.org, hannes@cmpxchg.org, willy@infradead.org, shy828301@gmail.com, roman.gushchin@linux.dev, shakeelb@google.com, linmiaohe@huawei.com, william.kucharski@oracle.com, peterx@redhat.com, hughd@google.com, vbabka@suse.cz, songmuchun@bytedance.com, surenb@google.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org, cgroups@vger.kernel.org, Yang Yang Subject: Re: [PATCH] mm/memcg: support control THP behaviour in cgroup References: <20220505033814.103256-1-xu.xin16@zte.com.cn> <6275d3e7.1c69fb81.1d62.4504@mx.google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 37CE1C009C X-Stat-Signature: gcaarpc53ft7qm3rm7r4nsr9ztbgbeos X-Rspam-User: Authentication-Results: imf22.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=MVsp2jji; spf=pass (imf22.hostedemail.com: domain of cgel.zte@gmail.com designates 209.85.215.181 as permitted sender) smtp.mailfrom=cgel.zte@gmail.com; dmarc=pass (policy=none) header.from=gmail.com X-HE-Tag: 1652095605-260748 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: On Mon, May 09, 2022 at 12:00:28PM +0200, Michal Hocko wrote: > On Sat 07-05-22 02:05:25, CGEL wrote: > [...] > > If there are many containers to run on one host, and some of them have high > > performance requirements, administrator could turn on thp for them: > > # docker run -it --thp-enabled=always > > Then all the processes in those containers will always use thp. > > While other containers turn off thp by: > > # docker run -it --thp-enabled=never > > I do not know. The THP config space is already too confusing and complex > and this just adds on top. E.g. is the behavior of the knob > hierarchical? What is the policy if parent memcg says madivise while > child says always? How does the per-application configuration aligns > with all that (e.g. memcg policy madivise but application says never via > prctl while still uses some madvised - e.g. via library). > The cgroup THP behavior is align to host and totally independent just likes /sys/fs/cgroup/memory.swappiness. That means if one cgroup config 'always' for thp, it has no matter with host or other cgroup. This make it simple for user to understand or control. If memcg policy madivise but application says never, just like host, the result is no THP for that application. > > By doing this we could promote important containers's performance with less > > footprint of thp. > > Do we really want to provide something like THP based QoS? To me it > sounds like a bad idea and if the justification is "it might be useful" > then I would say no. So you really need to come with a very good usecase > to promote this further. At least on some 5G(communication technology) machine, it's useful to provide THP based QoS. Those 5G machine use micro-service software architecture, in other words one service application runs in one container. Container becomes the suitable management unit but not the whole host. And some performance sensitive containers desiderate THP to provide low latency communication. But if we use THP with 'always', it will consume more memory(on our machine that is about 10% of total memory). And unnecessary huge pages will increase memory pressure, add latency for minor pages faults, and add overhead when splitting huge pages or coalescing normal sized pages into huge pages. So container manager should welcome cgroup based THP QoS. > -- > Michal Hocko > SUSE Labs