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 X-Spam-Level: X-Spam-Status: No, score=-2.2 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 97059C17440 for ; Tue, 12 Nov 2019 18:00:25 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 5997321925 for ; Tue, 12 Nov 2019 18:00:24 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=cmpxchg-org.20150623.gappssmtp.com header.i=@cmpxchg-org.20150623.gappssmtp.com header.b="ZQNd+lcn" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5997321925 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=cmpxchg.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id E7BF56B000A; Tue, 12 Nov 2019 13:00:23 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id E2B7C6B000E; Tue, 12 Nov 2019 13:00:23 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D1A796B0269; Tue, 12 Nov 2019 13:00:23 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0123.hostedemail.com [216.40.44.123]) by kanga.kvack.org (Postfix) with ESMTP id BD4EA6B000A for ; Tue, 12 Nov 2019 13:00:23 -0500 (EST) Received: from smtpin14.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with SMTP id 729B952A4 for ; Tue, 12 Nov 2019 18:00:23 +0000 (UTC) X-FDA: 76148389926.14.crib81_5a9219786b40a X-HE-Tag: crib81_5a9219786b40a X-Filterd-Recvd-Size: 6359 Received: from mail-qk1-f196.google.com (mail-qk1-f196.google.com [209.85.222.196]) by imf12.hostedemail.com (Postfix) with ESMTP for ; Tue, 12 Nov 2019 18:00:22 +0000 (UTC) Received: by mail-qk1-f196.google.com with SMTP id 15so15260351qkh.6 for ; Tue, 12 Nov 2019 10:00:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cmpxchg-org.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=06+tOajz4B6gePUoYXEIPar3gvZ/gJqmbgnyOgTIPAU=; b=ZQNd+lcnkEIXb4CIVCUUvF0shtw2ailj89aCGb0NVz9uUKnnUYfYju6n2m5EPh9upa xxaH1JcRBZS05oi4qgAdE9Vtn1wbsYAsKC91Sa6KV3uU4jVyzCQ3msh6LHd8K20oyOX0 b17taRXMabKP1dKvpzPw8zj8rrahWqzoza8Hhs5SxQ9/qffyLciJXEv3mXIZGv7LIsyy 4ZR8FFIzTj7jW98nE7yYeYihDbvKD1xx5IxxVB2F/h2kqtc+KomQ916B3tFlQqQWbqF6 4k2QurV0KK7G4oJIbvG/LBxRoivl/07+p7Hc0GGnYJ5zip5Xet/r7DWNRmncK6lJF+MA WGOQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=06+tOajz4B6gePUoYXEIPar3gvZ/gJqmbgnyOgTIPAU=; b=U2xjwr33hqVBvno8kZoLeuWFdK39jXMKynQVS+M5t9PqwtKSvpXWuTn6773WBEdQrv 2vZP82OHqY4lpV7zTID2MeJkFrbUyea/Be/JKY9S5KyTp/HFBAIAB9uqPriz/Qe4yp21 XhcWA9CG9r2T221MxXbV3VlJqltEAfQRgUMKQoiCgJO2i7y0LwkOZlB4jrFxEadaR2Kg 4ex3Q5ppNF4SOynU7Hs5qQgWuGOJvtDfNj8maCfo8CKBK6amFBW5zyYnLzsbI0fGcCAg oIbWhdwcJ2ErcTZIgXXgh/zc16Bbjo7qKpjnlXp53kUa3D9V7C4P7UDbyfKToXxO6zSR Mjug== X-Gm-Message-State: APjAAAWGnGsWvwEwXoLpjmZ49yxlLauiLnJ9La+f7gvEYvYD7qDRhJSC 2JwdxLdUK7nvgS2MyV3ITbkc4w== X-Google-Smtp-Source: APXvYqxiYDIXtP651b4dXQUD1iQi7esDhbrkhOiZeP1WHRH8UaDSfzUtY9f7q2nHOmwq7dnCKDPp9Q== X-Received: by 2002:a37:a54c:: with SMTP id o73mr17251660qke.164.1573581621282; Tue, 12 Nov 2019 10:00:21 -0800 (PST) Received: from localhost ([2620:10d:c091:500::aa8c]) by smtp.gmail.com with ESMTPSA id u22sm9769196qtb.59.2019.11.12.10.00.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Nov 2019 10:00:20 -0800 (PST) Date: Tue, 12 Nov 2019 13:00:19 -0500 From: Johannes Weiner To: Suren Baghdasaryan Cc: Andrew Morton , Andrey Ryabinin , Shakeel Butt , Rik van Riel , Michal Hocko , linux-mm , cgroups mailinglist , LKML , kernel-team@fb.com Subject: Re: [PATCH 3/3] mm: vmscan: enforce inactive:active ratio at the reclaim root Message-ID: <20191112180019.GB178331@cmpxchg.org> References: <20191107205334.158354-1-hannes@cmpxchg.org> <20191107205334.158354-4-hannes@cmpxchg.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.12.2 (2019-09-21) X-Bogosity: Ham, tests=bogofilter, spamicity=0.000211, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Sun, Nov 10, 2019 at 06:15:50PM -0800, Suren Baghdasaryan wrote: > On Thu, Nov 7, 2019 at 12:53 PM Johannes Weiner wrote: > > @@ -2758,7 +2775,17 @@ static bool shrink_node(pg_data_t *pgdat, struct scan_control *sc) > > total_high_wmark += high_wmark_pages(zone); > > } > > > > - sc->file_is_tiny = file + free <= total_high_wmark; > > + /* > > + * Consider anon: if that's low too, this isn't a > > + * runaway file reclaim problem, but rather just > > + * extreme pressure. Reclaim as per usual then. > > + */ > > + anon = node_page_state(pgdat, NR_INACTIVE_ANON); > > + > > + sc->file_is_tiny = > > + file + free <= total_high_wmark && > > + !(sc->may_deactivate & DEACTIVATE_ANON) && > > + anon >> sc->priority; > > The name of file_is_tiny flag seems to not correspond with its actual > semantics anymore. Maybe rename it into "skip_file"? I'm not a fan of file_is_tiny, but I also don't like skip_file. IMO it's better to have it describe a situation instead of an action, in case we later want to take additional action for that situation. Any other ideas? ;) > I'm confused about why !(sc->may_deactivate & DEACTIVATE_ANON) should > be a prerequisite for skipping file LRU reclaim. IIUC this means we > will skip reclaiming from file LRU only when anonymous page > deactivation is not allowed. Could you please add a comment explaining > this? The comment above this check tries to explain it: the definition of file being "tiny" is dependent on the availability of anon. It's a relative comparison. If file only has a few pages, and anon is easily reclaimable (does not require deactivation to reclaim pages), then file is "tiny" and we should go after the more plentiful anon pages. If anon is under duress, too, this preference doesn't make sense and we should just reclaim both lists equally, as per usual. Note that I'm not introducing this constraint, I'm just changing how it's implemented. From the patch: > > /* > > * If the system is almost out of file pages, force-scan anon. > > - * But only if there are enough inactive anonymous pages on > > - * the LRU. Otherwise, the small LRU gets thrashed. > > */ > > - if (sc->file_is_tiny && > > - !inactive_list_is_low(lruvec, false, sc, false) && > > - lruvec_lru_size(lruvec, LRU_INACTIVE_ANON, > > - sc->reclaim_idx) >> sc->priority) { > > + if (sc->file_is_tiny) { > > scan_balance = SCAN_ANON; > > goto out; > > } So it's always been checking whether reclaim would deactivate anon, and whether inactive_anon has sufficient pages for this priority.