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=-6.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED 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 57169C55178 for ; Thu, 5 Nov 2020 16:03:32 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 89F5420786 for ; Thu, 5 Nov 2020 16:03:31 +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="o6eQCtym" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 89F5420786 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 BAB516B0130; Thu, 5 Nov 2020 11:03:30 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id B342C6B0134; Thu, 5 Nov 2020 11:03:30 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9FB526B0137; Thu, 5 Nov 2020 11:03:30 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0144.hostedemail.com [216.40.44.144]) by kanga.kvack.org (Postfix) with ESMTP id 69F126B0130 for ; Thu, 5 Nov 2020 11:03:30 -0500 (EST) Received: from smtpin26.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 08579181AC9C6 for ; Thu, 5 Nov 2020 16:03:30 +0000 (UTC) X-FDA: 77450834580.26.train35_48086e5272cb Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin26.hostedemail.com (Postfix) with ESMTP id 391EE1804A314 for ; Thu, 5 Nov 2020 16:03:23 +0000 (UTC) X-HE-Tag: train35_48086e5272cb X-Filterd-Recvd-Size: 4498 Received: from mail-qk1-f194.google.com (mail-qk1-f194.google.com [209.85.222.194]) by imf50.hostedemail.com (Postfix) with ESMTP for ; Thu, 5 Nov 2020 16:03:22 +0000 (UTC) Received: by mail-qk1-f194.google.com with SMTP id c27so1596014qko.10 for ; Thu, 05 Nov 2020 08:03: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; bh=o8sMzOkuVIKSSynXxhymn5UNvyr2Xt2G2oYLu65q+w0=; b=o6eQCtymAbLJ9k8MEolD6+v4cJheRMpNSLY/KM9ynEo1dkyFF8ujnDK/UiiIwxg101 I11o04f0LoZgCqasTnyOADdN6Ex9PtUfh5GEHaDWJWoU/x5Y5I+k05MRX8gmGfjDw3Al AfCtocIdzeWKNWWvocWyhm5kS2s7roEUGpX10nYQiPyj1xxi2Gn6AaUeTEnk4wb+hjyp zC3kgsH12qYoLCFCqhqa42BGspBJISTBB5haijzoRk0gtCUUonJZKcyw5bxDWngGvGqv 5OA/AGzbpgRMkjDqrwVTcbG5HBhTehWx1RchRs8TBaa+NajucjybummSft2/CMEZj4hU HQLw== 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; bh=o8sMzOkuVIKSSynXxhymn5UNvyr2Xt2G2oYLu65q+w0=; b=RMGaWHg3RRWGiQzy49KksMge+cO1itLNtUvAUcqTgmrCnp3UnTzF0NEJg9voCxVELK ZXADhhvjOLbAuvEvWCKE/jRINEbydGA93ofsb3f/7wNvyXl5dBuJj8vqZsOwYzRQQLk2 JHxCPs2FZ/8CgjEkHmhJ9CcnOwTZRufjp/DRN91ZjAXxC6o/A7YxbWwznS1FsU09sgBW nECfsISg5J4NwUB7juYRwANNwuO1dpWua778j/0zqAYvlyY8+PWGzsjnpCLuJcfIoJzU f+xBKbQXH+5+zMBnN3Fe9BUloFx2eTfIuC/hoh1vGIjMfCcz0PbS6hawOGyr4M9eOneg 9lsg== X-Gm-Message-State: AOAM532RZMyLOiy4YIGPcVWYg8Q/rn8rUpJve9hOaxfBCwHNk2hWN33P i4qavyypCaCBhJ7OzjuVZthZWQ== X-Google-Smtp-Source: ABdhPJy/MHkUw7vIpAC/f5YRU6V+AJHo7ERjGFnF2pRn8BKOyYjV9tec9pYIvMNQtaoawZEqN+aaeQ== X-Received: by 2002:a37:7e82:: with SMTP id z124mr2674936qkc.107.1604592201652; Thu, 05 Nov 2020 08:03:21 -0800 (PST) Received: from localhost ([2620:10d:c091:480::1:fc05]) by smtp.gmail.com with ESMTPSA id w45sm1187599qtw.96.2020.11.05.08.03.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Nov 2020 08:03:20 -0800 (PST) Date: Thu, 5 Nov 2020 11:01:35 -0500 From: Johannes Weiner To: Shakeel Butt Cc: Hugh Dickins , Jerome Glisse , Andrew Morton , Vlastimil Babka , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] mm/rmap: always do TTU_IGNORE_ACCESS Message-ID: <20201105160135.GF744831@cmpxchg.org> References: <20201104231928.1494083-1-shakeelb@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201104231928.1494083-1-shakeelb@google.com> 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: On Wed, Nov 04, 2020 at 03:19:28PM -0800, Shakeel Butt wrote: > Since the commit 369ea8242c0f ("mm/rmap: update to new mmu_notifier > semantic v2"), the code to check the secondary MMU's page table access > bit is broken for !(TTU_IGNORE_ACCESS) because the page is unmapped from > the secondary MMU's page table before the check. More specifically for > those secondary MMUs which unmap the memory in > mmu_notifier_invalidate_range_start() like kvm. > > However memory reclaim is the only user of !(TTU_IGNORE_ACCESS) or the > absence of TTU_IGNORE_ACCESS and it explicitly performs the page table > access check before trying to unmap the page. So, at worst the reclaim > will miss accesses in a very short window if we remove page table access > check in unmapping code. We also miss accesses that happen right after the unmap :-) Seems completely fine to make page_referenced() the time of last call. > There is an unintented consequence of !(TTU_IGNORE_ACCESS) for the memcg > reclaim. From memcg reclaim the page_referenced() only account the > accesses from the processes which are in the same memcg of the target > page but the unmapping code is considering accesses from all the > processes, so, decreasing the effectiveness of memcg reclaim. > > The simplest solution is to always assume TTU_IGNORE_ACCESS in unmapping > code. > > Signed-off-by: Shakeel Butt Acked-by: Johannes Weiner