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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 78F52C25B06 for ; Sun, 14 Aug 2022 16:34:22 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id DD89A6B0074; Sun, 14 Aug 2022 12:34:21 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D88056B0075; Sun, 14 Aug 2022 12:34:21 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C4FBB8D0001; Sun, 14 Aug 2022 12:34:21 -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 B55DE6B0074 for ; Sun, 14 Aug 2022 12:34:21 -0400 (EDT) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 939211C6252 for ; Sun, 14 Aug 2022 16:34:21 +0000 (UTC) X-FDA: 79798745922.04.CF68B4E Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf01.hostedemail.com (Postfix) with ESMTP id 2A8F440048 for ; Sun, 14 Aug 2022 16:34:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1660494859; 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: in-reply-to:in-reply-to:references:references; bh=/bLBxnLhyoe+Ri5hSyQerGnoHF0IT6FiQiuj35p9Rts=; b=XEvEMD39Ky+C7nyFeSpcEPSLz5RTbIvZ1GK7whNdG1fT29vz/9+1zY2p67wZY/15zFg7vW cXZYWfLkCiwzRhnSjdrq2I2WOvCdswJOJcvxjHpzhbQuJnJv3SxdXdwO8yLBz7cRCYmtbv QZpSskdSR48zwmlEqWU4JNkDY3tTl90= Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-536-tKPbnutmP8WFYffevAEaXA-1; Sun, 14 Aug 2022 12:34:16 -0400 X-MC-Unique: tKPbnutmP8WFYffevAEaXA-1 Received: by mail-wm1-f70.google.com with SMTP id i8-20020a1c3b08000000b003a5f5bce876so312082wma.2 for ; Sun, 14 Aug 2022 09:34:15 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:organization:from:references :cc:to:content-language:subject:user-agent:mime-version:date :message-id:x-gm-message-state:from:to:cc; bh=/bLBxnLhyoe+Ri5hSyQerGnoHF0IT6FiQiuj35p9Rts=; b=mQZNSBmWdtAUD/rSMBSb4uF64HezGAP/UVeyJ8nhnJq1DwRlQnNuXgqRJIaNTXzUgd 47BAkTeSF5BESPQCpksiIFU1Q/7Of+DSt/4ZS/lw5hvafAi+Z5BDjY3cOBdqbKWC6V7F sB6OfBCmiCkFkV+HNM4vykDGb1J7/X9K3Az4wV6LyG7ydvtRqANk0Uurn9EyFB6GunU4 SNcxcuyJvI2/RWtMu4n5PfWcMG0Bou6B4v0zVgkLfxNg2OP0r4cCSg3eP0GYJfbd+jT0 Kf0ns3EjNtJgkFlILQVURA3OYgIL4Ep7bNyHpntBNoaagTjSqtcC6MgwEdpakwEEfS2k AeKw== X-Gm-Message-State: ACgBeo3tqjbhh+alXIydFLHelcyi2mw8+j3jZRhvO3qPzJdP67LqKaTj D/K+sF9kY78ibsQROhF5tMsMUzCD0rupCyxj/kuutN5fyv1NPQY7k1DIK9rNhcJ8RIEwQweyrkw fzt3GyG5FRh4= X-Received: by 2002:a5d:5403:0:b0:21e:ea93:234d with SMTP id g3-20020a5d5403000000b0021eea93234dmr6345507wrv.125.1660494853563; Sun, 14 Aug 2022 09:34:13 -0700 (PDT) X-Google-Smtp-Source: AA6agR7kzxZUWuBRCpUoygu7uG0RhgLXN19/Gzo1QOzf6smajaXfRnesi/S7AxAMeQekyKieU4Giyw== X-Received: by 2002:a5d:5403:0:b0:21e:ea93:234d with SMTP id g3-20020a5d5403000000b0021eea93234dmr6345494wrv.125.1660494853258; Sun, 14 Aug 2022 09:34:13 -0700 (PDT) Received: from ?IPV6:2003:cb:c72a:1e00:10cf:131b:999d:9b4a? (p200300cbc72a1e0010cf131b999d9b4a.dip0.t-ipconnect.de. [2003:cb:c72a:1e00:10cf:131b:999d:9b4a]) by smtp.gmail.com with ESMTPSA id d7-20020a05600c34c700b003a35516ccc3sm6863678wmq.26.2022.08.14.09.34.12 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 14 Aug 2022 09:34:12 -0700 (PDT) Message-ID: Date: Sun, 14 Aug 2022 18:34:12 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.11.0 Subject: Re: [PATCH v2 3/3] mm: handling Non-LRU pages returned by follow_page To: Haiyue Wang , linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: akpm@linux-foundation.org, linmiaohe@huawei.com, ying.huang@intel.com, songmuchun@bytedance.com, naoya.horiguchi@linux.dev, alex.sierra@amd.com References: <20220812084921.409142-1-haiyue.wang@intel.com> <20220814140534.363348-1-haiyue.wang@intel.com> <20220814140534.363348-4-haiyue.wang@intel.com> From: David Hildenbrand Organization: Red Hat In-Reply-To: <20220814140534.363348-4-haiyue.wang@intel.com> X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1660494861; a=rsa-sha256; cv=none; b=tgR0vvh5fY118ZOKmFk9oy6OxIhdSp7XfG8rU/rjdEKAiRATzFVD1Koq50dHEsUEkCXIIN Jm5G2gj5I/ZqYuFV5Acngbrx5cuQLlOhB1Ylq57240+j9fL6eIniVgKDj2FjP16iVAFcFU YrjMQL3oQDwgilLPJG5u6QSUF4krTmA= ARC-Authentication-Results: i=1; imf01.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=XEvEMD39; spf=pass (imf01.hostedemail.com: domain of david@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=david@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1660494861; 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-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=/bLBxnLhyoe+Ri5hSyQerGnoHF0IT6FiQiuj35p9Rts=; b=UGBVayU5+x81eEIe3544Q3vvTJo9ddySUpzr1s7/FiAYKzYU+Q/NoRDK+oNescOzRa27Q6 hMLbNvKTpcOLrd496I2UI1EoRMutOd/+z4nlmveaGd08/xgOvPiTFQ2/rdx2dQdPeakIvi KdHRs43juo6UpQoCGSqsrDkmWRwP0tI= X-Rspamd-Queue-Id: 2A8F440048 Authentication-Results: imf01.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=XEvEMD39; spf=pass (imf01.hostedemail.com: domain of david@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=david@redhat.com; dmarc=pass (policy=none) header.from=redhat.com X-Rspam-User: X-Rspamd-Server: rspam12 X-Stat-Signature: 73fmoyo1q9cc5195aucygrdzaasr31y7 X-HE-Tag: 1660494859-367611 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: On 14.08.22 16:05, Haiyue Wang wrote: > Add the missed put_page handling for handling Non-LRU pages returned by > follow_page with FOLL_GET flag set. > > This is the second patch for fixing the commit > 3218f8712d6b ("mm: handling Non-LRU pages returned by vm_normal_pages") > > Signed-off-by: Haiyue Wang > --- > mm/huge_memory.c | 2 +- > mm/ksm.c | 10 ++++++++++ > mm/migrate.c | 6 +++++- > 3 files changed, 16 insertions(+), 2 deletions(-) > > diff --git a/mm/huge_memory.c b/mm/huge_memory.c > index 2ee6d38a1426..b2ba17c3dcd7 100644 > --- a/mm/huge_memory.c > +++ b/mm/huge_memory.c > @@ -2966,7 +2966,7 @@ static int split_huge_pages_pid(int pid, unsigned long vaddr_start, > if (IS_ERR_OR_NULL(page)) > continue; > > - if (!is_transparent_hugepage(page)) > + if (is_zone_device_page(page) || !is_transparent_hugepage(page)) > goto next; > > total++; > diff --git a/mm/ksm.c b/mm/ksm.c > index fe3e0a39f73a..1360bb52ada6 100644 > --- a/mm/ksm.c > +++ b/mm/ksm.c > @@ -477,6 +477,10 @@ static int break_ksm(struct vm_area_struct *vma, unsigned long addr) > FOLL_GET | FOLL_MIGRATION | FOLL_REMOTE); > if (IS_ERR_OR_NULL(page)) > break; > + if (is_zone_device_page(page)) { > + put_page(page); > + break; > + } I think we can drop this check completely. While working on patches that touch this code I realized that this check is completely useless. device pages are never PageKsm pages and there is no need to special-case here. If a zone device page could be PageKsm, then we wouldn't handle it here correctly and not break ksm. So just drop it. -- Thanks, David / dhildenb