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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id AB584C433EF for ; Wed, 20 Oct 2021 11:45:57 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 3643B61212 for ; Wed, 20 Oct 2021 11:45:57 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 3643B61212 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 8A3056B0071; Wed, 20 Oct 2021 07:45:56 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 851926B0072; Wed, 20 Oct 2021 07:45:56 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 718D6900002; Wed, 20 Oct 2021 07:45:56 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0108.hostedemail.com [216.40.44.108]) by kanga.kvack.org (Postfix) with ESMTP id 62F176B0071 for ; Wed, 20 Oct 2021 07:45:56 -0400 (EDT) Received: from smtpin12.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 126E92C59A for ; Wed, 20 Oct 2021 11:45:56 +0000 (UTC) X-FDA: 78716636712.12.0A36CFE Received: from mail-qt1-f174.google.com (mail-qt1-f174.google.com [209.85.160.174]) by imf22.hostedemail.com (Postfix) with ESMTP id BF14A1902 for ; Wed, 20 Oct 2021 11:45:54 +0000 (UTC) Received: by mail-qt1-f174.google.com with SMTP id w2so2755583qtn.0 for ; Wed, 20 Oct 2021 04:45:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=vhvaoZ+wHJBa6Q68stwGndjLH++jNxGQGS33m44y204=; b=p+6RSM8zu41A9edVgEJFVALuyQXSLPZ+K/uBBm6aM+W1ROFU6TK4BRDvF3ET4KsV6G vUQiqVOCau1zQ3FBz1OfhdWaTinQXIwS7uy8um0HGCiwE17BS6sCucrCkC/ZRVqLfMQs 99+z+AnQWTr8TmvhLiQoe5wRWm1ucBCnKT7SPpPpXRqDC1MlhpnHBYJ1JwIvhdqSHjMi R2r/wwU4C0Ycb3hO0rfvfspQxld29VphdheFp65xwLrui9qlm027QQ0+DfyIr7zDA2M4 lrAqiUlBaJrJhW29ksxwYVmtPeHjJTY4GaGAPbWJZKN+DTXAZV73597dlhbRXDJp2aHG xpDg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=vhvaoZ+wHJBa6Q68stwGndjLH++jNxGQGS33m44y204=; b=cMmi9w9JesgD3Q+RLa5S9E81gByM1z/GZcnjBYXE9hjeVGY57urJHKu8tmfzB96ZEp vmtviRkzCJWVm5efPpE57ZAZ3Mw62DZdupeAc7WCJOH11Gr3Jh6JwiiiEljPLDCkVaUj 8SI0tCU0SPlGqO1srwlRFxhMiASbpynqYDtWcmKXW5Lx3cOr5rdUvKExfqJm/ajtGqPD euD+vUwnZUVPrh8W6rKO7in793LLXfM8zyFKY9G/Chiro5jqxwCVCklmRkBVpBpghXiL uQ7XCemIpPQMnOPFA4wSaXene/c96mgw+luJQPrnrO5D6iSYuMZNc/pbzBnbb3lCe0+r GwOA== X-Gm-Message-State: AOAM531AI9TGwhBgQf6N6SW7PfAd6CnZcGxbcvoxnw/sQ63d5uEuh6FY xNZ0/sWfxiekknVV1HIqXCrVCDqr4f16kSyQRTU= X-Google-Smtp-Source: ABdhPJwqeggaHeS4vdFzq8VqOVZD42AfkTVUHwtPn98HL6j4rhcJBTezcWbpnFTEuKzTDiC5b6E717eDsjqPhOo6kJA= X-Received: by 2002:a05:622a:1998:: with SMTP id u24mr6305457qtc.156.1634730355177; Wed, 20 Oct 2021 04:45:55 -0700 (PDT) MIME-Version: 1.0 References: <1634278529-16983-1-git-send-email-huangzhaoyang@gmail.com> In-Reply-To: From: Zhaoyang Huang Date: Wed, 20 Oct 2021 19:45:33 +0800 Message-ID: Subject: Re: [PATCH] mm: skip current when memcg reclaim To: Michal Hocko Cc: Andrew Morton , Johannes Weiner , Vladimir Davydov , Zhaoyang Huang , "open list:MEMORY MANAGEMENT" , LKML Content-Type: text/plain; charset="UTF-8" X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: BF14A1902 X-Stat-Signature: p419f4yaoo41zrfeauusgc3a47794917 Authentication-Results: imf22.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=p+6RSM8z; spf=pass (imf22.hostedemail.com: domain of huangzhaoyang@gmail.com designates 209.85.160.174 as permitted sender) smtp.mailfrom=huangzhaoyang@gmail.com; dmarc=pass (policy=none) header.from=gmail.com X-HE-Tag: 1634730354-972622 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 Wed, Oct 20, 2021 at 4:55 PM Michal Hocko wrote: > > On Wed 20-10-21 15:33:39, Zhaoyang Huang wrote: > [...] > > Do you mean that direct reclaim should succeed for the first round > > reclaim within which memcg get protected by memory.low and would NOT > > retry by setting memcg_low_reclaim to true? > > Yes, this is the semantic of low limit protection in the upstream > kernel. Have a look at do_try_to_free_pages and how it sets > memcg_low_reclaim only if there were no pages reclaimed. > > > It is not true in android > > like system, where reclaim always failed and introduce lmk and even > > OOM. > > I am not familiar with android specific changes to the upstream reclaim > logic. You should be investigating why the reclaim couldn't make a > forward progress (aka reclaim pages) from non-protected memcgs. There > are tracepoints you can use (generally vmscan prefix). Ok, I am aware of why you get confused now. I think you are analysing cgroup's behaviour according to a pre-defined workload and memory pattern, which should work according to the design, such as processes within root should provide memory before protected memcg get reclaimed. You can refer [1] as the hierarchy, where effective userspace workloads locate in protect groups and have rest of processes be non-grouped. In fact, non-grouped ones can not provide enough memory as they are kernel threads and the processes with few pages on LRU(control logic inside). The practical scenario is groupA launched a high-order kmalloc and introduce reclaiming(kswapd and direct reclaim). As I said, non-grouped ones can not provide enough contiguous memory blocks which let direct reclaim quickly fail for the first round reclaiming. What I am trying to do is that let kswapd try more for the target. It is also fair if groupA,B,C are trapping in slow path concurrently. [1] root | | | | non-grouped processes groupA groupB groupC > > -- > Michal Hocko > SUSE Labs