From patchwork Sat Jan 5 00:19:15 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yang Shi X-Patchwork-Id: 10749009 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 50A2117E6 for ; Sat, 5 Jan 2019 00:19:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 34D9D2877B for ; Sat, 5 Jan 2019 00:19:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 25F98287CB; Sat, 5 Jan 2019 00:19:50 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DF04C2877B for ; Sat, 5 Jan 2019 00:19:48 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 76A6F8E010F; Fri, 4 Jan 2019 19:19:47 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 719B88E00F9; Fri, 4 Jan 2019 19:19:47 -0500 (EST) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 62EC18E010F; Fri, 4 Jan 2019 19:19:47 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pl1-f199.google.com (mail-pl1-f199.google.com [209.85.214.199]) by kanga.kvack.org (Postfix) with ESMTP id 2274E8E00F9 for ; Fri, 4 Jan 2019 19:19:47 -0500 (EST) Received: by mail-pl1-f199.google.com with SMTP id bj3so28026111plb.17 for ; Fri, 04 Jan 2019 16:19:47 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-original-authentication-results:x-gm-message-state:from:to:cc :subject:date:message-id; bh=cILX4HMUFbwSFCIVIurGkpyp+TbRc5qpUrnESIfI4Qg=; b=tntN7X1kdml9k0FOm72CjdxAPep6TO70jRIUCK+MjvgttJjbrB29BIyLn2y3yMHTvk p43Cv8Dh6o31ZxEce7gfMjkmiYMNPMEuQH9Gk9ZS3q1lSN0TfwZtgom9R64EJQ/Mmo/n REDgrl8OUi+Me7tm2d+ovT5eMzx/4wvLzGOo8ZVFqYhn9FgwDBjRVPSdHwAk/cWOwQ89 KgJR8mcecb4EGI6i3C/g45j5ckzZzl0q9LqJ7eAQ+4F2mrqpP7I9Yf1gBTCVv+Tb+qe1 Eq3J7Jf9ojjYjgyNuuvjY1ev7aDsvb3Q9yXwksZIXGThEwK4ZhJL5v3HX7hWZznpYefk 10fw== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of yang.shi@linux.alibaba.com designates 47.88.44.37 as permitted sender) smtp.mailfrom=yang.shi@linux.alibaba.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=alibaba.com X-Gm-Message-State: AA+aEWa84Dt0as/ffnqAm0tLRq2DQjXJl977I4io6N+oP5ad/0tmx4OF SFAWNeALQ4T5TeDS6Fidfd1uQdMok/zihx0j3zrx7vQWn6A4fzbHTLcce+j8pREIHDCYAqqEcOS LP8Rx2rNAsW9Z/1tTTTurMhhN1WfLOKwlOMlQOTDgnzzMWokfCGjGRm3pRxn63en5Ow== X-Received: by 2002:a62:9913:: with SMTP id d19mr54326211pfe.107.1546647586680; Fri, 04 Jan 2019 16:19:46 -0800 (PST) X-Google-Smtp-Source: AFSGD/WaqbVWyJsWAs7/bi5PQPMwZ+nf2w6UTh3hES0+rekWm9+ZhBPqeJhUZB9mDsCWhjhYUpGt X-Received: by 2002:a62:9913:: with SMTP id d19mr54326175pfe.107.1546647585699; Fri, 04 Jan 2019 16:19:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1546647585; cv=none; d=google.com; s=arc-20160816; b=Pg/92BdWbrOF9Joix6F3TrswtQ9runmoe9zrABBoyKOO6eKN9UJpLHx2XwAUHdLF2a UaXjfvsZnQ+khA1UQuxjl8EYRHBTRQkewFr6mOvO+gniYP36IKRuFUPo5XwQtPOafjPx qIM/wuPEzJ4m6TCfwqQZesZJLbWtvwnjyt40s9Bn5mWfmqMf/Fm8Do4zq/DxIjg7SUKN P2hmLAn/xO2gFkco9SF4LU0XJtOIqPRdrSViaO8IJiFwe6CkzQUaClLu7u8+h0tyG12i KZl8yJEJFfwAG/7ke78QTG/Yj/hP/Mfdi399IzR6ymyahp0hmDHJNMEuzdM5jH08D10x NzCA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=message-id:date:subject:cc:to:from; bh=cILX4HMUFbwSFCIVIurGkpyp+TbRc5qpUrnESIfI4Qg=; b=Zk+9hgjaKWWNsSnXtJJ/8YQjRDhMavbFki3ZM+iPzfC8FOq86yRJ83jnlyrcae2Vsj OCQYUuA1qYRoKqu9g7EN6P2gaDcCW8CD4SAHyV+josAGGk1+J9SHxw7zUvEYCJ/kAIfZ FW6PUvH27mGjwGPw/N+WibOG5lSfsRrJnryM08HStCDv4iiIUC2mlOyi1dSSnqKcgRTE rV7/iE9Cyo8KQpjYoMkFuT3TU4WyGu95lgguPV4yNaSccpgA5U7/Kbsh8onaVlrZz8GX AozUDbQvVZxaj0zksJcHWVlFLL1jijbD41sueJgswM3pM3KE4J4WH0hD6j6WdAga3Sv+ Drcg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of yang.shi@linux.alibaba.com designates 47.88.44.37 as permitted sender) smtp.mailfrom=yang.shi@linux.alibaba.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: from out4437.biz.mail.alibaba.com (out4437.biz.mail.alibaba.com. [47.88.44.37]) by mx.google.com with ESMTPS id c17si54144404pfb.81.2019.01.04.16.19.44 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 04 Jan 2019 16:19:45 -0800 (PST) Received-SPF: pass (google.com: domain of yang.shi@linux.alibaba.com designates 47.88.44.37 as permitted sender) client-ip=47.88.44.37; Authentication-Results: mx.google.com; spf=pass (google.com: domain of yang.shi@linux.alibaba.com designates 47.88.44.37 as permitted sender) smtp.mailfrom=yang.shi@linux.alibaba.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=alibaba.com X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R161e4;CH=green;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e01424;MF=yang.shi@linux.alibaba.com;NM=1;PH=DS;RN=7;SR=0;TI=SMTPD_---0THYi1he_1546647563; Received: from e19h19392.et15sqa.tbsite.net(mailfrom:yang.shi@linux.alibaba.com fp:SMTPD_---0THYi1he_1546647563) by smtp.aliyun-inc.com(127.0.0.1); Sat, 05 Jan 2019 08:19:30 +0800 From: Yang Shi To: mhocko@suse.com, hannes@cmpxchg.org, shakeelb@google.com, akpm@linux-foundation.org Cc: yang.shi@linux.alibaba.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [RFC v2 PATCH 0/5] mm: memcontrol: do memory reclaim when offlining Date: Sat, 5 Jan 2019 08:19:15 +0800 Message-Id: <1546647560-40026-1-git-send-email-yang.shi@linux.alibaba.com> X-Mailer: git-send-email 1.8.3.1 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: X-Virus-Scanned: ClamAV using ClamSMTP We have some usecases which create and remove memcgs very frequently, and the tasks in the memcg may just access the files which are unlikely accessed by anyone else. So, we prefer force_empty the memcg before rmdir'ing it to reclaim the page cache so that they don't get accumulated to incur unnecessary memory pressure. Since the memory pressure may incur direct reclaim to harm some latency sensitive applications. Force empty would help out such usecase, however force empty reclaims memory synchronously when writing to memory.force_empty. It may take some time to return and the afterwards operations are blocked by it. Although this can be done in background, some usecases may need create new memcg with the same name right after the old one is deleted. So, the creation might get blocked by the before reclaim/remove operation. Delaying memory reclaim in cgroup offline for such usecase sounds reasonable. Introduced a new interface, called wipe_on_offline for both default and legacy hierarchy, which does memory reclaim in css offline kworker. v1 -> v2: * Introduced wipe_on_offline interface suggested by Michal * Bring force_empty into default hierarchy Patch #1: Fix some obsolete information about force_empty in the document Patch #2: A minor improvement to skip swap for force_empty Patch #3: Introduces wipe_on_offline interface Patch #4: Being force_empty into default hierarchy Patch #5: Document update Yang Shi (5): doc: memcontrol: fix the obsolete content about force empty mm: memcontrol: do not try to do swap when force empty mm: memcontrol: introduce wipe_on_offline interface mm: memcontrol: bring force_empty into default hierarchy doc: memcontrol: add description for wipe_on_offline Documentation/admin-guide/cgroup-v2.rst | 23 +++++++++++++++++++++++ Documentation/cgroup-v1/memory.txt | 17 ++++++++++++++--- include/linux/memcontrol.h | 3 +++ mm/memcontrol.c | 55 ++++++++++++++++++++++++++++++++++++++++++++++++++++++- 4 files changed, 94 insertions(+), 4 deletions(-)