Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp2500861imm; Mon, 28 May 2018 09:15:28 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpwEzrrtmntacqdKOAd/FIZX3+4q2W/6QKOngicidqFUHzkpWKxTfnTAPU2+sKgw6q7YAXY X-Received: by 2002:a17:902:758d:: with SMTP id j13-v6mr14412260pll.188.1527524128268; Mon, 28 May 2018 09:15:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527524128; cv=none; d=google.com; s=arc-20160816; b=aFaUaRbbexPx2DLjGQu71hOnPKH5nOX0Wq4Qqzt7NUIBJPp7O78Ht+pkGTCXkOQ+HF EkKaaOknEB305v79/AZCJ85ou3Ghm5sApiNd7iY7e4oDqfOuMbFjQCP6zql+4lORMP49 2hW1I4M+UKoM/XNZ+HZ2kyGv3e/0Uqk6K3O/MZ6pq7BnpWb5gh789Qajkoafn5WrkCpA XTWS16Vvb39nbPt50GIktuPYkbErY6tXEJSbHSSNhcTXJsKh1RW9o+Lw5s2FV40JkG3z Mq+gZSH3F6/3AV500uKRxb/nFp47o44paoFN2+riQ9TRQ+X3NITKhYY9a3zl0b67fpWL N48g== 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=RONeA9YISLBdNB88CEFtPakaBzFe/9aEkV9s+oo1I8s=; b=dayiw8uKUHOpzkYzdrMwsW031+Iy7RX7JI01tJZkTBazYFUSLE6vDgoQThaOYbNJ8w qh9xFbypfJ1FcEo+/P80GlJHjnNsrNLs1gxQF0qnv4KHmCBQfGT3IOb+7PeE3B+B9fqr 7FZL0e7ns5O1NlaEOxiq6pydpFuRIng6/Q1zxXvB5gUaFFO3kl6lfq/VgzZoyIcMwIie mIELnYjiyCLv5oAMUBc8wo3ZLe+X09Ra+UVDkril/0VACFbbYlc2P/h0fd5sxSdce8yO h9urdYn9zdFsA5tlX/3PQUZVGRsM4UOlBfKdfCo8qN623PZ7kjqHEWUdVhCM8nnBfnBz k/pw== 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 j7-v6si30051231pfj.267.2018.05.28.09.15.13; Mon, 28 May 2018 09:15:28 -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 S939859AbeE1QOR (ORCPT + 99 others); Mon, 28 May 2018 12:14:17 -0400 Received: from mx2.suse.de ([195.135.220.15]:49816 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S936806AbeE1QNu (ORCPT ); Mon, 28 May 2018 12:13:50 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (charybdis-ext-too.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 08D7CAE2A; Mon, 28 May 2018 16:13:47 +0000 (UTC) Date: Mon, 28 May 2018 15:37:33 +0200 From: Michal Hocko To: Huaisheng HS1 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" , NingTing Cheng , Ocean HY1 He , "linux-kernel@vger.kernel.org" , "iommu@lists.linux-foundation.org" , "xen-devel@lists.xenproject.org" , "linux-btrfs@vger.kernel.org" , Christoph Hellwig Subject: Re: [External] Re: [RFC PATCH v2 00/12] get rid of GFP_ZONE_TABLE/BAD Message-ID: <20180528133733.GF27180@dhcp22.suse.cz> References: <1526916033-4877-1-git-send-email-yehs2007@gmail.com> <20180522183728.GB20441@dhcp22.suse.cz> <20180524121853.GG20441@dhcp22.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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 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