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 71746C433F5 for ; Thu, 17 Mar 2022 12:29:17 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B84876B0071; Thu, 17 Mar 2022 08:29:16 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B0C7D6B0072; Thu, 17 Mar 2022 08:29:16 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9AD3B8D0001; Thu, 17 Mar 2022 08:29:16 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0190.hostedemail.com [216.40.44.190]) by kanga.kvack.org (Postfix) with ESMTP id 87A1D6B0071 for ; Thu, 17 Mar 2022 08:29:16 -0400 (EDT) Received: from smtpin27.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 429F8180B7D34 for ; Thu, 17 Mar 2022 12:29:16 +0000 (UTC) X-FDA: 79253808312.27.79F5315 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf04.hostedemail.com (Postfix) with ESMTP id 9E9DF4000A for ; Thu, 17 Mar 2022 12:29:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1647520155; 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=OR8FPIU54nAtKIYmPBp3wH3w+/iiohWrYlbeO55Ka1Q=; b=ckY2exzKAcUbf9u8rPPqpHhrgnuOwpfmVQ1qLOm/ue3wAjejXCHMqb/cP+NzaVQlGRsRmn 7NHbnFCzY9KORt6HjUWItfw+LpSU32f+oFeomD4maxj3m+HWCTcilH+zyqAYMSeK2EeU3z NtDQcpp1Ybt/hZ4e4Yasd2j8cwYSIYg= 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.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-136-ZRQfaJ20MKO_Kv1h6ELVOw-1; Thu, 17 Mar 2022 08:29:11 -0400 X-MC-Unique: ZRQfaJ20MKO_Kv1h6ELVOw-1 Received: by mail-wm1-f70.google.com with SMTP id r9-20020a1c4409000000b0038c15a1ed8cso2218576wma.7 for ; Thu, 17 Mar 2022 05:29:11 -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=OR8FPIU54nAtKIYmPBp3wH3w+/iiohWrYlbeO55Ka1Q=; b=Y69Pyas+DEc/VFuzG8grUp2c/9Eadt3U+eTqIcgmTux3hM4wpRBaxU4SBAlLKmLi5R VN/q15DlqaW5ReJE/HvYRK3z1UvamTuPitGBrRAHvvEely1ZqkFUXwGWfiWoSQlcw383 vBN449R57PahMHylrOvUEwJDTfN4LJthtSBy3J0NRx9W5IAwdS5bge2bl48ACwBcQ2jc ji3DvkbuDRGMRvyxFzvgzaTHU8QPRSN8oxc2qiL5pNOFeSMqzCf++zenPBjWbz4t06kS jOLxQNidblHqmmrSHQcMGHkqYZMKm9mIt6kPivayBQDCQ0AJImMU/C6tgPcrln9MIvQB 2CZA== X-Gm-Message-State: AOAM532U9EtODfKWEtpA+LlsOFQ1+3JxBJwIHgfUdk86LBIFD+EhvaRy ERtZe2UoNq0ppxCeAoqMLlyENVOk+yTHuMQYFVegI3CQCHV160Fr36APLIKqQaZk/BNuIFXT+iq zVaGG/os4JEY= X-Received: by 2002:a5d:4392:0:b0:1f1:e683:de90 with SMTP id i18-20020a5d4392000000b001f1e683de90mr3962543wrq.551.1647520150668; Thu, 17 Mar 2022 05:29:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwztFIjSTfrh/Pnb4zbDJ2gsMcOFsG/vVgG9Rt4Z4Wb5WXu7mBT8uqW87+Rv7vn9IAvIllz9w== X-Received: by 2002:a5d:4392:0:b0:1f1:e683:de90 with SMTP id i18-20020a5d4392000000b001f1e683de90mr3962526wrq.551.1647520150384; Thu, 17 Mar 2022 05:29:10 -0700 (PDT) Received: from ?IPV6:2a09:80c0:192:0:20af:34be:985b:b6c8? ([2a09:80c0:192:0:20af:34be:985b:b6c8]) by smtp.gmail.com with ESMTPSA id m3-20020a5d6a03000000b001f06621641fsm3867611wru.96.2022.03.17.05.29.09 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 17 Mar 2022 05:29:10 -0700 (PDT) Message-ID: <79e0be67-341d-34cb-bb48-30f122d9e239@redhat.com> Date: Thu, 17 Mar 2022 13:29:09 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.6.2 Subject: Re: [PATCH v3 1/2] mm/memory-failure.c: avoid calling invalidate_inode_page() with unexpected pages To: Miaohe Lin , akpm@linux-foundation.org, naoya.horiguchi@nec.com, shy828301@gmail.com, mike.kravetz@oracle.com Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org References: <20220318073945.62164-1-linmiaohe@huawei.com> <20220318073945.62164-2-linmiaohe@huawei.com> From: David Hildenbrand Organization: Red Hat In-Reply-To: <20220318073945.62164-2-linmiaohe@huawei.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 X-Rspamd-Queue-Id: 9E9DF4000A X-Stat-Signature: qhsfpzwr7z85n8dgp1fwntjya5fomoxg X-Rspam-User: Authentication-Results: imf04.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=ckY2exzK; dmarc=pass (policy=none) header.from=redhat.com; spf=none (imf04.hostedemail.com: domain of david@redhat.com has no SPF policy when checking 170.10.133.124) smtp.mailfrom=david@redhat.com X-Rspamd-Server: rspam02 X-HE-Tag: 1647520155-880637 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 18.03.22 08:39, Miaohe Lin wrote: > invalidate_inode_page() can invalidate the pages in the swap cache because > the check of page->mapping != mapping is removed via Matthew's patch titled > "mm/truncate: Inline invalidate_complete_page() into its one caller". But > invalidate_inode_page() is not expected to deal with the pages in the swap > cache. Also non-lru movable page can reach here too. They're not page cache > pages. Skip these pages by checking PageSwapCache and PageLRU to fix this > unexpected issue. > > Signed-off-by: Miaohe Lin > --- > mm/memory-failure.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/mm/memory-failure.c b/mm/memory-failure.c > index 5444a8ef4867..ecf45961f3b6 100644 > --- a/mm/memory-failure.c > +++ b/mm/memory-failure.c > @@ -2178,7 +2178,7 @@ static int __soft_offline_page(struct page *page) > return 0; > } > > - if (!PageHuge(page)) > + if (!PageHuge(page) && PageLRU(page) && !PageSwapCache(page)) > /* > * Try to invalidate first. This should work for > * non dirty unmapped page cache pages. I'm not familiar with this code to ack this, but it looks sane to me. -- Thanks, David / dhildenb