Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp1928944imm; Tue, 22 May 2018 11:38:01 -0700 (PDT) X-Google-Smtp-Source: AB8JxZrjYtzhD4v2UOJvQSZ/hmaDrReIH4rcf+SzWA/i3OJS135sWp92o/BkDia52KE2gvx593tm X-Received: by 2002:a63:6105:: with SMTP id v5-v6mr1476091pgb.299.1527014281389; Tue, 22 May 2018 11:38:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527014281; cv=none; d=google.com; s=arc-20160816; b=MXmr59D1fh9KfyAB5MMxR7uCAHBQyLGsPbGVBasydrvzpqZwx33iZ4BsATvt+jZRnY kLDbekauTvK2EOWoseDgEvyEOrSOkG7CfRR1IEz0d+Xl1q3bv+68r8zFxjztw7R87Ofr PtlihEiR3Y/wGbKLoWH99jYsLK2soBeYMo9/QnJGY03V6jZQuq+t+Hqy7ohWrR+mNz1H Altjf6l7zBfwXXVISMNyuDxNcnrExcbFjUDDp3SzPHt3dNkDYwRk7WJwsTIW2Yjj0oWw jz7Am/MpRmIH9iVJhGv1AvomP1Ibo0Yfj9hP+UYWFR/Mr1OJ507sh8a4iCjFpvCvgiQL +Xkg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=HZuKra0fDqwyhz+NCO52fr2dgdgcob6kAYmEjee13pk=; b=TBjYaWG/kOC4a6s2XBAFjbB0tQl6f2Ad3l3v2MMDjMyeNZCNhmfpRpEBzVTMxqPi48 xShpi8+jAY/6kozb0HXjSMH9lTdzFrOkxt1BgYLwOzdYeWvs50Bw/YsROkkkfBD7ch3U dmUYIiX3ZQIhtRs5I2dGgQImfFxCri28dIPH7Lx62ILpOlhqGw8FKnuhbYFgiWF8Ajok WvBbFxl0bRpPGP4HtSefVVgpxamOnc56/Aq71XWFVZl2p+RNbtuZiYFtI7aoy+oWVveA TlJHFcBinkmBqg024ohoYwrZ+Wd/oxgU+C/RD//lQWXb2XboY35N9MTbhoaeuFMeGzZl H0gA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s6-v6si13727377pgr.369.2018.05.22.11.37.46; Tue, 22 May 2018 11:38:01 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751539AbeEVShd (ORCPT + 99 others); Tue, 22 May 2018 14:37:33 -0400 Received: from mx2.suse.de ([195.135.220.15]:38796 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751277AbeEVShb (ORCPT ); Tue, 22 May 2018 14:37:31 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 25E6AACA7; Tue, 22 May 2018 18:37:30 +0000 (UTC) Date: Tue, 22 May 2018 20:37:28 +0200 From: Michal Hocko To: Huaisheng Ye Cc: akpm@linux-foundation.org, linux-mm@kvack.org, willy@infradead.org, vbabka@suse.cz, mgorman@techsingularity.net, kstewart@linuxfoundation.org, alexander.levin@verizon.com, gregkh@linuxfoundation.org, colyli@suse.de, chengnt@lenovo.com, hehy1@lenovo.com, linux-kernel@vger.kernel.org, iommu@lists.linux-foundation.org, xen-devel@lists.xenproject.org, linux-btrfs@vger.kernel.org, Huaisheng Ye Subject: Re: [RFC PATCH v2 00/12] get rid of GFP_ZONE_TABLE/BAD Message-ID: <20180522183728.GB20441@dhcp22.suse.cz> References: <1526916033-4877-1-git-send-email-yehs2007@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1526916033-4877-1-git-send-email-yehs2007@gmail.com> User-Agent: Mutt/1.9.5 (2018-04-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon 21-05-18 23:20:21, Huaisheng Ye wrote: > From: Huaisheng Ye > > Replace GFP_ZONE_TABLE and GFP_ZONE_BAD with encoded zone number. > > Delete ___GFP_DMA, ___GFP_HIGHMEM and ___GFP_DMA32 from GFP bitmasks, > the bottom three bits of GFP mask is reserved for storing encoded > zone number. > > The encoding method is XOR. Get zone number from enum zone_type, > then encode the number with ZONE_NORMAL by XOR operation. > The goal is to make sure ZONE_NORMAL can be encoded to zero. So, > the compatibility can be guaranteed, such as GFP_KERNEL and GFP_ATOMIC > can be used as before. > > Reserve __GFP_MOVABLE in bit 3, so that it can continue to be used as > a flag. Same as before, __GFP_MOVABLE respresents movable migrate type > for ZONE_DMA, ZONE_DMA32, and ZONE_NORMAL. But when it is enabled with > __GFP_HIGHMEM, ZONE_MOVABLE shall be returned instead of ZONE_HIGHMEM. > __GFP_ZONE_MOVABLE is created to realize it. > > With this patch, just enabling __GFP_MOVABLE and __GFP_HIGHMEM is not > enough to get ZONE_MOVABLE from gfp_zone. All callers should use > GFP_HIGHUSER_MOVABLE or __GFP_ZONE_MOVABLE directly to achieve that. > > Decode zone number directly from bottom three bits of flags in gfp_zone. > The theory of encoding and decoding is, > A ^ B ^ B = A So why is this any better than the current code. Sure I am not a great fan of GFP_ZONE_TABLE because of how it is incomprehensible but this doesn't look too much better, yet we are losing a check for incompatible gfp flags. The diffstat looks really sound but then you just look and see that the large part is the comment that at least explained the gfp zone modifiers somehow and the debugging code. So what is the selling point? > Changes since v1, > > v2: Add __GFP_ZONE_MOVABLE and modify GFP_HIGHUSER_MOVABLE to help > callers to get ZONE_MOVABLE. Add __GFP_ZONE_MASK to mask lowest 3 > bits of GFP bitmasks. > Modify some callers' gfp flag to update usage of address zone > modifiers. > Modify inline function gfp_zone to get better performance according > to Matthew's suggestion. > > Link: https://marc.info/?l=linux-mm&m=152596791931266&w=2 > > Huaisheng Ye (12): > include/linux/gfp.h: get rid of GFP_ZONE_TABLE/BAD > arch/x86/kernel/amd_gart_64: update usage of address zone modifiers > arch/x86/kernel/pci-calgary_64: update usage of address zone modifiers > drivers/iommu/amd_iommu: update usage of address zone modifiers > include/linux/dma-mapping: update usage of address zone modifiers > drivers/xen/swiotlb-xen: update usage of address zone modifiers > fs/btrfs/extent_io: update usage of address zone modifiers > drivers/block/zram/zram_drv: update usage of address zone modifiers > mm/vmpressure: update usage of address zone modifiers > mm/zsmalloc: update usage of address zone modifiers > include/linux/highmem: update usage of movableflags > arch/x86/include/asm/page.h: update usage of movableflags > > arch/x86/include/asm/page.h | 3 +- > arch/x86/kernel/amd_gart_64.c | 2 +- > arch/x86/kernel/pci-calgary_64.c | 2 +- > drivers/block/zram/zram_drv.c | 6 +-- > drivers/iommu/amd_iommu.c | 2 +- > drivers/xen/swiotlb-xen.c | 2 +- > fs/btrfs/extent_io.c | 2 +- > include/linux/dma-mapping.h | 2 +- > include/linux/gfp.h | 98 +++++----------------------------------- > include/linux/highmem.h | 4 +- > mm/vmpressure.c | 2 +- > mm/zsmalloc.c | 4 +- > 12 files changed, 26 insertions(+), 103 deletions(-) > > -- > 1.8.3.1 > -- Michal Hocko SUSE Labs