Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp1415052pxb; Wed, 20 Oct 2021 04:48:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyz6HBeHuQMBGbFKP+Xc3AtVO6WahpRt7mPuVS0y8rCm8HXv4ctnXG6Q3iZ8BrvyVCKb6Ul X-Received: by 2002:a05:6402:4248:: with SMTP id g8mr3485913edb.126.1634730494681; Wed, 20 Oct 2021 04:48:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634730494; cv=none; d=google.com; s=arc-20160816; b=VNyvZOmJEDM/l3qPUJUG5nUD3TQfrIfBlaIUUaEN3cVOg0iadfPBuE1+mVURGi3YsA +4AFM8Mc+I7gvxhox5AIY8yv38Bo3MZA7zyImGAG1NFQUMzyiayUBY516i34Y2l86foo 1DEQus6qbgUXpCBTMplLTp1nMRawndnI1qa+8u+hhBjSyh9xwuVTfbisf1E1Zx2Yt0eh 0GhDzoXtrvVgbXOuRKl5AeKtJCMGzXAJwAaTX5Wm3hplqwsp7hVzY0QFrBR5D2XpFxO0 ulMYk2Gsbvu7TAtB0hZwWEemwwjAKVj6FAQKyTlN8S2e2oIourOYhoEtKrsCAshlnrTY AiFA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=vhvaoZ+wHJBa6Q68stwGndjLH++jNxGQGS33m44y204=; b=Xf4wwPJZJMzBbTrOEFZVRuItrAvNLRN3Bdxr1pbCD76QGB2bzprOe7VKFW6jGEofgX RZSHWo7qDlv1ph2HTETeDfrj4ciDNKOmPinSH6UFAcsaRzlf7b7kFVl1RU+iL5crKRkT qZ3gSjkj1ScpUiPd4Fc2cDICttAp84I2uJgUxiP9cN+gRsnYKHZAh/7lYbBCBppN4mP/ XFjOdkrdj8EVX9EMC+qzxXShsgB2tvlMzNPulDYUgF25Hrmqz2Qzg950YuhXR4xFzBlG c1gS+aBFnqXTR6cKLW5OY6TimQ4x2yyTU81lJ7TWz9WGTjZGiq3y7sydcHXKHuWVu3qC d02w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=p+6RSM8z; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d7si2423026edy.224.2021.10.20.04.47.49; Wed, 20 Oct 2021 04:48:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=p+6RSM8z; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.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: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229941AbhJTLsK (ORCPT + 99 others); Wed, 20 Oct 2021 07:48:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41772 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229548AbhJTLsK (ORCPT ); Wed, 20 Oct 2021 07:48:10 -0400 Received: from mail-qt1-x82a.google.com (mail-qt1-x82a.google.com [IPv6:2607:f8b0:4864:20::82a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E5BEAC06161C for ; Wed, 20 Oct 2021 04:45:55 -0700 (PDT) Received: by mail-qt1-x82a.google.com with SMTP id r17so2676550qtx.10 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=xQNPNbsb0bQAF9nGBFppPnq2iT/zIywNT3ZFPMErClvDfQNNClieWpzSOIOmAKRHnc 8L9aDI5pTXdAhhl/yFSCJ6QbRjaEn5QOgTRrOojq7j8lit8zTd61NJR8vaHsy4oIYI0m mS6Wv+uwUPtSePQV82RN23GfJXdbKq6v/G3XhpebgwtIRnlT8X8ETdYNTWcsmER283LB LPLDrqNmMYSNyGObDZumVdsBF5v0BirCNK50tr488krjVvaCjZ2F4dWSIbNz0q/4TDGE OLiPFuRZ82raJwCt5+3bTj8DYdLM8jW70gHy4c794IKZZU4eAPTL86hXGmBrxssvWPO2 8eaA== X-Gm-Message-State: AOAM5307FNCGWbDvASt/5NiJYmjlc7E8373DIdp6HY0Bh+9iOX2YiOar gmmF2p98hx3D9Konl5DLi6BajwEMd5Q6r+u+vMY= 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" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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