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 X-Spam-Level: X-Spam-Status: No, score=-0.6 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3FEE3C432C0 for ; Mon, 25 Nov 2019 09:11:53 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 0218E20823 for ; Mon, 25 Nov 2019 09:11:52 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="MUTcreZH" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0218E20823 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 7BB036B05BC; Mon, 25 Nov 2019 04:11:52 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 76BD26B05BD; Mon, 25 Nov 2019 04:11:52 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 65A836B05BE; Mon, 25 Nov 2019 04:11:52 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0087.hostedemail.com [216.40.44.87]) by kanga.kvack.org (Postfix) with ESMTP id 53D9E6B05BC for ; Mon, 25 Nov 2019 04:11:52 -0500 (EST) Received: from smtpin01.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with SMTP id F311E180AD81A for ; Mon, 25 Nov 2019 09:11:51 +0000 (UTC) X-FDA: 76194232422.01.sack74_103ec96e03317 X-HE-Tag: sack74_103ec96e03317 X-Filterd-Recvd-Size: 4701 Received: from mail-io1-f68.google.com (mail-io1-f68.google.com [209.85.166.68]) by imf28.hostedemail.com (Postfix) with ESMTP for ; Mon, 25 Nov 2019 09:11:51 +0000 (UTC) Received: by mail-io1-f68.google.com with SMTP id z26so11823356iot.8 for ; Mon, 25 Nov 2019 01:11:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=uGPyrIKqssIBqjCzYFb08/5Ivi/MwfvCzsOFHEmoTbg=; b=MUTcreZHnpiV6roFJw75/pyVFwip/O+hetw3lQJB2U+8mdhCHwEVmj2WIh5WXa6jN5 TTdraoH5pphwpIxlWrrHIeYBM247tcLDomOH4ZIaa/vlzqHkNZsX0LknyCB4/PTmIcX5 RzD1i2s4TipJaR9GX3HoMsXgy/IHPkinBDlh4Uz4lvvChKYmAx57oe9sO4h+09rR22g3 buW/RyKcR0RJrXwSGL/0yngBtrpNgGi7U3Rdsx6aejTtBBX4FUxVNlzHx50/ri911QSw qvnh0H/SJlzXMI9C03DmjzQHONfrTg/BUUsXCikhuEq7QVzHdBwWCLzXwVT6Hs52JtYB TT6A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=uGPyrIKqssIBqjCzYFb08/5Ivi/MwfvCzsOFHEmoTbg=; b=XpkpC1Top3PF5ZAX3X4PqUZsOk4Rh4v/P+CxLH9CHGsUSp29GiIxdt8/FdS14IuhIP PNVzgKA2AvEhSl6wxkBJioXRYGZdrw2w0aUm1O9ydMY9CsnLaMdcvMcMYRgNEAmlN6wN YBhAM3gy4o+OfpK39K/xzAhCJ9zqJ5vPJ067BQuJY6VwuOxP5z1NvKbm3x379D8HF2Us PqlakvJpNL/tmP5Uwq8k3pVQ61PL4N5lX5nOFq9f4iI6PY0h3roJjFBdwahBdfl3MUaV mn0IQIilQb4n9mIozLXwgIl8DNPAwyeskcKgO49FQ8S9a9gMnW9+eLsYNzdbwgmgF28y 2CpA== X-Gm-Message-State: APjAAAWE6nTxnspeQYaevnMZEP/cu7tz000ftLw59Sj0Zozom6H7gSog gprXSs7YqeBwekI80YdbHNxq5SyGeU+GQjB4G4I= X-Google-Smtp-Source: APXvYqwnRhu2BtR7zTsloJZnmouL7iqnnVfiycB9g03JpZn1GmYDpCtWmQf1Ur7LZUXtjkxyd/Y+MA/EkCyisw9zhT8= X-Received: by 2002:a6b:5503:: with SMTP id j3mr4449244iob.142.1574673110900; Mon, 25 Nov 2019 01:11:50 -0800 (PST) MIME-Version: 1.0 References: <1574488602-11773-1-git-send-email-laoar.shao@gmail.com> <20191125081446.GA31714@dhcp22.suse.cz> In-Reply-To: <20191125081446.GA31714@dhcp22.suse.cz> From: Yafang Shao Date: Mon, 25 Nov 2019 17:11:14 +0800 Message-ID: Subject: Re: [PATCH] mm, memcg: don't protect pages if memcg is not populated To: Michal Hocko Cc: Johannes Weiner , Vladimir Davydov , Andrew Morton , Linux MM Content-Type: text/plain; charset="UTF-8" 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, Nov 25, 2019 at 4:14 PM Michal Hocko wrote: > > On Sat 23-11-19 00:56:42, Yafang Shao wrote: > > memory.{min, low} keeps protecting pages in a memcg even if there're no > > process running in this memcg. That makes nonsense, because if there're > > no processes running in this memcg there may be something wrong happens > > and these protected pages are not useful now. > > Well, the min resp. low limits protect charges rather than tasks. And > thre are cases when there is no direct relation between the charged > memory and a specific task - e.g. long living kernel objects or page > cache. So there is nothing really unusual to have charges in an absence > of any tasks. I do not really see any reason why the protection > shouldn't apply to them. Such a be behavior would be quite inconsistent > btw. Just imagine a case when there is _a_ task but that one doesn't > really have any charges in the memcg. Why should we respect reclaim > protection in that case? > Per my understanding, the memory.{min, low} is used to protect the workload. I don't know in which cases we protect the 'content' only. If one memcg is used to protect the content only, e.g. some file caches, then these file caches will be shared by processes in different memcgs, that may cause some unexpected issues, for example, how to handle the writeback throttle ? I don't know how to use memory.{min, low} to protect long living kernel objects neither without any processes. I would appreciate if you could explain my questions in detail. > Btw. offlined memcgs already have no min/low watermarks protect. > > Do you have any specific usecase that suffers from this behavior? > For example, if oom happens, the processes in this memcg may be killed by OOM killer, and if memory.oom.group is set, all processes in it will be killed. So these protected pages are useless. In that cases, we should clear memory.{min, low} protection. Thanks Yafang