linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Michal Hocko <mhocko@kernel.org>
To: Huaisheng HS1 Ye <yehs1@lenovo.com>
Cc: "akpm@linux-foundation.org" <akpm@linux-foundation.org>,
	"linux-mm@kvack.org" <linux-mm@kvack.org>,
	"willy@infradead.org" <willy@infradead.org>,
	"vbabka@suse.cz" <vbabka@suse.cz>,
	"mgorman@techsingularity.net" <mgorman@techsingularity.net>,
	"kstewart@linuxfoundation.org" <kstewart@linuxfoundation.org>,
	"alexander.levin@verizon.com" <alexander.levin@verizon.com>,
	"gregkh@linuxfoundation.org" <gregkh@linuxfoundation.org>,
	"colyli@suse.de" <colyli@suse.de>,
	NingTing Cheng <chengnt@lenovo.com>,
	Ocean HY1 He <hehy1@lenovo.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"iommu@lists.linux-foundation.org"
	<iommu@lists.linux-foundation.org>,
	"xen-devel@lists.xenproject.org" <xen-devel@lists.xenproject.org>,
	"linux-btrfs@vger.kernel.org" <linux-btrfs@vger.kernel.org>,
	Christoph Hellwig <hch@lst.de>
Subject: Re: [External]  Re: [RFC PATCH v2 00/12] get rid of GFP_ZONE_TABLE/BAD
Date: Mon, 28 May 2018 15:37:33 +0200	[thread overview]
Message-ID: <20180528133733.GF27180@dhcp22.suse.cz> (raw)
In-Reply-To: <HK2PR03MB1684ED6EC6859A88A196DC0C92690@HK2PR03MB1684.apcprd03.prod.outlook.com>

On Fri 25-05-18 09:43:09, Huaisheng HS1 Ye wrote:
> From: Michal Hocko [mailto:mhocko@kernel.org]
> Sent: Thursday, May 24, 2018 8:19 PM> 
> > > Let me try to reply your questions.
> > > Exactly, GFP_ZONE_TABLE is too complicated. I think there are two advantages
> > > from the series of patches.
> > >
> > > 1. XOR operation is simple and efficient, GFP_ZONE_TABLE/BAD need to do twice
> > > shift operations, the first is for getting a zone_type and the second is for
> > > checking the to be returned type is a correct or not. But with these patch XOR
> > > operation just needs to use once. Because the bottom 3 bits of GFP bitmask have
> > > been used to represent the encoded zone number, we can say there is no bad zone
> > > number if all callers could use it without buggy way. Of course, the returned
> > > zone type in gfp_zone needs to be no more than ZONE_MOVABLE.
> > 
> > But you are losing the ability to check for wrong usage. And it seems
> > that the sad reality is that the existing code do screw up.
> 
> In my opinion, originally there shouldn't be such many wrong
> combinations of these bottom 3 bits. For any user, whether or
> driver and fs, they should make a decision that which zone is they
> preferred. Matthew's idea is great, because with it the user must
> offer an unambiguous flag to gfp zone bits.

Well, I would argue that those shouldn't really care about any zones at
all. All they should carea bout is whether they really need a low mem
zone (aka directly accessible to the kernel), highmem or they are the
allocation is generally movable. Mixing zones into the picture just
makes the whole thing more complicated and error prone.
[...]
> > That being said. I am not saying that I am in love with GFP_ZONE_TABLE.
> > It always makes my head explode when I look there but it seems to work
> > with the current code and it is optimized for it. If you want to change
> > this then you should make sure you describe reasons _why_ this is an
> > improvement. And I would argue that "we can have more zones" is a
> > relevant one.
> 
> Yes, GFP_ZONE_TABLE is too complicated. The patches have 4 advantages as below.
> 
> * The address zone modifiers have new operation method, that is, user should decide which zone is preferred at first, then give the encoded zone number to bottom 3 bits in GFP mask. That is much direct and clear than before.
> 
> * No bad zone combination, because user should choose just one address zone modifier always.
> * Better performance and efficiency, current gfp_zone has to take shifting operation twice for GFP_ZONE_TABLE and GFP_ZONE_BAD. With these patches, gfp_zone() just needs one XOR.
> * Up to 8 zones can be used. At least it isn't a disadvantage, right?

This should be a part of the changelog. Please note that you should
provide some number if you claim performance benefits. The complexity
will always be subjective.
-- 
Michal Hocko
SUSE Labs

  reply	other threads:[~2018-05-28 16:13 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-21 15:20 Huaisheng Ye
2018-05-21 15:20 ` [RFC PATCH v2 01/12] include/linux/gfp.h: " Huaisheng Ye
2018-05-21 15:20 ` [RFC PATCH v2 02/12] arch/x86/kernel/amd_gart_64: update usage of address zone modifiers Huaisheng Ye
2018-05-22  9:38   ` Christoph Hellwig
2018-05-22 10:17     ` [External] " Huaisheng HS1 Ye
2018-05-21 15:20 ` [RFC PATCH v2 03/12] arch/x86/kernel/pci-calgary_64: " Huaisheng Ye
2018-05-21 15:20 ` [RFC PATCH v2 04/12] drivers/iommu/amd_iommu: " Huaisheng Ye
2018-05-21 15:20 ` [RFC PATCH v2 05/12] include/linux/dma-mapping: " Huaisheng Ye
2018-05-21 15:30   ` Christoph Hellwig
2018-05-21 15:20 ` [RFC PATCH v2 10/12] mm/zsmalloc: " Huaisheng Ye
2018-05-22 11:22   ` Matthew Wilcox
2018-05-22 11:51     ` [External] " Huaisheng HS1 Ye
2018-05-21 15:20 ` [RFC PATCH v2 11/12] include/linux/highmem: update usage of movableflags Huaisheng Ye
2018-05-21 15:20 ` [RFC PATCH v2 12/12] arch/x86/include/asm/page.h: " Huaisheng Ye
2018-05-22  9:40 ` [RFC PATCH v2 00/12] get rid of GFP_ZONE_TABLE/BAD Christoph Hellwig
2018-05-22 18:37 ` Michal Hocko
2018-05-23 16:07   ` [External] " Huaisheng HS1 Ye
2018-05-24 12:18     ` Michal Hocko
2018-05-25  9:43       ` Huaisheng HS1 Ye
2018-05-28 13:37         ` Michal Hocko [this message]
2018-05-30  9:02           ` Huaisheng HS1 Ye
2018-05-30  9:11             ` Christoph Hellwig
2018-05-30  9:12             ` Michal Hocko
2018-05-24  5:19   ` Matthew Wilcox
2018-05-24 12:23     ` Michal Hocko
2018-05-24 15:18       ` Matthew Wilcox
2018-05-24 15:29         ` Michal Hocko
2018-05-25 12:00           ` Matthew Wilcox
2018-05-28 13:33             ` Michal Hocko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180528133733.GF27180@dhcp22.suse.cz \
    --to=mhocko@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=alexander.levin@verizon.com \
    --cc=chengnt@lenovo.com \
    --cc=colyli@suse.de \
    --cc=gregkh@linuxfoundation.org \
    --cc=hch@lst.de \
    --cc=hehy1@lenovo.com \
    --cc=iommu@lists.linux-foundation.org \
    --cc=kstewart@linuxfoundation.org \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mgorman@techsingularity.net \
    --cc=vbabka@suse.cz \
    --cc=willy@infradead.org \
    --cc=xen-devel@lists.xenproject.org \
    --cc=yehs1@lenovo.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox