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 9BE23C2BD09 for ; Thu, 4 Jul 2024 00:57:59 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id DD65E6B0082; Wed, 3 Jul 2024 20:57:58 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D86106B0085; Wed, 3 Jul 2024 20:57:58 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C4CDA6B0089; Wed, 3 Jul 2024 20:57:58 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id A74E46B0082 for ; Wed, 3 Jul 2024 20:57:58 -0400 (EDT) Received: from smtpin24.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 19C91160F20 for ; Thu, 4 Jul 2024 00:57:58 +0000 (UTC) X-FDA: 82300258236.24.E15B4AD Received: from m16.mail.126.com (m16.mail.126.com [220.197.31.7]) by imf12.hostedemail.com (Postfix) with ESMTP id 1FB4840010 for ; Thu, 4 Jul 2024 00:57:54 +0000 (UTC) Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=126.com header.s=s110527 header.b=P+qp9KtA; spf=pass (imf12.hostedemail.com: domain of yangge1116@126.com designates 220.197.31.7 as permitted sender) smtp.mailfrom=yangge1116@126.com; dmarc=pass (policy=none) header.from=126.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1720054653; 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=Sgcsx2tAZ8g67PHUjM2qPlMmPPLYQP+xUO4tGYkjnSE=; b=RZB2l/XDDkU5v/5mrFMsP47BOIpnvoRiuob+AMAMcA6E1jJ6LCM0Vlc0rWINyXNJdsYSu9 HKBQf39mG+Myfjaboec8397rcjdEvcxEDhz0ShuuXjvYXou6vRuOmaer1OqijDWDNryg/Y yZNxPST2jn0DawwRlgEUE5NRF0ct0Z8= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1720054653; a=rsa-sha256; cv=none; b=ssrXm/VJ0y7RbIU5akruQX3UlE8S6YC33GE1zEFpB3GS9ukEQeAj0kTrJhM7uk2VlxQrVr 2sFH3Ddi5pVSfVMAmzC0SGEMnaLxN8WKG20bZyoZEPxyk2tY0b6nr3Di2w+b5W705ex76v Cs32yUWiyOc+2Se9u9u54uc2gARloME= ARC-Authentication-Results: i=1; imf12.hostedemail.com; dkim=pass header.d=126.com header.s=s110527 header.b=P+qp9KtA; spf=pass (imf12.hostedemail.com: domain of yangge1116@126.com designates 220.197.31.7 as permitted sender) smtp.mailfrom=yangge1116@126.com; dmarc=pass (policy=none) header.from=126.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=126.com; s=s110527; h=Message-ID:Date:MIME-Version:Subject:From: Content-Type; bh=Sgcsx2tAZ8g67PHUjM2qPlMmPPLYQP+xUO4tGYkjnSE=; b=P+qp9KtAzlzaJRFzGOFC5dFfksF1bzDSH0RdEEUMiRREHP3P84M+KuuJ06j++z Z+MxcG4I7XZjgA392Mi2izopvY/cdZKlDUo8s26mIw1tZbDKmbzT7oVuTXjOYxP5 0zkom0hw0ly0QsgUc4+wJ7usd8qSl2Y5zO0CzmRfzCFFY= Received: from [172.21.22.210] (unknown [118.242.3.34]) by gzga-smtp-mta-g1-1 (Coremail) with SMTP id _____wD3XziM84VmfbwtAQ--.20333S2; Thu, 04 Jul 2024 08:57:50 +0800 (CST) Message-ID: Date: Thu, 4 Jul 2024 08:57:48 +0800 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH V3] mm/gup: Clear the LRU flag of a page before adding to LRU batch To: Andrew Morton Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org, 21cnbao@gmail.com, david@redhat.com, baolin.wang@linux.alibaba.com, aneesh.kumar@linux.ibm.com, liuzixing@hygon.cn References: <1720008153-16035-1-git-send-email-yangge1116@126.com> <20240703130843.ad421344a0f3f05564a7f706@linux-foundation.org> From: Ge Yang In-Reply-To: <20240703130843.ad421344a0f3f05564a7f706@linux-foundation.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-CM-TRANSID:_____wD3XziM84VmfbwtAQ--.20333S2 X-Coremail-Antispam: 1Uf129KBjvJXoW7WrWxXrWUtFyUGr1UGr48WFg_yoW8ZFW8pF 4xJ3W3trWDX3WSkrs7J398ur1Syrs2yr45Jr13Ar1UCwn8Wr12v3y8KF1DW3W3CrWYgF1Y vr4UWwn3ua1DCaDanT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x07jjLvtUUUUU= X-Originating-IP: [118.242.3.34] X-CM-SenderInfo: 51dqwwjhrrila6rslhhfrp/1tbiWQwRG2VLbI9L5QADs- X-Rspamd-Queue-Id: 1FB4840010 X-Stat-Signature: a8qtbix6zfqxgg3oknedahpsuymzceha X-Rspamd-Server: rspam09 X-Rspam-User: X-HE-Tag: 1720054674-149253 X-HE-Meta: U2FsdGVkX1+nkQ9zklEzWeElDBhR+1V45Qxcv7bOBLHzkRYkD2SJknD1mAtWX4KpET1xvEF/ZeEvO8KV6EbV5FmOUJAOYP7+aUkYLFrr93wmytDHj7z42B/yoH8OBOTNqErurxMgRJjpxQL1oBsBVOm7/MT5L/yH+GwCpuu1Eeb673pwAakfLSGewId0vK5Lvmo8mhE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98mToM1EKBIVlok84ZP4KEVdpD749nIfJckcIEAMuoRTz/y+TlevXaP0aeqCfCq7rzGfyVLSS+/1Prvs4+HIUBsl7SA4Extjs2rmGW/cZaXv0w9/anC4nJzCJEpWsZI+1PzH0UdLzbkwLeXhFO59vtCw6UdWSeC+PuuHqc9aTUsds1YKUXdh9yxiarFY3afBXwpcqOMai1yvXgW1i7zO1VZm8= 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: List-Subscribe: List-Unsubscribe: 在 2024/7/4 4:08, Andrew Morton 写道: > On Wed, 3 Jul 2024 20:02:33 +0800 yangge1116@126.com wrote: > >> From: yangge >> >> If a large number of CMA memory are configured in system (for example, the >> CMA memory accounts for 50% of the system memory), starting a virtual >> virtual machine with device passthrough, it will >> call pin_user_pages_remote(..., FOLL_LONGTERM, ...) to pin memory. >> Normally if a page is present and in CMA area, pin_user_pages_remote() >> will migrate the page from CMA area to non-CMA area because of >> FOLL_LONGTERM flag. But the current code will cause the migration failure >> due to unexpected page refcounts, and eventually cause the virtual machine >> fail to start. >> >> If a page is added in LRU batch, its refcount increases one, remove the >> page from LRU batch decreases one. Page migration requires the page is not >> referenced by others except page mapping. Before migrating a page, we >> should try to drain the page from LRU batch in case the page is in it, >> however, folio_test_lru() is not sufficient to tell whether the page is >> in LRU batch or not, if the page is in LRU batch, the migration will fail. >> >> To solve the problem above, we modify the logic of adding to LRU batch. >> Before adding a page to LRU batch, we clear the LRU flag of the page so >> that we can check whether the page is in LRU batch by folio_test_lru(page). >> Seems making the LRU flag of the page invisible a long time is no problem, >> because a new page is allocated from buddy and added to the lru batch, >> its LRU flag is also not visible for a long time. >> > > Thanks. > > I'll add this to the mm-hotfixes branch for additional testing. Please > continue to work with David on the changelog enhancements. > > In mm-hotfixes I'd expect to send it to Linus next week. I could move > it into mm-unstable (then mm-stable) for merging into 6.11-rc1. This > is for additional testing time - it will still be backported into > earlier kernels. We can do this with any patch. Ok, thanks.