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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id DD2D2C433F5 for ; Tue, 10 May 2022 18:17:07 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 09A086B0072; Tue, 10 May 2022 14:17:07 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 0228C6B0073; Tue, 10 May 2022 14:17:06 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DB7206B0074; Tue, 10 May 2022 14:17:06 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id C57346B0072 for ; Tue, 10 May 2022 14:17:06 -0400 (EDT) Received: from smtpin12.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay11.hostedemail.com (Postfix) with ESMTP id 9171E817C6 for ; Tue, 10 May 2022 18:17:06 +0000 (UTC) X-FDA: 79450640052.12.0C1A41B Received: from mail-qt1-f180.google.com (mail-qt1-f180.google.com [209.85.160.180]) by imf09.hostedemail.com (Postfix) with ESMTP id 33D0714008A for ; Tue, 10 May 2022 18:16:58 +0000 (UTC) Received: by mail-qt1-f180.google.com with SMTP id y3so14171383qtn.8 for ; Tue, 10 May 2022 11:17:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cmpxchg-org.20210112.gappssmtp.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=j6VxUo8QQgucktTahfGjMnSHx49seR2VNE5VfPNoqpw=; b=AZ8FOeLYs0Ou66qeac0W+jy0+5ZasZRmYmeiVyej+xT3ycHzEWtgp+hRatbjGISWoZ W3uLF/kp7vL+Sfjeyug2wWia4wkxMJvWRv87HCIw7tK33gc73vCgsl/NtSOtWmjbZyob VBcwki3iHmsZPoaIRE5YJJJkKpfJ7VrCl7Xr+i+shLyDlFCMEAqJXnYlrvDCBsrkFhVi rJEa0btzLKYM4zLEWhRLDZbDvaVu5OUwKxt8iRZ0c7j/9qPSVqQUBnWRv6rKzE+5OcJN uZLdqJFn2knl07MWB9d3MNPa0aQA7Twpxp9KINsG5OxFhgdMsDBkxmU0KipHE89NfL9Z aRvQ== 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=j6VxUo8QQgucktTahfGjMnSHx49seR2VNE5VfPNoqpw=; b=aJ/desw4JvhDYh34w+cabGY9G4w4sMcDW4dyC8uAebdwPzU3f3zF2NMH9BrDMqXBGJ 0978sHZNVPZKACbeTTgVWqo49eq9hl6ovJX494DB615r6She6L+v/SI1KFxtQtvfExOV M0Bea9lOX0R+E7pknAHPizd+cDqu+o3E32cMJHXv4gMsdA/I0fKPPHR9aAzOhoUyqSRo u+4VinMiWE21gnilHGOlK1odQb2jkrp/rertfCOCxAcxUIOO5FefUHrXCDFed17g9DDg 7EV1PlHhlEEhZObyI4o013ik4vdsFvan1Yi3aJ69HHc7dX/5+7WuAhWDP/CkgtrIM+c9 JSlg== X-Gm-Message-State: AOAM533VJa2jS1vtJtdYzyR9Nsl9UxK0pMMbofk6LSnTuXB902q7v9gH 5f8XxEFbmXrz1x2DmemF8WyVLA== X-Google-Smtp-Source: ABdhPJz3dtPC+i3ZnJRRpdyaAU1Wjmt4AhGVlHQHl3jnllOUS6zAzRCqJaUZcXvpiJikOHbQzr09AQ== X-Received: by 2002:ac8:5745:0:b0:2f3:e231:bc12 with SMTP id 5-20020ac85745000000b002f3e231bc12mr4843122qtx.291.1652206625133; Tue, 10 May 2022 11:17:05 -0700 (PDT) Received: from localhost ([2620:10d:c091:480::1:14fe]) by smtp.gmail.com with ESMTPSA id k6-20020ac81406000000b002f39b99f69fsm9434981qtj.57.2022.05.10.11.17.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 May 2022 11:17:04 -0700 (PDT) Date: Tue, 10 May 2022 14:16:07 -0400 From: Johannes Weiner To: Minchan Kim Cc: Andrew Morton , LKML , linux-mm , Suren Baghdasaryan , Michal Hocko , John Dias , Tim Murray , Matthew Wilcox , Vladimir Davydov , Martin Liu Subject: Re: [PATCH v3] mm: don't be stuck to rmap lock on reclaim path Message-ID: References: <20220510171100.48500-1-minchan@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220510171100.48500-1-minchan@kernel.org> X-Rspam-User: X-Rspamd-Server: rspam11 X-Rspamd-Queue-Id: 33D0714008A X-Stat-Signature: g6kdgbypgtjjqoemckft6ebe1q6sryru Authentication-Results: imf09.hostedemail.com; dkim=pass header.d=cmpxchg-org.20210112.gappssmtp.com header.s=20210112 header.b=AZ8FOeLY; spf=pass (imf09.hostedemail.com: domain of hannes@cmpxchg.org designates 209.85.160.180 as permitted sender) smtp.mailfrom=hannes@cmpxchg.org; dmarc=pass (policy=none) header.from=cmpxchg.org X-HE-Tag: 1652206618-360542 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: Hi Minchan, The patch looks reasonable to me, but one thing stands out: On Tue, May 10, 2022 at 10:11:00AM -0700, Minchan Kim wrote: > @@ -1391,6 +1391,10 @@ static enum page_references folio_check_references(struct folio *folio, > if (vm_flags & VM_LOCKED) > return PAGEREF_ACTIVATE; > > + /* page_referenced didn't work due to lock contention */ > + if (referenced_ptes == -1) > + return PAGEREF_KEEP; > + > if (referenced_ptes) { > /* > * All mapped folios start out with page table This means contended inactive pages get rotated. > @@ -2492,7 +2496,7 @@ static void shrink_active_list(unsigned long nr_to_scan, > } > > if (folio_referenced(folio, 0, sc->target_mem_cgroup, > - &vm_flags)) { > + &vm_flags) > 0) { > /* > * Identify referenced, file-backed active pages and > * give them one more trip around the active list. So This means contended active pages do NOT get rotated. It's a bit of an arbitrary choice what to do with reclaim candidates for which you can get no reference information, but staying consistent is likely a good idea. My preference would be to just rotate contended pages throughout rather than risk dropping the workingset on the floor. /* Referenced or rmap lock contention: rotate */ if (folio_referenced() != 0) { ... What do you think?