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 X-Spam-Level: X-Spam-Status: No, score=-5.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DCFB9C433B4 for ; Fri, 9 Apr 2021 07:07:09 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 3AA5D610FC for ; Fri, 9 Apr 2021 07:07:09 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3AA5D610FC Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=huawei.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 97CAC6B006C; Fri, 9 Apr 2021 03:07:08 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 92E016B006E; Fri, 9 Apr 2021 03:07:08 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7CD616B0070; Fri, 9 Apr 2021 03:07:08 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0085.hostedemail.com [216.40.44.85]) by kanga.kvack.org (Postfix) with ESMTP id 600246B006C for ; Fri, 9 Apr 2021 03:07:08 -0400 (EDT) Received: from smtpin09.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 1118F9439 for ; Fri, 9 Apr 2021 07:07:08 +0000 (UTC) X-FDA: 78011946936.09.CC9A9F4 Received: from szxga06-in.huawei.com (szxga06-in.huawei.com [45.249.212.32]) by imf02.hostedemail.com (Postfix) with ESMTP id D867340002D7 for ; Fri, 9 Apr 2021 07:06:56 +0000 (UTC) Received: from DGGEMS402-HUB.china.huawei.com (unknown [172.30.72.60]) by szxga06-in.huawei.com (SkyGuard) with ESMTP id 4FGpzv1r3pzlWvJ; Fri, 9 Apr 2021 15:05:15 +0800 (CST) Received: from [10.174.179.9] (10.174.179.9) by DGGEMS402-HUB.china.huawei.com (10.3.19.202) with Microsoft SMTP Server id 14.3.498.0; Fri, 9 Apr 2021 15:07:01 +0800 Subject: Re: [PATCH 4/4] mm/hugeltb: handle the error case in hugetlb_fix_reserve_counts() To: Andrew Morton CC: Mike Kravetz , , , , References: <20210402093249.25137-1-linmiaohe@huawei.com> <20210402093249.25137-5-linmiaohe@huawei.com> <20210408220453.f95942bf20baadd8dbbc1488@linux-foundation.org> From: Miaohe Lin Message-ID: Date: Fri, 9 Apr 2021 15:07:00 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.6.0 MIME-Version: 1.0 In-Reply-To: <20210408220453.f95942bf20baadd8dbbc1488@linux-foundation.org> Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.174.179.9] X-CFilter-Loop: Reflected X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: D867340002D7 X-Stat-Signature: rtrfinqgsn4i5wz5skfs6rp9d63osyf7 Received-SPF: none (huawei.com>: No applicable sender policy available) receiver=imf02; identity=mailfrom; envelope-from=""; helo=szxga06-in.huawei.com; client-ip=45.249.212.32 X-HE-DKIM-Result: none/none X-HE-Tag: 1617952016-497601 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 2021/4/9 13:04, Andrew Morton wrote: > On Fri, 9 Apr 2021 11:17:49 +0800 Miaohe Lin wrote: > >> On 2021/4/9 7:25, Mike Kravetz wrote: >>> On 4/2/21 2:32 AM, Miaohe Lin wrote: >>>> A rare out of memory error would prevent removal of the reserve map region >>>> for a page. hugetlb_fix_reserve_counts() handles this rare case to avoid >>>> dangling with incorrect counts. Unfortunately, hugepage_subpool_get_pages >>>> and hugetlb_acct_memory could possibly fail too. We should correctly handle >>>> these cases. >>> >>> Yes, this is a potential issue. >>> >>> The 'good news' is that hugetlb_fix_reserve_counts() is unlikely to ever >>> be called. To do so would imply we could not allocate a region entry >>> which is only 6 words in size. We also keep a 'cache' of entries so we >>> may not even need to allocate. >>> >>> But, as mentioned it is a potential issue. >> >> Yes, a potential *theoretical* issue. >> >>> >>>> Fixes: b5cec28d36f5 ("hugetlbfs: truncate_hugepages() takes a range of pages") >>> >>> This is likely going to make this get picked by by stable releases. >>> That is unfortunate as mentioned above this is mostly theoretical. >>> >> >> I will drop this. This does not worth backport. >> > > -stable have been asked not to backport MM patches unless MM patches > include "cc:stable". ie, no making our backporting decisions for us, > please. > Sorry about it! I would retain the Fixes tag. Many thanks for pointing this out. > . >