From patchwork Tue Aug 23 13:58:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Wang, Haiyue" X-Patchwork-Id: 12952068 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0B7F8C32772 for ; Tue, 23 Aug 2022 13:58:29 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7455E8D0003; Tue, 23 Aug 2022 09:58:28 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 6F48F8D0001; Tue, 23 Aug 2022 09:58:28 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5BD868D0003; Tue, 23 Aug 2022 09:58:28 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 4BDBD8D0001 for ; Tue, 23 Aug 2022 09:58:28 -0400 (EDT) Received: from smtpin11.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 30010ABBE7 for ; Tue, 23 Aug 2022 13:58:28 +0000 (UTC) X-FDA: 79831012296.11.F834A23 Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by imf31.hostedemail.com (Postfix) with ESMTP id 35AE42004E for ; Tue, 23 Aug 2022 13:58:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1661263107; x=1692799107; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=pCoa6Ugj2AJRPyPGUlNmHln305j0xDKrwGnvaLsDdR0=; b=N68AZeh7Pq9emFbTtiO9DuhTef73WLmCkw5K/OUPjiS/9tWucLLkjko6 Ubb+NArEYGOdGLfgpuQvNFHN/ked9DL/r8Z0YoHOaqZdo15X/PWnJ7q+b ju67cW+3oXXh68faLGE0zUF54EHp14+xCfASVmN/5uUuFxO4gf6Ldq5SL Sbnc0OVQBaXiBNCfgCjXE3ubjadCpe6vWJyp8LL9alFDGX4dFdHNJvWTw z5LZ1YiINL3eWzOE4Pyi68DKJ/plGuZDec1mFZXzT7YgHd+UuGMrZHItq gt+GMUoq7741KD8UlXJxVnRPcBNlHCbut/V+boWoUMba1xkKsrVN6xfME w==; X-IronPort-AV: E=McAfee;i="6500,9779,10448"; a="294974623" X-IronPort-AV: E=Sophos;i="5.93,257,1654585200"; d="scan'208";a="294974623" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Aug 2022 06:58:25 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.93,257,1654585200"; d="scan'208";a="638663353" Received: from sse-cse-haiyue-nuc.sh.intel.com ([10.239.241.114]) by orsmga008.jf.intel.com with ESMTP; 23 Aug 2022 06:58:22 -0700 From: Haiyue Wang To: linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: akpm@linux-foundation.org, david@redhat.com, apopple@nvidia.com, linmiaohe@huawei.com, ying.huang@intel.com, songmuchun@bytedance.com, naoya.horiguchi@linux.dev, alex.sierra@amd.com, mike.kravetz@oracle.com, gerald.schaefer@linux.ibm.com, Haiyue Wang Subject: [PATCH v7 0/2] fix follow_page related issues Date: Tue, 23 Aug 2022 21:58:39 +0800 Message-Id: <20220823135841.934465-1-haiyue.wang@intel.com> X-Mailer: git-send-email 2.37.2 MIME-Version: 1.0 ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1661263107; 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=yJo6Hq1Wdoej4Gz3OuV3oxiT7P/RSEjUbZkp71Kokcs=; b=YutnsbrKZa0xQsqklUidMUBmGcfQdQdPLxSSBLMms8LgaLHprfikHI9Zifdii7cqhdLj1s zJpLwfN0PagDImmDeIWm/J0k9hFViFNepn+PPbfkV0Z9Dzp/bpqvKNm9m7WcIQTFo/ZJs6 iTWZx8aumCjdnzY2y1CqWGUIvsTi0Zw= ARC-Authentication-Results: i=1; imf31.hostedemail.com; dkim=none ("invalid DKIM record") header.d=intel.com header.s=Intel header.b=N68AZeh7; spf=pass (imf31.hostedemail.com: domain of haiyue.wang@intel.com designates 134.134.136.65 as permitted sender) smtp.mailfrom=haiyue.wang@intel.com; dmarc=pass (policy=none) header.from=intel.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1661263107; a=rsa-sha256; cv=none; b=6dl3se+PwhQo7eqYUhA0mfrOSxiWhsTwy7TAOgZRh0oHuqEzA5J6PyrYj+K5AwpKSGo1dJ +KG27sQed+Ay4SNcNZW9LujYXgV9MesANhpdyo8qU730meORchHQbDQfUqg1nltrGupQrc uqoSbM0iA6qm56TquQ68OnfSmQ7rHWo= X-Rspam-User: Authentication-Results: imf31.hostedemail.com; dkim=none ("invalid DKIM record") header.d=intel.com header.s=Intel header.b=N68AZeh7; spf=pass (imf31.hostedemail.com: domain of haiyue.wang@intel.com designates 134.134.136.65 as permitted sender) smtp.mailfrom=haiyue.wang@intel.com; dmarc=pass (policy=none) header.from=intel.com X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 35AE42004E X-Stat-Signature: 4xxn7akuu8xqy8wo65u795xx5jwdi3ry X-HE-Tag: 1661263106-442167 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: v7: Drop the zone device page check for transparent page. v6: Simplify the multiple layers of conditionals for if {} - if (page) { - err = !is_zone_device_page(page) ? page_to_nid(page) - : -ENOENT; - if (foll_flags & FOLL_GET) - put_page(page); - } else { - err = -ENOENT; - } + err = -ENOENT; + if (!page) + goto set_status; + + if (!is_zone_device_page(page)) + err = page_to_nid(page); + + if (foll_flags & FOLL_GET) + put_page(page); v5: reword the commit message for FOLL_GET with more information. v4: add '()' for the function for readability. add more words about the Non-LRU pages fix in commit message. v3: Merge the fix for handling Non-LRU pages into one patch. Drop the break_ksm zone device page check. v2: Add the Non-LRU pages fix with two patches, so that 'mm: migration: fix the FOLL_GET' can be applied directly on linux-5.19 stable branch. Haiyue Wang (2): mm: migration: fix the FOLL_GET failure on following huge page mm: fix the handling Non-LRU pages returned by follow_page mm/huge_memory.c | 2 +- mm/ksm.c | 12 +++++++++--- mm/migrate.c | 23 +++++++++++++++++------ 3 files changed, 27 insertions(+), 10 deletions(-)