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 0F12CC433EF for ; Thu, 19 May 2022 18:31:15 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 899596B0071; Thu, 19 May 2022 14:31:15 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 847DF6B0072; Thu, 19 May 2022 14:31:15 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 710366B0073; Thu, 19 May 2022 14:31:15 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 6300D6B0071 for ; Thu, 19 May 2022 14:31:15 -0400 (EDT) Received: from smtpin07.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 446506EC for ; Thu, 19 May 2022 18:31:15 +0000 (UTC) X-FDA: 79483334910.07.C98E82D Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf17.hostedemail.com (Postfix) with ESMTP id 5BBCE4000A for ; Thu, 19 May 2022 18:30:49 +0000 (UTC) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id B9A4C61ABC; Thu, 19 May 2022 18:31:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 056F7C385AA; Thu, 19 May 2022 18:31:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1652985073; bh=Ta58ypg7C5RBl1jeQLPbuw2Br2B3B7e2eFsbiZbyb/c=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=qV2NUoxuWXcRHtsTtE16jglBzLifEm1hc82saNbVjqE8zFxJuONumCqs8vg5m2aaJ 6klJ4udHdL5wK0gzPhbOh+uRNKv7zUNgmNFoegFBC4rceAwr7DNJvpEhWf4kxGh5+E 1/uUVWSEhk1Pn8d6qMQu56EOncp3uAhclZc01FzA= Date: Thu, 19 May 2022 11:31:12 -0700 From: Andrew Morton To: Miaohe Lin Cc: Vitaly Wool , Linux-MM , LKML Subject: Re: [PATCH 5/9] revert "mm/z3fold.c: allow __GFP_HIGHMEM in z3fold_alloc" Message-Id: <20220519113112.7531614a96dc4852ba61fdbc@linux-foundation.org> In-Reply-To: References: <20220429064051.61552-1-linmiaohe@huawei.com> <20220429064051.61552-6-linmiaohe@huawei.com> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.33; x86_64-redhat-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: 5BBCE4000A X-Stat-Signature: x1cdqif8wgfzmdf8rjf5b87xdcf67far X-Rspam-User: Authentication-Results: imf17.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=korg header.b=qV2NUoxu; spf=pass (imf17.hostedemail.com: domain of akpm@linux-foundation.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=akpm@linux-foundation.org; dmarc=none X-HE-Tag: 1652985049-935048 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 Thu, 19 May 2022 19:34:01 +0800 Miaohe Lin wrote: > 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? > Yes, page_address() against a highmem page only works if that page has been mapped into pagetables with kmap() or kmap_atomic(), and z3fold doesn't appear to do that. Given that other zpool_driver implementations do appear to support highmem pages, I expect that z3fold should be taught likewise. I didn't look very hard, but this particular patch is a bit worrisome. As I understand it, zswap can enable highmem: if (zpool_malloc_support_movable(entry->pool->zpool)) gfp |= __GFP_HIGHMEM | __GFP_MOVABLE; and z3fold will silently ignore the __GFP_HIGHMEM, which is OK. But with this patch, z3fold will now return -EINVAL, so existing setups will start failing?