Received: by 10.223.164.202 with SMTP id h10csp3787452wrb; Mon, 20 Nov 2017 05:07:35 -0800 (PST) X-Google-Smtp-Source: AGs4zMZpoz7/YDBJSmhMb8+kujNu8WpITXB+BujcIZDguGYmcbfi9S25v5tAIVmIYIbsy8RDh6tx X-Received: by 10.84.253.142 with SMTP id a14mr11854138plm.38.1511183254954; Mon, 20 Nov 2017 05:07:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1511183254; cv=none; d=google.com; s=arc-20160816; b=Om9vRf+/xsC6TQ3SmyelH3H2Pgs/JlXRAJENT9NAyZmBj6ijmt/pM3HlasVrfIUzq1 F74/R7d2bsoMCiKDeb2S9bm+qM1OUAybTutjPzfjHRpsxx/CFP7843NFo7NAYOPk87kP nkAILIbc5KIc+RuWMkB07zOEEaCpcMw4trIeWxiRStZ7Bp9R2LPLDUwtJ1ymszf02VK9 mQ6LEPpCL0FNEDftIwnZQ+2Wpr4zaZ7XOMm5/P/MFM+yt1692j4GOrJYURTyXcIcNMDb 4/7NQXzTKoQka7pDVHWFEub/ywPBDdSaFVxSWVJ4U+Pkz/y9YXht0vzHpTzlHmVBhihe 7wRw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=tY6cWXvjGYt7Q5QgUjCN8Ro/hvwgbRyfFgQMOB9U8eY=; b=L96KIZT/QOtbpqnHsCj8fzAi09dO/mY6+wYc+brNeG0rO+qGvO/gR431hwfUgtOpZb usR1ocbMtKvOINiajApV0apbRdXt1QEiQAAUbrTu2WJrmjiHlFqWOgIKcVQB4SK4hdj7 Pfsc72Bg8Rpb+sKpGDh5V7Fwy0bNADnjQftv5TgoQqiZT/cUPmhgB8lsQNPidDem9fkQ ZZ6FytH6VSNriX15VaGdWVsx2g8cnC6pQN+SnJl7ohkFOP5WTvRK4afl9xLy4d6evCex SyVM9AIasyUW/8Oat+PGb0UAnEaJ8MPR1ElattONkpq3N59fEKozapE5m6XjlwcA7L31 QLug== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=S/rMH/oN; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q1si8319823plb.105.2017.11.20.05.07.24; Mon, 20 Nov 2017 05:07:34 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=S/rMH/oN; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751249AbdKTNFI (ORCPT + 67 others); Mon, 20 Nov 2017 08:05:08 -0500 Received: from mail-it0-f66.google.com ([209.85.214.66]:46633 "EHLO mail-it0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751071AbdKTNFH (ORCPT ); Mon, 20 Nov 2017 08:05:07 -0500 Received: by mail-it0-f66.google.com with SMTP id r127so11829247itb.5; Mon, 20 Nov 2017 05:05:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=tY6cWXvjGYt7Q5QgUjCN8Ro/hvwgbRyfFgQMOB9U8eY=; b=S/rMH/oNs/1jo+Lo+1WVZsqCkaRyBb8luxZXkI4kgqATOG+LExYIo5Sr/aZX7ZGRbm vZDVm6y0mbhh7dhGZOuNpMm56Yl9eXo84XJchmZShVm8F/h9WxmLDXqRzFWpVzldegat NuJwByw9yPEpNnkLEZpQ9RWzrQfOY4SCj+gXtjKYJaStmGQqnvJTMAX120ZT+yVOUMIz fVWnu7WznroGH3RemfDAng70OJLvFOIq739Nne0H9R0fOmsd/MKdl72q5JhVQmiHI8bI 7klrZxtH3iVKjUEwccnI133D/78lwXcKG7AsJ3SJsa0JACV8v7J5vXij3Iv6EZaHVNjc A+Ug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=tY6cWXvjGYt7Q5QgUjCN8Ro/hvwgbRyfFgQMOB9U8eY=; b=KKLSl/Hgj4Wl86+h+WygsrxvJaMSwJ56FWov+rnzwuuAlB3tjST2HcF32KXsFA+Qa3 Oos9PXz/7W20C07H7JDdaMI4wdr8oUWp2gROOCGfxQhQH0q+L5VDJBKEjj0qQIPWnBFw Ht21Ny/SzxGBWO1GvwH0uuxFePUWxpy9n1BaK3uu7j6hJK18Ok8YcmXOZcBErowadxYW nhFJcA1+E1UgfoAUvq0Yxu4Mwad2yzKM5fQxTjF7ANfcM6V1My/atUbqVHR4Uf0XnjlT d3OrR8XkBTVRXI+Bm05OqA73WmeFxCv7bjCpAvaLFAwDj7f+DcCvOEuA7WU8oj/1kBM/ iSbw== X-Gm-Message-State: AJaThX6WREDqFOqSwT7cPDjTC1dIP8SJ2S2JO90TeYXCx8lT4Wf2F9RZ 1CWl0ej1/A6+3u2+laFBzdoTlnq3vdhvOkhRexM= X-Received: by 10.36.249.132 with SMTP id l126mr18845713ith.52.1511183106338; Mon, 20 Nov 2017 05:05:06 -0800 (PST) MIME-Version: 1.0 Received: by 10.107.160.73 with HTTP; Mon, 20 Nov 2017 05:05:05 -0800 (PST) In-Reply-To: <20171120123933.fh5mnslggk4kys7d@dhcp22.suse.cz> References: <20171117155509.GA920@castle> <20171117164531.GA23745@castle> <20171120120422.a6r4govoyxjbgp7w@dhcp22.suse.cz> <20171120123933.fh5mnslggk4kys7d@dhcp22.suse.cz> From: Yafang Shao Date: Mon, 20 Nov 2017 21:05:05 +0800 Message-ID: Subject: Re: [PATCH] mm/shmem: set default tmpfs size according to memcg limit To: Michal Hocko Cc: Shakeel Butt , Roman Gushchin , Andrew Morton , Johannes Weiner , Vladimir Davydov , Tejun Heo , khlebnikov@yandex-team.ru, mka@chromium.org, Hugh Dickins , Cgroups , Linux MM , LKML Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 2017-11-20 20:39 GMT+08:00 Michal Hocko : > On Mon 20-11-17 20:16:15, Yafang Shao wrote: >> 2017-11-20 20:04 GMT+08:00 Michal Hocko : >> > On Fri 17-11-17 09:49:54, Shakeel Butt wrote: >> >> On Fri, Nov 17, 2017 at 9:41 AM, Yafang Shao wrote: >> > [...] >> >> > Of couse that is the best way. >> >> > But we can not ensue all applications will do it. >> >> > That's why I introduce a proper defalut value for them. >> >> > >> >> >> >> I think we disagree on the how to get proper default value. Unless you >> >> can restrict that all the memory allocated for a tmpfs mount will be >> >> charged to a specific memcg, you should not just pick limit of the >> >> memcg of the process mounting the tmpfs to set the default of tmpfs >> >> mount. If you can restrict tmpfs charging to a specific memcg then the >> >> limit of that memcg should be used to set the default of the tmpfs >> >> mount. However this feature is not present in the upstream kernel at >> >> the moment (We have this feature in our local kernel and I am planning >> >> to upstream that). >> > >> > I think the whole problem is that containers pretend to be independent >> > while they share a non-reclaimable resource. Fix this and you will not >> > have a problem. I am afraid that the only real fix is to make tmpfs >> > private per container instance and that is something you can easily >> > achieve in the userspace. >> > >> >> Agree with you. > > I suspect you misunderstood... > >> Introduce tmpfs stat in memory cgroup, something like >> memory.tmpfs.limit >> memory.tmpfs.usage >> >> IMHO this is the best solution. > > No, you misunderstood. I do not think that we want to split tmpfs out of > the regular limit. We used to have something like that for user vs. > kernel memory accounting in v1 and that turned to be not working well. > understood. That really doesn't work well. > What you really want to do is to make a private mount per container to > ensure that the resource is really _yours_ > -- That is what I'm doing it currently. Then setting the default size depends on the container memory limit works well. Thanks Yafang From 1584588789203721277@xxx Mon Nov 20 12:40:30 +0000 2017 X-GM-THRID: 1584307723039976913 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread