Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp4695967iob; Sun, 8 May 2022 22:20:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJydP9ohmdE0QXoloteGgiey0yWzEut1lO02gZJDnOent89j1n520itpqtyagsgj8B1JgoUP X-Received: by 2002:a63:310a:0:b0:3c5:f9ba:b010 with SMTP id x10-20020a63310a000000b003c5f9bab010mr12090225pgx.143.1652073624271; Sun, 08 May 2022 22:20:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652073624; cv=none; d=google.com; s=arc-20160816; b=Ty3kdDl3CtI2vIosRBHZ4WW+nMNundlRVWlTHQU4PHyXNS2ZD4T/QBircPmcoeI7ah hrr/LWq0aj0drzNqhuJr2tmZx26eLIRZC4719/xi2S+10x+iUvLpSptC+IXoBTIIPBzG u2a4OI9+ZP/PGsSwBHNmhiZwEQhpLgm0UTa4aYJp7mYTvgfV63q2Bmxrxod3U8G/zukM UVl/zMii0VHrimseFh8EqtPOjXI/txuHA4lK5VYI6fFsHTEoS0ioWaqzfx756CIAxB3c 2BKKcgIxxBnZ4s+un8bioFMZdSFjEQFEEs+FcbqJavwStrTx6DAVw7N62ekPT5V1WuD0 KjNQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:subject:cc:to:from:date:message-id:dkim-signature; bh=jalhMSau/4ac1aQTeKEt0TtpRgwPn28KXUpA5qg/su4=; b=lyESGgKO1n5CkVjgQS9LkyXPCheRbdtU0MxuvE+CikeFGyFLBJA8G8J8nU7q9i2hkp SSFi8o/geTMh1vAuoAaf7mSr+iOdtascqpE80tbs0Kq7mJtQLuSy7oSb4l9yvFKCMz6Q 7taf518xIDIIRtJuQ4nOgJmnCvrigM7F9Pn/+69IOiNzjT9e2aJAhMbQTRoIZEG+SCLN u2GnkzQc8vq4eihCwp1dAEIgZjQ6EReheR4wRT5ykkvMtfRFTTKD7pcMLc4J6J3LAPY5 0jlZIdr+mmaGknOzC2cxqTccZp0a/I2hInlW/JZftUt0n+k4jP94nM+7gTuIifC8OyEI wSeA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=KRd718Jg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id e19-20020a630f13000000b0039e59307c86si13076188pgl.617.2022.05.08.22.20.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 08 May 2022 22:20:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=KRd718Jg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id B3A8FABF74; Sun, 8 May 2022 22:16:57 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1356642AbiEGCJS (ORCPT + 99 others); Fri, 6 May 2022 22:09:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45636 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1356477AbiEGCJN (ORCPT ); Fri, 6 May 2022 22:09:13 -0400 Received: from mail-pj1-x1033.google.com (mail-pj1-x1033.google.com [IPv6:2607:f8b0:4864:20::1033]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 397751836E; Fri, 6 May 2022 19:05:28 -0700 (PDT) Received: by mail-pj1-x1033.google.com with SMTP id cu23-20020a17090afa9700b001d98d8e53b7so8854319pjb.0; Fri, 06 May 2022 19:05:28 -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=jalhMSau/4ac1aQTeKEt0TtpRgwPn28KXUpA5qg/su4=; b=KRd718Jg9pNqg0PO87qH43qF2rb43W1ldMnyH8wRDwVA955pSBtF2Af3S9Z8RoJy9A c4uqDtiZTfE7hmRtXjAlBTkmPZuG8VLUjKfVS5sC4d/snsPe2GfdrXp394cHdt2jfEXd rP8jvytgtnjziXev8xgqf2zdJGypsg0FtDsZadiPSu/a4cWRLzCuRnBpyHhbfudhrCYL x0+eOlN9Bkc7mzWlg75F55khDRlA7PjdXQQb+mp3dfY3qCyMkspEbSdREXmQSQXFsMLW d3WlADCQUxFo0E+OD3dNCf3qmyxe1nDKBdgDN7dDy8NLWumIZzUdnDPoO47ogIY+l8Pg ddgQ== 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=jalhMSau/4ac1aQTeKEt0TtpRgwPn28KXUpA5qg/su4=; b=J9htfiqh8UhnEXNSXmK03zq2zGd29oBgIsi9fhCGBbTPsiIVhxaSHZHrTQSCX4zvT3 OVdjCmJiFB16sWC6b/jzFUhrcFF5wVxJPWfNtKkCTxrG3Wrx04ajs66NUmLs4txwytqw x8786t868fJJzPl8ZLEzcimw0H1H7xvQFxHTgHQzrpzwYcW3mIg4tUdbzozpyqFUxxCO xLouISkLyNmpPbg+F4aBdsDGUKt4Kla2GreycSMLFom04GxXwvTGighDgMz1yTtNZSVn UzwFujEuTtoBJ0GPzIMpvR8YaATVjoCaKVBZarxtMzsV016PEPB2Vb4ueTRonqOnAuYX Bdyw== X-Gm-Message-State: AOAM531vpH8dddJTB94ZGLa5/l8COEDH3J1H5QIdipEBS19eWdATHs7t DYsR4sE+MzuU+YOQf2tPpUk= X-Received: by 2002:a17:903:1206:b0:151:7d67:2924 with SMTP id l6-20020a170903120600b001517d672924mr6535189plh.45.1651889127755; Fri, 06 May 2022 19:05:27 -0700 (PDT) Received: from localhost ([193.203.214.57]) by smtp.gmail.com with ESMTPSA id d6-20020a170903230600b0015e8d4eb2c5sm1912558plh.271.2022.05.06.19.05.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 May 2022 19:05:27 -0700 (PDT) Message-ID: <6275d3e7.1c69fb81.1d62.4504@mx.google.com> X-Google-Original-Message-ID: <20220507020525.GA639691@cgel.zte@gmail.com> Date: Sat, 7 May 2022 02:05:25 +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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, May 06, 2022 at 03:41:50PM +0200, Michal Hocko wrote: > On Thu 05-05-22 03:38:15, cgel.zte@gmail.com wrote: > > From: Yang Yang > > > > Using THP may promote the performance of memory, but increase memory > > footprint. Applications may use madvise to decrease footprint, but > > not all applications support using madvise, and it takes much costs > > to re-code all the applications. And we notice container becomes more > > and more popular to manage a set of tasks. > > Could you be more specific about the actual usecase? When do you group > processes based on their general THP reqirements? You are mentioning > containers but those are usually bags of different processes that just > share a common objective. > > > So add support for cgroup to control THP behaviour will provide much > > convenience, administrator may only enable THP for important containers, > > and disable it for other containers. > > Why would that be a matter of importance? > > Also what is actual semantic when processes living inside those cgroups > explicitly state their THP requirements? > Docker might support this new cgroup knob in the future, add provide UI likes: # docker run -it --thp-enabled=[always,never,madvise] The cmdline format from https://docs.docker.com/engine/reference/run/ 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 By doing this we could promote important containers's performance with less footprint of thp. > -- > Michal Hocko > SUSE Labs