From patchwork Fri Sep 17 16:47:53 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Xu X-Patchwork-Id: 12502817 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=-11.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT 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 08ADEC433F5 for ; Fri, 17 Sep 2021 17:29:16 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id A655D60F4A for ; Fri, 17 Sep 2021 17:29:15 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org A655D60F4A 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 319996B0072; Fri, 17 Sep 2021 13:29:15 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 2C9656B0073; Fri, 17 Sep 2021 13:29:15 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 190F66B0075; Fri, 17 Sep 2021 13:29:15 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0195.hostedemail.com [216.40.44.195]) by kanga.kvack.org (Postfix) with ESMTP id 06DB76B0072 for ; Fri, 17 Sep 2021 13:29:15 -0400 (EDT) Received: from smtpin13.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 899B48085A75 for ; Fri, 17 Sep 2021 17:29:14 +0000 (UTC) X-FDA: 78597751428.13.2EFC96C Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf28.hostedemail.com (Postfix) with ESMTP id 5E5179487A93 for ; Fri, 17 Sep 2021 16:48:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1631897280; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Pa8MHd+zhEGwg2joKcZLXbQa7nEEAjicA5Pn9RIdpts=; b=PTsNkFwQIZnGEQ5ePGkgKEgrhbMH4zK2vK3d8rozGRmy7730Mr1kDjrg9cjxgXyJspu8F1 OopnCH/gusb3pnkJSyJecEdGqvBmzWftn2aXiNnxU9cyd9eiRZzzfF8+QCDaZpghyN8tjh +DPMpTIoJkkW1EOpS7F0DdzNCVpi/Dg= Received: from mail-qt1-f199.google.com (mail-qt1-f199.google.com [209.85.160.199]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-238-22h0NM6vN1SmkRYMFVZxag-1; Fri, 17 Sep 2021 12:47:59 -0400 X-MC-Unique: 22h0NM6vN1SmkRYMFVZxag-1 Received: by mail-qt1-f199.google.com with SMTP id c21-20020ac85195000000b002a540bbf1caso40073399qtn.2 for ; Fri, 17 Sep 2021 09:47:59 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=Pa8MHd+zhEGwg2joKcZLXbQa7nEEAjicA5Pn9RIdpts=; b=t8hdPL+in1ofDuZ7tFvVY/UymsxelrJDQBz0idv2hRnBiaEXtt3GC78obfAOb2w5Mo C0X0jom8/WFoxCJKrrbE8U1ydO/zSIf7mvSCwzmxSHziRbP2pj5V4FJsX0YMm0RY/GIJ +21UVpwE5KIokRNalsdQ+nlzRO07cpO2uts7x7d3Ft07YHJRWlmFNyu5Gvey8AwgdePQ lCivaBtNzl0zS4r0AuYsnuRe5U7UI2F0pA0MIqFqp+FJuUe4DG6m45gZKXMKtd86DDaa 2OXspHcO2CzDeU5nM4lKm2jSbv2S8KGBHri8y14j9EfO5I3EiBcop4+E2jlcpZD8+LsS snPA== X-Gm-Message-State: AOAM532WXyL8u9SrBPbUtfW3LBoYqpwAt+qRjQUaGJeBxTBygfmzlWfY sbBzbmaQnq0b3lVGgljowhCL1giBVs3YvVe28cTSFqTghMwO/FleCk8omiClH7hAOKH4EjhXCiJ dJYthwhrhbU8gzZAJkjN+ejlgInFz0/3ZabD6MOOWWaMMr0qX7ZJ3iYoO/bok X-Received: by 2002:a05:6214:4d3:: with SMTP id ck19mr12105625qvb.36.1631897278670; Fri, 17 Sep 2021 09:47:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwvWa3v979LKi3hdwvp9c4fs/KF12HbNLbnT6E2cjqqBevUTq+WQmEMVQScmJCrd9d0nYou6A== X-Received: by 2002:a05:6214:4d3:: with SMTP id ck19mr12105589qvb.36.1631897278279; Fri, 17 Sep 2021 09:47:58 -0700 (PDT) Received: from t490s.phub.net.cable.rogers.com ([2607:fea8:56a2:9100::d35a]) by smtp.gmail.com with ESMTPSA id t26sm4898057qkm.0.2021.09.17.09.47.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Sep 2021 09:47:57 -0700 (PDT) From: Peter Xu To: linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: Vlastimil Babka , Andrew Morton , Hugh Dickins , Andrea Arcangeli , peterx@redhat.com, Matthew Wilcox Subject: [PATCH 0/3] mm/smaps: Fixes and optimizations on shmem swap handling Date: Fri, 17 Sep 2021 12:47:53 -0400 Message-Id: <20210917164756.8586-1-peterx@redhat.com> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Authentication-Results: imf28.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=PTsNkFwQ; spf=none (imf28.hostedemail.com: domain of peterx@redhat.com has no SPF policy when checking 170.10.133.124) smtp.mailfrom=peterx@redhat.com; dmarc=pass (policy=none) header.from=redhat.com X-Stat-Signature: qfxfgpozjdf6pdho8sf4edqi6i6aows7 X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: 5E5179487A93 X-HE-Tag: 1631897281-528678 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: This series grows from the patch previously posted here: [PATCH] mm/smaps: Use vma->vm_pgoff directly when counting partial swap https://lore.kernel.org/lkml/20210916215839.95177-1-peterx@redhat.com/ Vlastimil reported a bug that is even more important to fix than the cleanup, so I put it as patch 1 here. There's a test program we can use to verify the bug before/after the patch. I used the same program to test patch 2/3 because it covers walking shmem swap both in page cache and in pgtables. Patch 2 is the original patch, though with a tiny touchup as Vlastimil suggested. Patch 3 is a further cleanup of the shmem swap logic, hopefully make it even cleaner. Please review, thanks. Peter Xu (3): mm/smaps: Fix shmem pte hole swap calculation mm/smaps: Use vma->vm_pgoff directly when counting partial swap mm/smaps: Simplify shmem handling of pte holes fs/proc/task_mmu.c | 28 ++++++++++++++++------------ mm/shmem.c | 5 ++--- 2 files changed, 18 insertions(+), 15 deletions(-)