Message ID | 20230404120117.2562166-1-stevensd@google.com (mailing list archive) |
---|---|
Headers | show
Return-Path: <owner-linux-mm@kvack.org> 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 AB15CC761A6 for <linux-mm@archiver.kernel.org>; Tue, 4 Apr 2023 12:01:30 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0015A6B0071; Tue, 4 Apr 2023 08:01:30 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id EF4C16B0072; Tue, 4 Apr 2023 08:01:29 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D951D6B0074; Tue, 4 Apr 2023 08:01:29 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id C507E6B0071 for <linux-mm@kvack.org>; Tue, 4 Apr 2023 08:01:29 -0400 (EDT) Received: from smtpin03.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 8FC65AC384 for <linux-mm@kvack.org>; Tue, 4 Apr 2023 12:01:29 +0000 (UTC) X-FDA: 80643568698.03.D1037DC Received: from mail-pf1-f170.google.com (mail-pf1-f170.google.com [209.85.210.170]) by imf17.hostedemail.com (Postfix) with ESMTP id 55B5A40031 for <linux-mm@kvack.org>; Tue, 4 Apr 2023 12:01:26 +0000 (UTC) Authentication-Results: imf17.hostedemail.com; dkim=pass header.d=chromium.org header.s=google header.b=C3IHbT9a; spf=pass (imf17.hostedemail.com: domain of stevensd@chromium.org designates 209.85.210.170 as permitted sender) smtp.mailfrom=stevensd@chromium.org; dmarc=pass (policy=none) header.from=chromium.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1680609686; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:references:dkim-signature; bh=JFM6Zed11abmlBVD7n880cLrXrOUp4BMMkatUFd1HS4=; b=Acsm7idazW/3usEa8i13KuMIQXsikJkI45ajFHSvt9ky347aCBAXmpFmxPZyXS7tWKjIYu mwJASFQgNLO2x23TKIh+v2zscY4Io/8wZBERZMiC0CMXfG3KdyanEOuoXe2xm1zuRFlurS fBn8qjHajmfapeFPdUEyM1oNUEhscUM= ARC-Authentication-Results: i=1; imf17.hostedemail.com; dkim=pass header.d=chromium.org header.s=google header.b=C3IHbT9a; spf=pass (imf17.hostedemail.com: domain of stevensd@chromium.org designates 209.85.210.170 as permitted sender) smtp.mailfrom=stevensd@chromium.org; dmarc=pass (policy=none) header.from=chromium.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1680609686; a=rsa-sha256; cv=none; b=Goy0vcc4gp21UpzjCFHGcBhjgbnqBSq6ElgXGUUm+Bwtz6Visk18ScZ6RSHBZcdOYv1MvI F0pvXzh306AoY1G+Ya9DtpPL/ck+dFcYdvqeAVgp3B97jvOLGxV6+MqOFMO4leea8ZUIWG cgoDDQIx21welnlIqA2qmn81HJXyvZo= Received: by mail-pf1-f170.google.com with SMTP id ce4so8260265pfb.1 for <linux-mm@kvack.org>; Tue, 04 Apr 2023 05:01:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1680609684; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=JFM6Zed11abmlBVD7n880cLrXrOUp4BMMkatUFd1HS4=; b=C3IHbT9a4dE1N/jaGCLtN3lKrMYD4nnS5UX6sAc6hfVHSVColH2cqvozCtO13/mbsu juY/nqUHLi/YDIQDqQioRnAZpFo64dTqxG7SxjbkPxUMfUc2I170GQlfhNqcR8l+zudk lfooWs7aODyvSG5du4yamkq9tEFjfIyyLmkW0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680609684; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=JFM6Zed11abmlBVD7n880cLrXrOUp4BMMkatUFd1HS4=; b=M09GWikbph7xsqzruRpsQwyW7+XYfa+9NIMP3Yvx9Vimy1mbLtT/e8pmYCpDR2OHpw 9c7yKRJzh2RzxjeUYlqzg7sF9Ezj9Xtd65R1w6YB3Imv0v1DYYfiyW8nvQZ4AHHaJRtH OTReapbZ4/ah5XARiHmNkrFWH9TqBMf1WtyyaMXlvLmcxKyzbWEqpYXTle56Iatww+zu MobCHYt2ZW3nufN5or2WyrZGDe777fADOQKqfwQ3gHWPLqMz5UuFKK1jKQ01MqT1A8IC 16zzhzldU7hNrxsgRlwWPYFfXAWjxICybOaBnopi1qlfa9nqN48BxW+fM4lVIW3PA9AK HA9Q== X-Gm-Message-State: AAQBX9fj36gGJW+JDQry5ofxekRH3CAl3NFHhx7l7KXHwQieUwk7eLv0 VBoFPR+8nd60HfJKggjHeLYeAuQJYhM3zl61xUY= X-Google-Smtp-Source: AKy350ZCcY3HX/mt7wXQZeGj97V6L7bBWjmnqXMIXPCVdC61pts3cVJwKCkX/w34d5NYlLxrb5OLyg== X-Received: by 2002:aa7:9a0c:0:b0:627:e342:7f0e with SMTP id w12-20020aa79a0c000000b00627e3427f0emr2078573pfj.30.1680609684479; Tue, 04 Apr 2023 05:01:24 -0700 (PDT) Received: from localhost ([2401:fa00:8f:203:959b:21ea:166b:c273]) by smtp.gmail.com with UTF8SMTPSA id a5-20020aa78645000000b00627f054a3cdsm8688028pfo.31.2023.04.04.05.01.21 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 04 Apr 2023 05:01:24 -0700 (PDT) From: David Stevens <stevensd@chromium.org> X-Google-Original-From: David Stevens <stevensd@google.com> To: linux-mm@kvack.org, Peter Xu <peterx@redhat.com>, Hugh Dickins <hughd@google.com> Cc: Andrew Morton <akpm@linux-foundation.org>, Matthew Wilcox <willy@infradead.org>, "Kirill A . Shutemov" <kirill@shutemov.name>, Yang Shi <shy828301@gmail.com>, David Hildenbrand <david@redhat.com>, Jiaqi Yan <jiaqiyan@google.com>, linux-kernel@vger.kernel.org, David Stevens <stevensd@chromium.org> Subject: [PATCH v6 0/4] mm/khugepaged: fixes for khugepaged+shmem Date: Tue, 4 Apr 2023 21:01:13 +0900 Message-Id: <20230404120117.2562166-1-stevensd@google.com> X-Mailer: git-send-email 2.40.0.348.gf938b09366-goog MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Rspam-User: X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 55B5A40031 X-Stat-Signature: um1qq9zrmypxqkoo83y3yh1dw4uktr6k X-HE-Tag: 1680609686-372413 X-HE-Meta: U2FsdGVkX18dNvuHvPDtxJckDNvIVahjlUmiPdpQaweoEfPYLxcKg2BnpwaojgmyWCsxwROiXjapN0+zmAB7vuIgKBvXYsDG4GVrN76ukB10UiydlpXQ3Ux6KlAPQe1cmXzECnXj5ZhIBRAC6fKL1TrKZZylGk5N2tsSNZcbIYxtJ3Hvo3ukmHqRBeoleMgPOMYMTQln0SJm6lqG/bBbAq1fw1771zV9zOP0oT4sq06aDRXlyQfISjnhCh9707dFe5LBfhBK/nJvMe4ShlH/IgjnMkLy+VRtIOg0aVXfEP02VQ67MpG+1xYCedyuXEZCKmF6jI2gkGLNtQYI4M3nM+KxuMPp+9lyeNnbiRfQhYgDkZ8TEcbgGoLFJGIeSOW3LnzJ8BAVX1A5MnE1XlDhSqoNiwNDY0e6T1PMKee77Ma4H/GvWWgyBizD1HdlNB2JM+nNIXo79yrZB8B2xoWkyoQstowEGm018FMXnxdGiMi5pw5r08lIEFFEXC7+29WdpmE5M53/gaEERvNnm6q9NhH2MsOu36u3HgyAxvOKNGcfNZgaGP4s1S/Y8X+D/LvqLAgXXbP8Hqkx/vhRp3svLLg90RVwWP4q9ZCd1/VZcHCv5f7gYhyFLxexN5RI470KrgMtXOr2oqONObAkQU4PmT3Js9sCbMxGP2PQskOhMAsDkiw5Rp5h3TP9PyP80ujYbSmH/wPe4qroZxcW3nQtDjQqwN6d2J3ae8a9dokCMcR5kXAvfI3yWRXvgWlCUjL5Rj+gsGGnEGwvBQFbCUnuFHYGBA1q3gvl0RTop5pgbDOG1VNHk5l7+hOWNm2igpG3uc44ee4iZLPHBi2aDja0vCZgNW441ezKb+VsTLRq34da7kwA0Z4uIo6S8yHzO8cvBn83v7oaANsfTmwa2MwkGJ8DTCiLDIcZqu7NXrppXg6gsTVI5X/2kYx/9+IM0wnBMNUxrAwWs1Yv/YeW/v+ TrHe2gT3 PZGV7SoC1ZpF07iJyErYOqkCHN4ZbX8dodGtqnOCKyXHYG4gXJ22XP5Ixcwz98Z1ZHNWNrxeB+99kc3wVAnhdh6XrdHnlsNVLOF7RZQK49OI/gahBjHbwayx5qevgqcB3kpSAaoZIAhwq/E9S6VXmm7IzGh2IKVQiqkJ0FDfy8fcBkad372JhuFS3MIdnGmWTjXOZdumINaFdHpkNocXI+QvskIvGSaNphbEsvb0Y65pQgXIUQFGe6037lTMXV76qrUbKssHSSReKCVBe0caPLPh3MJN02BlpVMkkR/K4Ve/peY+GnPdcc7F4rHE9fDmlpm75GXIz52hYMKgi9ETZuJaOyIdPeIB77XhJ 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: <linux-mm.kvack.org> |
Series | mm/khugepaged: fixes for khugepaged+shmem | expand |
From: David Stevens <stevensd@chromium.org> This series reworks collapse_file so that the intermediate state of the collapse does not leak out of collapse_file. Although this makes collapse_file a bit more complicated, it means that the rest of the kernel doesn't have to deal with the unusual state. This directly fixes races with both lseek and mincore. This series also fixes the fact that khugepaged completely breaks userfaultfd+shmem. The rework of collapse_file provides a convenient place to check for registered userfaultfds without making the shmem userfaultfd implementation care about khugepaged. Finally, this series adds a lru_add_drain after swapping in shmem pages, which makes the subsequent folio_isolate_lru significantly more likely to succeed. v5 -> v6: - Stop freezing the old pages so that we don't deadlock with mc_handle_file_pte and mincore. - Add missing locking around shmem charge rollback. - Rebase on mm-unstable (f01f73d64cb5). Beyond straightfoward conflicts, this involves adapting the fix for f520a742287e (i.e. an unhandled ENOMEM). - Fix bug with bounds used with vma_interval_tree_foreach. - Add a patch doing lru_add_drain after swapping in the shmem case. - Update/clarify some comments. - Drop ack on final patch v4 -> v5: - Rebase on mm-unstable (9caa15b8a499) - Gather acks v3 -> v4: - Base changes on mm-everything (fba720cb4dc0) - Add patch to refactor error handling control flow in collapse_file - Rebase userfaultfd patch with no significant logic changes - Different approach for fixing lseek race v2 -> v3: - Use XA_RETRY_ENTRY to synchronize with reads from the page cache under the RCU read lock in userfaultfd fix - Add patch to fix lseek race v1 -> v2: - Different approach for userfaultfd fix *** BLURB HERE *** David Stevens (4): mm/khugepaged: drain lru after swapping in shmem mm/khugepaged: refactor collapse_file control flow mm/khugepaged: skip shmem with userfaultfd mm/khugepaged: maintain page cache uptodate flag include/trace/events/huge_memory.h | 3 +- mm/khugepaged.c | 312 ++++++++++++++++------------- 2 files changed, 171 insertions(+), 144 deletions(-)