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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CF90DC433F5 for ; Mon, 15 Nov 2021 13:50:10 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 5B40261A40 for ; Mon, 15 Nov 2021 13:50:10 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 5B40261A40 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 AA2E46B0078; Mon, 15 Nov 2021 08:50:09 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id A52C26B007D; Mon, 15 Nov 2021 08:50:09 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8F2AB6B007E; Mon, 15 Nov 2021 08:50:09 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0240.hostedemail.com [216.40.44.240]) by kanga.kvack.org (Postfix) with ESMTP id 8122B6B0078 for ; Mon, 15 Nov 2021 08:50:09 -0500 (EST) Received: from smtpin03.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 367B71809C071 for ; Mon, 15 Nov 2021 13:50:09 +0000 (UTC) X-FDA: 78811298538.03.C47CC24 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf17.hostedemail.com (Postfix) with ESMTP id B900AF0003B5 for ; Mon, 15 Nov 2021 13:50:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1636984208; 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=wKxkeDUfwxQx13XQZaRduws4du0bmSnfXtJrXN7mSsk=; b=DQwHYX37Z7ra1UUZ/d7zGZ20phDEdo7Exkc8K9iYCveNlARwBfDza+Cr/JSPAsvlGZuyu9 MFaeNMMORNDEigcxXDh6f85v9fVtTN3sXawKifEsPHHrkK/Jm7vjKnCs/HXgEsbu5Ftv88 vFBz0GRNClHerYbc3Qj/AfsI8DtsHc0= Received: from mail-pj1-f71.google.com (mail-pj1-f71.google.com [209.85.216.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-556-MT9T6MbqO0WnMddWXVGwKw-1; Mon, 15 Nov 2021 08:50:06 -0500 X-MC-Unique: MT9T6MbqO0WnMddWXVGwKw-1 Received: by mail-pj1-f71.google.com with SMTP id bf17-20020a17090b0b1100b001a634dbd737so8624005pjb.9 for ; Mon, 15 Nov 2021 05:50:06 -0800 (PST) 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=wKxkeDUfwxQx13XQZaRduws4du0bmSnfXtJrXN7mSsk=; b=BebRSA7Z+oYbMozMwEpA9FpDWm/aemnxRKfIxhuF+ezp/sYaI4ycAmk90WZ5G+eAm5 a1oqL3XS5zjKRNS9323kKykCidFe1LNtChyLLwThITiTJHYbeNhKLad8FZ8BCYv2Imkn 8A60JPvt0BwKOpEj02WH0mlDR+NrPlRdSxWkPN3/mnYLuMkdt7tG84+ZU+dhhvxu/fYx oGhV1i9rJNBj382Jh4300yh1/B0V+sUvXMNMvIJGZZLQ/IWxYjnLNBITC4W2LyKzIBMj DIO1tzAkyVMxsne6ofYft9w0eywV/ZssT41C+L0WixzuRYk29ghYaBz1Y2rfk8BiSxxN 4/QA== X-Gm-Message-State: AOAM530YUSERswUZ8Os0j6CoceV/FU+MNLKHmeM2VneDowec2r2wvqca ajkJRf2bY20yAV3QUy3zpbjaArz0dlYpUNl2RVfIRD8BI93WsjfS+pqj5p0501VCMsUraYcwsR2 R5ByzzHabd0o= X-Received: by 2002:a62:924e:0:b0:4a2:82d7:1244 with SMTP id o75-20020a62924e000000b004a282d71244mr20563360pfd.50.1636984205471; Mon, 15 Nov 2021 05:50:05 -0800 (PST) X-Google-Smtp-Source: ABdhPJyv8re2/SMpKzf1Sj2CYlrHxo4P3jy1/NtL8XAykTmE1/FiqOAdQnhgBIVZTtdsbZov0yW7MA== X-Received: by 2002:a62:924e:0:b0:4a2:82d7:1244 with SMTP id o75-20020a62924e000000b004a282d71244mr20563328pfd.50.1636984205148; Mon, 15 Nov 2021 05:50:05 -0800 (PST) Received: from localhost.localdomain ([191.101.132.72]) by smtp.gmail.com with ESMTPSA id p188sm15499471pfg.102.2021.11.15.05.49.58 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 15 Nov 2021 05:50:04 -0800 (PST) From: Peter Xu To: linux-kernel@vger.kernel.org, linux-mm@kvack.org Cc: David Hildenbrand , peterx@redhat.com, Andrea Arcangeli , Yang Shi , Vlastimil Babka , Hugh Dickins , Andrew Morton , Alistair Popple , "Kirill A . Shutemov" Subject: [PATCH RFC v2 0/2] mm: Rework zap ptes on swap entries Date: Mon, 15 Nov 2021 21:49:49 +0800 Message-Id: <20211115134951.85286-1-peterx@redhat.com> X-Mailer: git-send-email 2.32.0 MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: B900AF0003B5 X-Stat-Signature: 6ydc3q6d8hs8ipbiexunqaowk7mzgsgn Authentication-Results: imf17.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=DQwHYX37; spf=none (imf17.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-HE-Tag: 1636984208-685774 Content-Transfer-Encoding: quoted-printable 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: v2: - Resend to rebase to tag v5.16-rc1 (fa55b7dcdc43) The goal of this small series is to replace the previous patch (which is = the 5th patch of the series): https://lore.kernel.org/linux-mm/20210908163628.215052-1-peterx@redhat.co= m/ This patch used a more aggresive (but IMHO cleaner and correct..) approac= h by removing that trick to skip swap entries, then we handle swap entries alw= ays. The behavior of "skipping swap entries" existed starting from the initial= git commit that we'll try to skip swap entries when zapping ptes if zap_detai= l pointer specified. I found that it's probably broken because of the introduction of page mig= ration mechanism that does not exist yet in the world of 1st git commit, then we= could errornously skip scanning the swap entries for file-backed memory, like s= hmem, while we should. I'm afraid we'll have RSS accounting wrong for those sh= mem pages during migration so there could have leftover SHMEM RSS accounts. Patch 1 did that removal of the trick, details in the commit message. Patch 2 is a further cleanup for zap pte swap handling that can be done a= fter patch 1, in which there's no functional change intended. The change should be on the slow path for zapping swap entries (e.g., we = handle none/present ptes in early code path always, so they're totally not affec= ted), but if anyone worries about specific workload that may be affected by thi= s patchset, please let me know and I'll be happy to run some more tests. I= could also overlook something that was buried in history, in that case please k= indly point that out. Marking the patchset RFC for this. Smoke tested only. Please review, thanks. Peter Xu (2): mm: Don't skip swap entry even if zap_details specified mm: Rework swap handling of zap_pte_range mm/memory.c | 31 ++++++++++--------------------- 1 file changed, 10 insertions(+), 21 deletions(-) --=20 2.32.0