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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E6FAEC433EF for ; Fri, 7 Jan 2022 23:37:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=vdktG00bnqRR+f8TS83Zz8nubHJ+eBD7t8EZqyX1yWs=; b=ZAxI4csgOc0jS3 6kVMqXXHypcuy4+kTg58O6q1IDF1v9UfrTUf+NgdKxilDmwvrxOTMZsdYaYc+UpXrQRNbFpQZgdZV HQaOtLA7zp6hkd+goFSsD/EcbmmvKkz3PPmnSLOA11MHAt6lP8eGugAwne42lndMqBCtuvDDJzfXJ Arlu+3LhKte7Lj4sLot6KVBV9Lhqo1Fc/cmYEzK0adm0x8wuwzvqeDds5lhmW2mihfPmmqkSAzwFZ 5tFUM2pmtE8/JMbaOVmE+rhMNoycZlDb/aZWW0MTEz0LfbZoIRu1MkrbH6dO/bLRW+0AJOgxFw93j W1h0+2o9k3CU1nmj6XZw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1n5ymY-005W01-2k; Fri, 07 Jan 2022 23:36:26 +0000 Received: from mail-io1-xd2f.google.com ([2607:f8b0:4864:20::d2f]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1n5ymR-005Vxh-MU for linux-arm-kernel@lists.infradead.org; Fri, 07 Jan 2022 23:36:24 +0000 Received: by mail-io1-xd2f.google.com with SMTP id y11so9061967iod.6 for ; Fri, 07 Jan 2022 15:36:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=xYu9qteuFVNrHyo1i7aEmcfHOTj3gefz8I1p+xu99cE=; b=KVMWEcwAp4WTr2X5uSFAYSIb1gUJnxmuasFdE3TRGGuc9UPxRC1uEOaA//819Vna+R e9pELwJ72UnnP7NVDJw7XrozwhzL7wNV4H0GV2T4b8gpxk7axMm4pExfS9/MaG3i6JGJ Z8S4aOFzx5B381qYvSPzTu5BJTrmtIv1ta/fUPycwLNiPf1Pym5MuhqHYhl89EwEfffD dxpEejJr/Qlyh1TY1lKhv+BBjEtQhaYJFnqsK8x+2h5JwQlcsGqV/YIBJPMCubPsaWsX q8NP4iA/07CScovcAUk4KMBQ/aNkFtrHYjB2enZvlLociLWQWb9+rmYQARL8qQ7iRn6D eAaA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=xYu9qteuFVNrHyo1i7aEmcfHOTj3gefz8I1p+xu99cE=; b=dCCei/jj2LwvTX5DOLXjIOXCw5lrbICMU7cfrboE44o2JFHs6avnu3AXxF04fSTquX mJuTMp/hOEObix+KiJ4+e6aALlExqfyrvQOn6c419XMzi994isVIdUm4xpKGlLPRpoRk IipNsBVlqFuuAAwu/djZSrs+XfqNGf9Tjgd9l9QolpWE6cXBTQuTMAjLho6ydKEGogsR cuD5L+zdKw1Ao0lEYdWBw91petCNEjSRwoQf6OqIr4MngEMQdFnHi+MD6ytNpleWlP9C W3f/Vi4uBVmrgpvD87qn6viLXtnEmOo4t9EhiHjE0FIG+yMJjzi3jarY/ADufbbNRPAj Kq7g== X-Gm-Message-State: AOAM530ZE5TRNkb4e3x1VepnYusxqgQAMZvAeJGJTMdNrjBbZoZZ8anH wk9eyfagbRJabsKZOeoDjC9wCg== X-Google-Smtp-Source: ABdhPJzDj049VbsKt/EYYdSUgiTzJatv/z9OgEricIXR1zpNkxJjKeELDnzLfrvVCz7m4TJ/mII9Dg== X-Received: by 2002:a05:6602:1410:: with SMTP id t16mr32400729iov.160.1641598575473; Fri, 07 Jan 2022 15:36:15 -0800 (PST) Received: from google.com ([2620:15c:183:200:8b41:537d:f5d3:269c]) by smtp.gmail.com with ESMTPSA id w7sm48105ilu.27.2022.01.07.15.36.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Jan 2022 15:36:15 -0800 (PST) Date: Fri, 7 Jan 2022 16:36:11 -0700 From: Yu Zhao To: Michal Hocko Cc: Andrew Morton , Linus Torvalds , Andi Kleen , Catalin Marinas , Dave Hansen , Hillf Danton , Jens Axboe , Jesse Barnes , Johannes Weiner , Jonathan Corbet , Matthew Wilcox , Mel Gorman , Michael Larabel , Rik van Riel , Vlastimil Babka , Will Deacon , Ying Huang , linux-arm-kernel@lists.infradead.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, page-reclaim@google.com, x86@kernel.org, Konstantin Kharlamov Subject: Re: [PATCH v6 6/9] mm: multigenerational lru: aging Message-ID: References: <20220104202227.2903605-1-yuzhao@google.com> <20220104202227.2903605-7-yuzhao@google.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220107_153619_747720_ED490CFA X-CRM114-Status: GOOD ( 15.61 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Fri, Jan 07, 2022 at 02:11:29PM +0100, Michal Hocko wrote: > On Tue 04-01-22 13:22:25, Yu Zhao wrote: > [...] > > +static void lru_gen_age_node(struct pglist_data *pgdat, struct scan_control *sc) > > +{ > > + struct mem_cgroup *memcg; > > + bool success = false; > > + unsigned long min_ttl = READ_ONCE(lru_gen_min_ttl); > > + > > + VM_BUG_ON(!current_is_kswapd()); > > + > > + current->reclaim_state->mm_walk = &pgdat->mm_walk; > > + > > + memcg = mem_cgroup_iter(NULL, NULL, NULL); > > + do { > > + struct lruvec *lruvec = mem_cgroup_lruvec(memcg, pgdat); > > + > > + if (age_lruvec(lruvec, sc, min_ttl)) > > + success = true; > > + > > + cond_resched(); > > + } while ((memcg = mem_cgroup_iter(NULL, memcg, NULL))); > > + > > + if (!success && mutex_trylock(&oom_lock)) { > > + struct oom_control oc = { > > + .gfp_mask = sc->gfp_mask, > > + .order = sc->order, > > + }; > > + > > + if (!oom_reaping_in_progress()) > > + out_of_memory(&oc); > > + > > + mutex_unlock(&oom_lock); > > + } > > Why do you need to trigger oom killer from this path? Why cannot you > rely on the page allocator to do that like we do now? This is per desktop users' (repeated) requests. The can't tolerate thrashing as servers do because of UI lags; and they usually don't have fancy tools like oomd. Related discussions I saw: https://github.com/zen-kernel/zen-kernel/issues/218 https://lore.kernel.org/lkml/20101028191523.GA14972@google.com/ https://lore.kernel.org/lkml/20211213051521.21f02dd2@mail.inbox.lv/ https://lore.kernel.org/lkml/54C2C89C.8080002@gmail.com/ https://lore.kernel.org/lkml/d9802b6a-949b-b327-c4a6-3dbca485ec20@gmx.com/ >From patch 8: Personal computers ------------------ :Thrashing prevention: Write ``N`` to ``/sys/kernel/mm/lru_gen/min_ttl_ms`` to prevent the working set of ``N`` milliseconds from getting evicted. The OOM killer is invoked if this working set can't be kept in memory. Based on the average human detectable lag (~100ms), ``N=1000`` usually eliminates intolerable lags due to thrashing. Larger values like ``N=3000`` make lags less noticeable at the cost of more OOM kills. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel