Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp5863183ioo; Wed, 1 Jun 2022 14:22:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyAhHDxiyzBmKcwkgGKX4C3ffPCOOtyW4VtMuzth0vILSj02XwXSD3mejMjFiS0f+cuHj+l X-Received: by 2002:a17:90b:1b05:b0:1e2:a053:2fad with SMTP id nu5-20020a17090b1b0500b001e2a0532fadmr25979939pjb.209.1654118560054; Wed, 01 Jun 2022 14:22:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654118560; cv=none; d=google.com; s=arc-20160816; b=P8pviKpBTY9jvmGWOlRWyfwOixbKoNJ9iYpFBbeF3GenfLaHaw55uCD4uqq88CHNz6 a+wuNxx3pLuPn6GpTTAM7clIy3zZKmdEkVi68dNRwyxrP/rgoBcr3D9oCtG2q0++NNJ2 L6DdOS2ENG7YoOXKR43HUP5JzbK1i4vcF8poaCerljqgM/CjHk2bwkVFDBQdrDpU+dLH WJPFhhfpJUu97ybELd8mlhfrZwNe8Z77In6cEXXZ4lUmJmzAsJxaCZaGfz4SrC6gNjZT 91A45DdEkj+h/0kmw8I2SPzcRwhPi1wt14uRB841C0Ycaxdz/DX+/mBpa4GB8dnzeFPI jbeg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to :organization:from:references:cc:to:content-language:subject :user-agent:mime-version:date:message-id:dkim-signature; bh=PGwek/6vdYkYYLHUigLW7HiiIxESVvwETc14ysV7hYY=; b=a8nAfYa3nGfe1OvSyt16CC6PF5ZDToaDQFOZSIXi47fKxEhXMGCVBu+3wPtuIN2mMn 1eycj5IXeFpwTEmiuMPEfaNyjkO167DuSZC8Ludd10E5OtOIGHfLTx6t+dPd4NG6A7dU dkOPaqSd5Rmd3UjuguBVh6AMeYFs5+9TYgfB4yzCTkmq746e8at0+mwEPE3Gy5j7RPhL n8L6uxhoSBdmEqRQ4OEcpgpIlyVGOaXPvco/xE9ePVTsfa/ib1BeluOvhrUwV33AlUWL 2R1tlN92L6EVuA+cCQ0pML3cHOsUM5mxa7y9qCR/x9BTRMKQQpbdH6b3HolX5vXXC7eX WSRQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=IJctP2Kl; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id nr18-20020a17090b241200b001e34f58374fsi4675506pjb.129.2022.06.01.14.22.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Jun 2022 14:22:40 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=IJctP2Kl; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 7FC232FA63F; Wed, 1 Jun 2022 13:13:40 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344027AbiEaMAM (ORCPT + 99 others); Tue, 31 May 2022 08:00:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56354 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344034AbiEaMAA (ORCPT ); Tue, 31 May 2022 08:00:00 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id E8ABD4B876 for ; Tue, 31 May 2022 04:59:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1653998399; 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=PGwek/6vdYkYYLHUigLW7HiiIxESVvwETc14ysV7hYY=; b=IJctP2Kl2eQLkDfIEuixupKVkzZ0yf17oZ/nEYYhqAZ676NP4e1b1K/f4IgwkbixiR+cK6 PVACWkhiAzN+Yao8N1t5CmFKuGMW86ofOiQl9WCewg/TNgndjf73jB6So88JybKrqvk2QS nQX2l27uIzpcQxql8QDtuPn0k9cVcF8= Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-492-mMfpGoQwMg-Pr1XAS-xlSg-1; Tue, 31 May 2022 07:59:57 -0400 X-MC-Unique: mMfpGoQwMg-Pr1XAS-xlSg-1 Received: by mail-wm1-f72.google.com with SMTP id n18-20020a05600c3b9200b00397335edc7dso1335317wms.7 for ; Tue, 31 May 2022 04:59:57 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:cc:references:from:organization:in-reply-to :content-transfer-encoding; bh=PGwek/6vdYkYYLHUigLW7HiiIxESVvwETc14ysV7hYY=; b=risPLMDAxJv8CT9LUSPSOV4UOukMVLADwTvvLSuPa9pUCYCvt8nF2FBBdylQDTbn58 O5JMJhw5ogI5fkes2Ke0OkKsq6tRkXqiNvBsa2tPhZujrFFwxnBYHynlVkqp5a67e1OE b0ZRDzTMOCksSb5yt3XJ4QbwDceVxRe1UbCS+r88aAEtwUq8plZHKqJBhJG+gciUDmkQ rw4OEj2o0wxqK2GsR01LqAQhfDnz60JYe0EBvctAcoF1VApO2Bf0GfFhv5oMkInumM0b AOK8CWp/+Tk3W/hru0obnnCr0tDt1SWaaG3UzsjX6c0NZA+yWtnvwVs0Rp6qA97MktUH Y06A== X-Gm-Message-State: AOAM532G7g52hMUh62R3OYyYewUObsNyyc6Bhp/Bw7JE9hNro7obfMC2 2t4+SnrEe/x6LV7KX4b7htoBj1jVmATVmb2VuoZzocV8P7OYpUkhsdT1JF6CWjKrJUYwXaJXywl 8JxOoZIcyZ+qiEVi8WBDXcfSX X-Received: by 2002:a1c:6a14:0:b0:397:39c4:8ac2 with SMTP id f20-20020a1c6a14000000b0039739c48ac2mr23346013wmc.112.1653998396529; Tue, 31 May 2022 04:59:56 -0700 (PDT) X-Received: by 2002:a1c:6a14:0:b0:397:39c4:8ac2 with SMTP id f20-20020a1c6a14000000b0039739c48ac2mr23345999wmc.112.1653998396321; Tue, 31 May 2022 04:59:56 -0700 (PDT) Received: from ?IPV6:2003:cb:c708:f100:8096:9368:ba52:a341? (p200300cbc708f10080969368ba52a341.dip0.t-ipconnect.de. [2003:cb:c708:f100:8096:9368:ba52:a341]) by smtp.gmail.com with ESMTPSA id q12-20020a5d574c000000b002102f90870esm7373917wrw.108.2022.05.31.04.59.55 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 31 May 2022 04:59:55 -0700 (PDT) Message-ID: <0724b4c4-15f6-e429-f945-f57c619c7270@redhat.com> Date: Tue, 31 May 2022 13:59:54 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.0 Subject: Re: [PATCH v2 2/4] mm/migration: remove unneeded lock page and PageMovable check Content-Language: en-US To: Miaohe Lin Cc: ying.huang@intel.com, hch@lst.de, dhowells@redhat.com, cl@linux.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org, akpm@linux-foundation.org, mike.kravetz@oracle.com, naoya.horiguchi@nec.com, Minchan Kim References: <20220425132723.34824-1-linmiaohe@huawei.com> <20220425132723.34824-3-linmiaohe@huawei.com> <525298ad-5e6a-2f8d-366d-4dcb7eebd093@redhat.com> <4cf144a9-fff5-d993-4fcb-7f2dfa6e71bb@redhat.com> <924de987-202b-a97e-e6d2-6bdab530f190@huawei.com> <025d0dc8-a446-b720-14a8-97c041055f48@huawei.com> <143ab5dd-85a9-3338-53b7-e46c9060b20e@redhat.com> <6ba7e2bd-28c1-53ff-a6b7-072c79714dee@huawei.com> From: David Hildenbrand Organization: Red Hat In-Reply-To: <6ba7e2bd-28c1-53ff-a6b7-072c79714dee@huawei.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-3.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,RDNS_NONE,SPF_HELO_NONE, T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Sorry for the late reply, was on vacation. >>> >>> But for isolated page, PageLRU is cleared. So when the isolated page is released, __clear_page_lru_flags >>> won't be called. So we have to clear the PG_active and PG_unevictable here manully. So I think >>> this code block works. Or am I miss something again? >> >> Let's assume the following: page as freed by the owner and we enter >> unmap_and_move(). >> >> >> #1: enter unmap_and_move() // page_count is 1 >> #2: enter isolate_movable_page() // page_count is 1 >> #2: get_page_unless_zero() // page_count is now 2 >> #1: if (page_count(page) == 1) { // does not trigger >> #2: put_page(page); // page_count is now 1 >> #1: put_page(page); // page_count is now 0 -> freed >> >> >> #1 will trigger __put_page() -> __put_single_page() -> >> __page_cache_release() will not clear the flags because it's not an LRU >> page at that point in time, right (-> isolated)? > > Sorry, you're right. I thought the old page will be freed via putback_lru_page which will > set PageLRU back instead of put_page directly. So if the above race occurs, PG_active and > PG_unevictable will remain set while page goes to the buddy and check_free_page will complain > about it. But it seems this is never witnessed? Maybe a) we were lucky so far and didn't trigger it b) the whole code block is dead code because we are missing something c) we are missing something else :) > >> >> We did not run that code block that would clear PG_active and >> PG_unevictable. >> >> Which still leaves the questions: >> >> a) If PG_active and PG_unevictable was cleared, where? > > For LRU pages, PG_active and PG_unevictable are cleared via __page_cache_release. And for isolated > (LRU) pages, PG_active and PG_unevictable should be cleared ourselves? > >> b) Why is that code block that conditionally clears the flags of any >> value and why can't we simply drop it? >> > > To fix the issue, should we clear PG_active and PG_unevictable unconditionally here? I wonder if we should simply teach actual freeing code to simply clear both flags when freeing an isolated page? IOW, to detect "isolated LRU" is getting freed and fixup? -- Thanks, David / dhildenb