Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp2611064pxb; Sun, 17 Oct 2021 20:26:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwNPkwsrq0SXy47HAdH4y1L2EBskEl6Mevtm2tgDB3VWbK/KYWphnpTdqCuH+iFFlc1/VSh X-Received: by 2002:a63:dc13:: with SMTP id s19mr21042171pgg.233.1634527616813; Sun, 17 Oct 2021 20:26:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634527616; cv=none; d=google.com; s=arc-20160816; b=JFIii8J4LfvmT37c47ehweO909RQz10vtErAZCmxiu88LqLtCWVp+4UMZgzDi/v2sj yaVNoc7Uk1JAUE+w/ZxBoglc5r8XCtgTrozU0IRNJa4/QTYjuBrtAVKZE+UW6VqjdGAS xoQwEMkJ3uttT3wwIhqskz6GUC36Hu5HCjmHQxM+ooQyiaT48qlTdSI27NuMt4EkIYhc t/3yvsTfTcwPGekmGbpoBl3hnRP8pliGH6SwGiA76A1YvwwIFRBPZPRY5FtpMP7PdV9H ukc3tuhnN/8joaoyBi4V7IvbcqPB9Qx8iD6JxVrypBpDJID+ijUDXh6Qz4EcCb733kW2 Q7ug== 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=EpcMXlD4nO+K+Q8XzAFsUdO5HR/N4yrrpmRoJSfRZVc=; b=U86XtlfkC400W2FPiiF7lbuy5pWc8xglmvDFArzg6WG2So2tGOawTYLsPbfNtfegri WkzrutKb3kWsqlgPMrTQKIrHHfBos0KUhe4iyYSwr6hNmrUNXrOdphq4ZIlmPR+zNvqE 3+V7hEwzOJ3AC4BGqEQ5mbYqcP5ErgMucUx7kv045eHL7v0avyPqxDjGABSp8ibVwR9U rqdCyHytSV7naAe3nppUvYkJURGuu8nFHZlsUNHWF3+sx0mRN6B3zv5rvW8vGtJ1qHfV QZBRFi0ycQvursbBOKr9NhrwEiKyet4Ij1SUJZ0HYtaSDAo4wcMVnVoX91MqbcIjH6mL e70g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=EnKIfT2U; 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 c1si14307685plg.306.2021.10.17.20.26.44; Sun, 17 Oct 2021 20:26:56 -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=EnKIfT2U; 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 S239619AbhJPCbZ (ORCPT + 98 others); Fri, 15 Oct 2021 22:31:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49306 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232812AbhJPCbY (ORCPT ); Fri, 15 Oct 2021 22:31:24 -0400 Received: from mail-qk1-x736.google.com (mail-qk1-x736.google.com [IPv6:2607:f8b0:4864:20::736]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3FC0FC061570 for ; Fri, 15 Oct 2021 19:29:17 -0700 (PDT) Received: by mail-qk1-x736.google.com with SMTP id a13so504460qkg.11 for ; Fri, 15 Oct 2021 19:29:17 -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=EpcMXlD4nO+K+Q8XzAFsUdO5HR/N4yrrpmRoJSfRZVc=; b=EnKIfT2UsVIuFY0xz0CB9IQD9sy5IpZQrEtBxQTjPmuqA5FIIaTzgNu2kbVr/BBuo6 EFdPygJcPsnLBbP1UxnsxiS8vIZbAjLbbdRsmrIiAXjlD8l//MelTPh3ZxwB5a2ByBtL pFgRyTczQ7dKo3d1oCYXsM1U4fGgbWOxaJkWEcXLFQJkPQxcAankAz24OEAod27Noidc mG7Q2A72OqnG+fGAOwICODeYhBUCHwAnE7qyPrzD06xW8DiqsA6OSzVTLGLRcZM72iX2 CkrsAsus+l4HnZrA304xWldcEh/PPuUO5/wU0nz9KRvhLx7L1DEMIs+4uaI3URwzpD9a O1dw== 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=EpcMXlD4nO+K+Q8XzAFsUdO5HR/N4yrrpmRoJSfRZVc=; b=sfZbxn1xV8gD4Ol/6TVNAdUtCQLtt3sojKKtg9NnQHqbdDbA3mFmAA5iaOauw/ICoW aLSLre0dGv02TdSMPfi4xFB8w7QBeJFMYVL44btHb6vxmxeSrjBXzony29cDU88yoL7k xPBY7hG0IYap7GU2FRlAE4Wi8VZ3YzHyrz25zFcvavftW2Q+mBKvegoUMGlIyWyHO0px BT4NLehfCSoFgD2tGNvT8sufHgpEc59LXgr1BO9OZdZ3N6/bCTm7O2rV86u8/fPYXah3 9ht6YqQekX+GEuRAwRbPkfZggQMN7P3EUndLa4U/SyXJ9VaXGFY80YF2/ucSdYEBSvqC bCYQ== X-Gm-Message-State: AOAM533AeVQ6wHh4NJmUDbM5QPohKDh8nJOyne66xBmMhivaKVswMyVw zhGwa29Vqch9D+rt8NUW68+w3RcadYjM7FDR+QIwrjJ1 X-Received: by 2002:a37:4041:: with SMTP id n62mr12617004qka.225.1634351355936; Fri, 15 Oct 2021 19:29:15 -0700 (PDT) MIME-Version: 1.0 References: <1634278529-16983-1-git-send-email-huangzhaoyang@gmail.com> <20211015130035.aacc18a4d1ee141b306c2272@linux-foundation.org> In-Reply-To: <20211015130035.aacc18a4d1ee141b306c2272@linux-foundation.org> From: Zhaoyang Huang Date: Sat, 16 Oct 2021 10:28:54 +0800 Message-ID: Subject: Re: [PATCH] mm: skip current when memcg reclaim To: Andrew Morton Cc: Johannes Weiner , Michal Hocko , 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 Sat, Oct 16, 2021 at 4:00 AM Andrew Morton wrote: > > On Fri, 15 Oct 2021 14:15:29 +0800 Huangzhaoyang wrote: > > > From: Zhaoyang Huang > > > > Sibling thread of the same process could refault the reclaimed pages > > in the same time, which would be typical in None global reclaim and > > introduce thrashing. > > "None" -> "node", I assume? > > > --- a/mm/vmscan.c > > +++ b/mm/vmscan.c > > @@ -2841,6 +2841,11 @@ static void shrink_node_memcgs(pg_data_t *pgdat, struct scan_control *sc) > > sc->memcg_low_skipped = 1; > > continue; > > } > > + /* > > + * Don't bother current when its memcg is below low > > + */ > > The comment explains what the code is doing, but the code itself > already does this. Please can we have a comment that explains *why* > the code is doing this? We find that the patch help direct reclaiming bail out early and eliminate page thrashing for some scenarios(etc APP start on android). The case could be worse if each APP possess a unique memcg(pages on current's lru are reclaimed more than global reclaim) > > > > + if (get_mem_cgroup_from_mm(current->mm) == memcg) > > + continue; > > memcg_memory_event(memcg, MEMCG_LOW); > > } >