Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp841479ybc; Tue, 12 Nov 2019 10:01:28 -0800 (PST) X-Google-Smtp-Source: APXvYqzOfkHif/XqcFwyktTz0mxAAsfzAMEEXmohPItpujJt7AAo6RSKsmV9AzsOMTAuktYUAODh X-Received: by 2002:a17:906:22c9:: with SMTP id q9mr29492002eja.198.1573581688115; Tue, 12 Nov 2019 10:01:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573581688; cv=none; d=google.com; s=arc-20160816; b=uLNXwqVBODXsNHxWaNKbCYtI7iMG/5xglxAyRInuhyJxAmKhhxcPB3/Mpijq8sjFdg dF8keB6zJmxZVq/3xJxzR5sEmr7fpZYFlBA8rk5rRtBu2REt24pbSHATo1egrsJsqHEP 8me5CLAA1Q2LSas4BXEL4lKeB9visYQXAx5bwvVW//vXaexOXwEdOLNEmrpiz8tkbG8A ooSwc25acM9mW8WYCbYZPwOwOJ6kRTDqLNv7Q3UNGlkWGtPynNqdlB8QF3ehzdqf5o2b 9oUV8lmF4lh1WEswMr8BueH8tLzWyrgUjddCoDhLLoHhtYft+fHE2KozhIbCaYLnzoDo M3Gg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=06+tOajz4B6gePUoYXEIPar3gvZ/gJqmbgnyOgTIPAU=; b=Vk+rp0uiNmCs91g5JvuaRsftPLpH2dst+S8nyJXPTRk1tbRfBgmmUSs19mbaLGYY2K T/SVUcI3yiWa/TgqZE0CtEpwy6LuJ0UT+Y1moc1YynvLgBvlYXnLChBjxJ4+1TPYhH2L IGgYsuTNESDnCyRhkoVGCVajP8NM2x5LeqsC0kf5Wm97GcC6DZ/25P3eCoS7wucN3bkV Wqwmk1DLZwEdkChCG9xyMzEDbK9+0AWfMBrb+t17VYc9XbCsyDJ1+HN9KwR/jQBMSf2m 5+UGMXWHjAGhYwoCHP5eRAF7PCZTMYCl1bIgAOqIEUub1NqV4IY+//clytwmcpzh6Ilv O9Zg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cmpxchg-org.20150623.gappssmtp.com header.s=20150623 header.b=ZQNd+lcn; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=cmpxchg.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s18si513026ejj.149.2019.11.12.10.01.02; Tue, 12 Nov 2019 10:01:28 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@cmpxchg-org.20150623.gappssmtp.com header.s=20150623 header.b=ZQNd+lcn; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=cmpxchg.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727257AbfKLSAW (ORCPT + 99 others); Tue, 12 Nov 2019 13:00:22 -0500 Received: from mail-qk1-f196.google.com ([209.85.222.196]:46679 "EHLO mail-qk1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727216AbfKLSAW (ORCPT ); Tue, 12 Nov 2019 13:00:22 -0500 Received: by mail-qk1-f196.google.com with SMTP id h15so15223453qka.13 for ; Tue, 12 Nov 2019 10:00:22 -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=pxzu1M6qh0ko/1EGEavFvJ+u+W/yGI/VqcWr0pyKQbkNkPjZk+4gF9Vjv4tGj2ZOBE 5VPOg4HXdQizsrPDuQCQkKC+7KfEIQlLbT3HCdzIiMjGm06ro6WhNGFsjRGiY8C4B+kh pITZM4YPeBXAFKzfZFhKScmbxeSYTG3sB9mbeI6UkKMBL/XILYCXY94qhT/yDfx0NpEK JfmenX9cUm+t7wrfXFRI52mEYbTAUCi4+M4LvOp20NDS7LylBDJ5jqUdg7YZdzdn8uFK Yq4vMXjv3w59z+dHR9s4f66YFJzKm5uESl47Y10gsopdoHqT6GBb94qKL0CEfxcrd+Mh 5IDQ== X-Gm-Message-State: APjAAAXklDjdlm4HQcNhpvXKviXhXcM8gf/ohpqn4t986+GETycYR8oN Knu6jzTIOn585DXRoiGpOml0Ew== 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) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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.