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 4DCE3C433F5 for ; Thu, 19 May 2022 11:34:07 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 983656B0072; Thu, 19 May 2022 07:34:06 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 9354B6B0073; Thu, 19 May 2022 07:34:06 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 821D16B0074; Thu, 19 May 2022 07:34:06 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 71F776B0072 for ; Thu, 19 May 2022 07:34:06 -0400 (EDT) Received: from smtpin01.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay13.hostedemail.com (Postfix) with ESMTP id 1245560A60 for ; Thu, 19 May 2022 11:34:06 +0000 (UTC) X-FDA: 79482283692.01.8CD8954 Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by imf18.hostedemail.com (Postfix) with ESMTP id E366A1C00C2 for ; Thu, 19 May 2022 11:33:50 +0000 (UTC) Received: from canpemm500002.china.huawei.com (unknown [172.30.72.53]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4L3nlW3JTrz1JCKN; Thu, 19 May 2022 19:32:39 +0800 (CST) Received: from [10.174.177.76] (10.174.177.76) by canpemm500002.china.huawei.com (7.192.104.244) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Thu, 19 May 2022 19:34:01 +0800 Subject: Re: [PATCH 5/9] revert "mm/z3fold.c: allow __GFP_HIGHMEM in z3fold_alloc" To: Vitaly Wool CC: Andrew Morton , Linux-MM , LKML References: <20220429064051.61552-1-linmiaohe@huawei.com> <20220429064051.61552-6-linmiaohe@huawei.com> From: Miaohe Lin Message-ID: Date: Thu, 19 May 2022 19:34:01 +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: Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.174.177.76] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To canpemm500002.china.huawei.com (7.192.104.244) X-CFilter-Loop: Reflected X-Stat-Signature: 5psxf9wb941imgycb7nq8o8t8joertee Authentication-Results: imf18.hostedemail.com; dkim=none; spf=pass (imf18.hostedemail.com: domain of linmiaohe@huawei.com designates 45.249.212.255 as permitted sender) smtp.mailfrom=linmiaohe@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com X-Rspam-User: X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: E366A1C00C2 X-HE-Tag: 1652960030-366465 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 2022/5/19 15:12, Vitaly Wool wrote: > On Fri, Apr 29, 2022 at 8:41 AM Miaohe Lin wrote: >> >> Revert commit f1549cb5ab2b ("mm/z3fold.c: allow __GFP_HIGHMEM in >> z3fold_alloc"). >> >> z3fold can't support GFP_HIGHMEM page now. page_address is used >> directly at all places. Moreover, z3fold_header is on per cpu >> unbuddied list which could be access anytime. So we should rid >> the support of GFP_HIGHMEM allocation for z3fold. > > Could you please clarify how kmem_cache is affected here? With this code changes, kmem_cache should be unaffected. HIGHMEM is still not supported for kmem_cache just like before but caller ensures __GFP_HIGHMEM is not passed in now. The issue I want to fix here is that if z3fold page is allocated from highmem, page_address can't be used directly. Did I answer your question? Or don't I get your point? Thanks! > > Thanks, > Vitaly Many thanks for your time! :) > >> Signed-off-by: Miaohe Lin >> --- >> mm/z3fold.c | 8 +++----- >> 1 file changed, 3 insertions(+), 5 deletions(-) >> >> diff --git a/mm/z3fold.c b/mm/z3fold.c >> index b3b4e65c107f..5f5d5f1556be 100644 >> --- a/mm/z3fold.c >> +++ b/mm/z3fold.c >> @@ -212,10 +212,8 @@ static int size_to_chunks(size_t size) >> static inline struct z3fold_buddy_slots *alloc_slots(struct z3fold_pool *pool, >> gfp_t gfp) >> { >> - struct z3fold_buddy_slots *slots; >> - >> - slots = kmem_cache_zalloc(pool->c_handle, >> - (gfp & ~(__GFP_HIGHMEM | __GFP_MOVABLE))); >> + struct z3fold_buddy_slots *slots = kmem_cache_zalloc(pool->c_handle, >> + gfp); >> >> if (slots) { >> /* It will be freed separately in free_handle(). */ >> @@ -1075,7 +1073,7 @@ static int z3fold_alloc(struct z3fold_pool *pool, size_t size, gfp_t gfp, >> enum buddy bud; >> bool can_sleep = gfpflags_allow_blocking(gfp); >> >> - if (!size) >> + if (!size || (gfp & __GFP_HIGHMEM)) >> return -EINVAL; >> >> if (size > PAGE_SIZE) >> -- >> 2.23.0 >> > . >