Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp2166818pxb; Thu, 4 Nov 2021 15:16:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz+mP6klUCmHww/XEVZma93vgPaRvLVZFD6s9d1jYHIRx7fphnAYGNbcnL4ZI6eqJG/vd6p X-Received: by 2002:a05:6402:524b:: with SMTP id t11mr43850579edd.98.1636064212307; Thu, 04 Nov 2021 15:16:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1636064212; cv=none; d=google.com; s=arc-20160816; b=peT1kaI/dhRGd3u1HNex40neq0j+3/dEV2M94oHXVT+FiGgZ9YcZdHL7i/tSKeGFGE 616IWqwcAJlvnTsAwSAYlHMipGBVP2ozN2PMYsm/HRG98GUPENdY8qrGnnF8w6DMJGBz 0N4tBKbGWM0oAh4B++nEoisKTUotRTgRB65Ow5NIYlbXo2F6jXszOHf5E7Wazc7hs2De roT3pTmuENpcyaPLZUljxsIs5GnLT8IEBiv48fuvixBlc8PzxrM7kdl1s59fBV6PksiF XHbJ2ZVHv+OLQ1nGA6Sn3FbNWIrB5qVMWPzaxRmETzpBvqPZAVHrh23bOasyTPUFWeya s2hg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=ZETv7P3ymxCm8N/xL55fTiWb9M8Z6Mjqq0/6JzFp+Lg=; b=a4s9znkjw61HM5Nw0t6k5CFpIVmNDPYn+zSNG7iNH4yLffR/q5Se+bd1mD4I43PmIe rx5mvnbhli5UhYDhgRAZLoYokLdq0tzVQC4ONwY9NcEsJvO1TbIID1WxFXZI1IxlFvXp xI968GwFeTSx1mIIK6X3MHWn2C0e53KNS5loVmtJB4qljCwb1rs8TCbXN5EVTlH215+t sT2RW9FSeNuMQwgHts4MU9VpHSprxLGMiRBELgSjGMT06aJIuBj5tdmHmIS6d7RrxMTZ 54rqkhjM3JEXSLIIZMEUucclm0p8ZhD0XPX6zLp5T7m/IElojqhlu66/aPdsJXae1r/c duVg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linux-foundation.org header.s=korg header.b=DKcWVOCe; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id di4si11868948ejc.217.2021.11.04.15.16.19; Thu, 04 Nov 2021 15:16:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=fail header.i=@linux-foundation.org header.s=korg header.b=DKcWVOCe; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232209AbhKDWJ7 (ORCPT + 99 others); Thu, 4 Nov 2021 18:09:59 -0400 Received: from mail.kernel.org ([198.145.29.99]:53980 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232002AbhKDWJ6 (ORCPT ); Thu, 4 Nov 2021 18:09:58 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 0196C60EB4; Thu, 4 Nov 2021 22:07:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1636063640; bh=hiW21M8IbjMnysrLz02OTr1uCPLSmAnYYpV34I+FcwE=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=DKcWVOCeT6uvpUrM3DSraHq727l4tf7ibOBqBj+QXlnFIa286EcEgf3FKCgbEkWyt xjmRfoDNT5GVuUvOGjgc0HoBd9AIlXaAyD7tGqMmhIgKggmdNV2K5GYkcVtqg5ebZ8 6ri0/fHb4E2Xdv+89HNyn19OVN9i1sWX9oO/WB0s= Date: Thu, 4 Nov 2021 15:07:17 -0700 From: Andrew Morton To: Miaohe Lin Cc: HORIGUCHI =?UTF-8?B?TkFPWUE=?= (=?UTF-8?B?5aCA5Y+jIOebtOS5nw==?=) , "mhocko@suse.com" , "minchan@kernel.org" , "cgoldswo@codeaurora.org" , "linux-mm@kvack.org" , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH 3/3] mm/memory_hotplug: make HWPoisoned dirty swapcache pages unmovable Message-Id: <20211104150717.d235501b802868d578639422@linux-foundation.org> In-Reply-To: References: <20210821094246.10149-1-linmiaohe@huawei.com> <20210821094246.10149-4-linmiaohe@huawei.com> <20210823082646.GB1452382@hori.linux.bs1.fc.nec.co.jp> X-Mailer: Sylpheed 3.5.1 (GTK+ 2.24.31; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 23 Aug 2021 17:14:29 +0800 Miaohe Lin wrote: > On 2021/8/23 16:26, HORIGUCHI NAOYA(堀口 直也) wrote: > > On Sat, Aug 21, 2021 at 05:42:46PM +0800, Miaohe Lin wrote: > >> HWPoisoned dirty swapcache pages are kept for killing owner processes. > >> We should not offline these pages or do_swap_page() would access the > >> offline pages and lead to bad ending. > >> > > > > Thank you for the report. I'm not yet sure of the whole picture of this > > issue. do_swap_page() is expected to return with fault VM_FAULT_HWPOISON > > when called via the access to the error page, so I wonder why this doesn't > > work for your situation. And what is the "bad ending" in the description? > > > > IMO we might hotremove the page while SwapCache still have ref to it. Thus the page > struct would be accessed after offlined. The page struct should be invalid in this case > and this would make do_swap_page fragile. Or am I miss something? > > > I feel that aborting memory hotremove due to a hwpoisoned dirty swapcache > > might be too hard, so I'd like to find another solution if we have. > > If there is a better way, we can just drop this one. > > Many thanks for your review and reply! :) > > > # You may separate this patch from former two to make them merged to > > # mainline soon. > > ... > > >> --- a/mm/memory_hotplug.c > >> +++ b/mm/memory_hotplug.c > >> @@ -1664,6 +1664,12 @@ static int scan_movable_pages(unsigned long start, unsigned long end, > >> */ > >> if (PageOffline(page) && page_count(page)) > >> return -EBUSY; > >> + /* > >> + * HWPoisoned dirty swapcache pages are definitely unmovable > >> + * because they are kept for killing owner processes. > >> + */ > >> + if (PageHWPoison(page) && PageSwapCache(page)) > >> + return -EBUSY; > I'll drop this. Please resend something if you still believe that changes are desirable.