From patchwork Fri Aug 6 23:17:01 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nico Pache X-Patchwork-Id: 12424041 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=-13.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham 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 2DDCBC4338F for ; Fri, 6 Aug 2021 23:17:20 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id A25EA61164 for ; Fri, 6 Aug 2021 23:17:19 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org A25EA61164 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id D981F6B006C; Fri, 6 Aug 2021 19:17:18 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D47206B0071; Fri, 6 Aug 2021 19:17:18 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C5C788D0001; Fri, 6 Aug 2021 19:17:18 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0081.hostedemail.com [216.40.44.81]) by kanga.kvack.org (Postfix) with ESMTP id AF7FC6B006C for ; Fri, 6 Aug 2021 19:17:18 -0400 (EDT) Received: from smtpin04.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 494F720BEC for ; Fri, 6 Aug 2021 23:17:18 +0000 (UTC) X-FDA: 78446218956.04.96A7A4F Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by imf27.hostedemail.com (Postfix) with ESMTP id B8B82700AD8D for ; Fri, 6 Aug 2021 23:17:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1628291837; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=urXKghAkbZjB19v31crqZ4VAMAydVfXFWVlADbbPtq4=; b=DyyaZ/p/ZVXb7FTSlewg4TL+SmuT45c1iCCw4bRZmvSBg4O2SEBcX8R/7ecUtLJ+AnoQBP +eMr8q37zdDK/sd+ghG/z/arkJ0rujIYTDc8qOih8SZBYqG3njo10ocX6d01PtT01rq9MT nYZmDGCHE3TI8gVo2yGT1lrp4D8zCbU= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-11-lVCxEWZHPV-E6Uy-3RROZA-1; Fri, 06 Aug 2021 19:17:16 -0400 X-MC-Unique: lVCxEWZHPV-E6Uy-3RROZA-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id AA565801AE7; Fri, 6 Aug 2021 23:17:14 +0000 (UTC) Received: from localhost.localdomain.com (unknown [10.22.9.14]) by smtp.corp.redhat.com (Postfix) with ESMTP id DC2CC5D6AB; Fri, 6 Aug 2021 23:17:09 +0000 (UTC) From: Nico Pache To: linux-mm@kvack.org, akpm@linux-foundation.org, linux-kernel@vger.kernel.org Cc: hannes@cmpxchg.org, npache@redhat.com, aquini@redhat.com Subject: [PATCH] vm_swappiness=0 should still try to avoid swapping anon memory Date: Fri, 6 Aug 2021 19:17:01 -0400 Message-Id: <20210806231701.106980-1-npache@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b="DyyaZ/p/"; dmarc=pass (policy=none) header.from=redhat.com; spf=none (imf27.hostedemail.com: domain of npache@redhat.com has no SPF policy when checking 216.205.24.124) smtp.mailfrom=npache@redhat.com X-Stat-Signature: cet75tape3dxpbwtjajrgm34kwdsyzmx X-Rspamd-Queue-Id: B8B82700AD8D X-Rspamd-Server: rspam01 X-HE-Tag: 1628291837-877910 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Since commit b91ac374346b ("mm: vmscan: enforce inactive:active ratio at the reclaim root") swappiness can start prematurely swapping anon memory. This is due to the assumption that refaulting anon should always allow the shrinker to target anon memory. Add a check for vm_swappiness being >0 before indiscriminately targeting Anon. Signed-off-by: Nico Pache --- mm/vmscan.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mm/vmscan.c b/mm/vmscan.c index 4620df62f0ff..8b932ff72e37 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -2909,8 +2909,8 @@ static void shrink_node(pg_data_t *pgdat, struct scan_control *sc) refaults = lruvec_page_state(target_lruvec, WORKINGSET_ACTIVATE_ANON); - if (refaults != target_lruvec->refaults[0] || - inactive_is_low(target_lruvec, LRU_INACTIVE_ANON)) + if (vm_swappiness && (refaults != target_lruvec->refaults[0] || + inactive_is_low(target_lruvec, LRU_INACTIVE_ANON))) sc->may_deactivate |= DEACTIVATE_ANON; else sc->may_deactivate &= ~DEACTIVATE_ANON;