From patchwork Wed Jul 7 20:13:33 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hugh Dickins X-Patchwork-Id: 12364015 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=-23.6 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_IN_DEF_DKIM_WL 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 DE574C07E95 for ; Wed, 7 Jul 2021 20:13:40 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 88ECD61CC3 for ; Wed, 7 Jul 2021 20:13:40 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 88ECD61CC3 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 445D06B0011; Wed, 7 Jul 2021 16:13:40 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 3CE786B005D; Wed, 7 Jul 2021 16:13:40 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 221B46B006C; Wed, 7 Jul 2021 16:13:40 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0110.hostedemail.com [216.40.44.110]) by kanga.kvack.org (Postfix) with ESMTP id EAB956B0011 for ; Wed, 7 Jul 2021 16:13:39 -0400 (EDT) Received: from smtpin03.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 509EF1F848 for ; Wed, 7 Jul 2021 20:13:39 +0000 (UTC) X-FDA: 78336892158.03.49C375C Received: from mail-ot1-f45.google.com (mail-ot1-f45.google.com [209.85.210.45]) by imf24.hostedemail.com (Postfix) with ESMTP id 7125DB00009F for ; Wed, 7 Jul 2021 20:13:38 +0000 (UTC) Received: by mail-ot1-f45.google.com with SMTP id 59-20020a9d0ac10000b0290462f0ab0800so3472456otq.11 for ; Wed, 07 Jul 2021 13:13:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:from:to:cc:subject:in-reply-to:message-id:references :mime-version; bh=G6BcXcovuKQX32KS++TwaxPjbkiZXZqUSnhVU2rIm8s=; b=tEoOzZ1g/YIreTbMKj6zR9yAyFeSivYOPq+hYIi/iDVJTtoF1Dx2vOc1HmT845PkjJ HVFDPmHUa2mnIjl65c316SoGWqSvWJyUHmTIFEBuFA9EJB8y0j54IiKnPm46oqAmE0UJ 7nb+3RnYxAKvlpIYin4xVMD9zayJEep6XK6OrCbBURG2UgCrgXWfTkIknWqG6TRl3mcC DMTgMDTNtXYMBJt8thR1IXs+E4mZBLCQi4Wn9mz6hGrj6++7FlJYZnTtX9bliBmrxNu4 yueKDYwBhsRbwMj3G9SUSZIz5rJ+f+UnY3xAfh9my7EdN+KYkS6Fy5LgRQqbgnWjDNjx kd6A== 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:in-reply-to:message-id :references:mime-version; bh=G6BcXcovuKQX32KS++TwaxPjbkiZXZqUSnhVU2rIm8s=; b=AAdxRTK3TT75CZHJsnJttZ0Mv4X6fAUAX9QerCTLd3TjdHZtNcPhURx6PNpxXKxX9f wUW60sPHCN8ygfGsSiZUZO16OsUMoT6U9jcaFWnEoZT3tFitKGEkpuMsdIhXtcionzKO OxBO5srg+ksezFvhbQVl73bQVOxuegbC6BugjabHmyOfB+fAYtIUoDpA9jf2Iboob9E3 +uQJCcgufKub91nw7UI32uobcpEk5SBbfkSmbSnQD5mBNH17cTA7Xcxt8ELWch7PWvmB w4PLdOZdnhMp5tJ/oYuKjyBoHtAH35gQ1p0ikm6VAzi7zwFG534kCLj2s3yA6CsCccS/ RJyg== X-Gm-Message-State: AOAM531ZZayqY1wi3nCF5xHkXXMmWRowznEp/ihf8FJ8SR5K/nhZm1iR a1vp1iZftqa3dDmnBBu3cCH08Q== X-Google-Smtp-Source: ABdhPJy9GtfO7ixk82n+CnnqjqGznRdZMsyMi+BKZGN7Xsa/CU+WOyCKUSI8ZFeoVZcOXySTcqI/AQ== X-Received: by 2002:a9d:6a81:: with SMTP id l1mr12953964otq.239.1625688817503; Wed, 07 Jul 2021 13:13:37 -0700 (PDT) Received: from ripple.attlocal.net (172-10-233-147.lightspeed.sntcca.sbcglobal.net. [172.10.233.147]) by smtp.gmail.com with ESMTPSA id s131sm4318378oib.52.2021.07.07.13.13.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Jul 2021 13:13:37 -0700 (PDT) Date: Wed, 7 Jul 2021 13:13:33 -0700 (PDT) From: Hugh Dickins X-X-Sender: hugh@ripple.anvils To: Andrew Morton cc: Hugh Dickins , Alistair Popple , Jason Gunthorpe , Ralph Campbell , Christoph Hellwig , Yang Shi , "Kirill A. Shutemov" , Shakeel Butt , linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH 4/4] mm/rmap: try_to_migrate() skip zone_device !device_private In-Reply-To: <563ce5b2-7a44-5b4d-1dfd-59a0e65932a9@google.com> Message-ID: <1241d356-8ec9-f47b-a5ec-9b2bf66d242@google.com> References: <563ce5b2-7a44-5b4d-1dfd-59a0e65932a9@google.com> MIME-Version: 1.0 X-Rspam-User: nil Authentication-Results: imf24.hostedemail.com; dkim=pass header.d=google.com header.s=20161025 header.b=tEoOzZ1g; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf24.hostedemail.com: domain of hughd@google.com designates 209.85.210.45 as permitted sender) smtp.mailfrom=hughd@google.com X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: 7125DB00009F X-Stat-Signature: ufd1pc8wsp9kcubs1487s4b5px7zfopz X-HE-Tag: 1625688818-42909 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: I know nothing about zone_device pages and !device_private pages; but if try_to_migrate_one() will do nothing for them, then it's better that try_to_migrate() filter them first, than trawl through all their vmas. Signed-off-by: Hugh Dickins Reviewed-by: Shakeel Butt Reviewed-by: Alistair Popple --- mm/rmap.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mm/rmap.c b/mm/rmap.c index 1235368f0628..795f9d5f8386 100644 --- a/mm/rmap.c +++ b/mm/rmap.c @@ -1703,9 +1703,6 @@ static bool try_to_migrate_one(struct page *page, struct vm_area_struct *vma, struct mmu_notifier_range range; enum ttu_flags flags = (enum ttu_flags)(long)arg; - if (is_zone_device_page(page) && !is_device_private_page(page)) - return true; - /* * When racing against e.g. zap_pte_range() on another cpu, * in between its ptep_get_and_clear_full() and page_remove_rmap(), @@ -1944,6 +1941,9 @@ void try_to_migrate(struct page *page, enum ttu_flags flags) TTU_SYNC))) return; + if (is_zone_device_page(page) && !is_device_private_page(page)) + return; + /* * During exec, a temporary VMA is setup and later moved. * The VMA is moved under the anon_vma lock but not the