Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp3267534imm; Fri, 25 May 2018 02:43:54 -0700 (PDT) X-Google-Smtp-Source: AB8JxZrgCEQTT5BpedgB/kwXRnwuMUXI+Q9Bfmyc+aLcxdO25cRJ1S7Iw/N4gv9j+utmOWPFLb2A X-Received: by 2002:a17:902:6bc1:: with SMTP id m1-v6mr1841414plt.91.1527241433950; Fri, 25 May 2018 02:43:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527241433; cv=none; d=google.com; s=arc-20160816; b=QgY5jozm56cOhlm0RLRVMBqPHEYzZFea+bBTLob1VVoipShKwlgrWo+fxY9XIs4sHb YdNYmrBKSCZpmoiPR1Rno/HkPbPquy4A5w7t3CbMn3O1XfhZ48jz6tDKQZJbEuHK6Mfu zCknCwFZmLYpgc/yvjlSTm7RLNgXFfjwv8Ee3w32x5xnH6sygzM0Hkszgl5b8K2oHnZN LJsaoCUotRi3RWqfJnxRaHayZxaTgGQjNdYYteABm2zB8w09956kOnbTuJc2W9lIxMAx FIJt2P8O0xy+vIQgDBF9/+3vBPM1w0lKfsRC8e1kUxdhOA+bIMFZIKvUQFTARWmj4NTY zgIg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :spamdiagnosticmetadata:spamdiagnosticoutput:content-language :accept-language:in-reply-to:references:message-id:date:thread-index :thread-topic:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=V5QycdgQJC3OlXAq3xIsB0uHiWhlPP7Y1f9qkJvX/gc=; b=vrYIj2yTpmJnEl0IBg07YF62iaP8YUI4ZEci70mGW+2SyAJTLNHDGdR2tvp/ghzKHj PaI1Weg5S6fqDWxykR43RBZYFXu2xvcqGSombmcGJ473nerIi4jsFFeCFSfnFBJsjxXj 4CyWIcQvNPDGW9suA9svMNgFX4Kic6vH2tzfw+QVIZzqB714IM90FuuwNFiUOifhvsXK FXsmQ3IAficWST1wyuAPKtDuR9Omv/w0qLajpEK1pN/UkoCrD6G6GUXvzRBVBrhTRsUO 2OrXPr8YDrLhNBuSvLEHeNSjdWgIaS4Qu5FN90eojzolMrILSWfEr4xMtqql+igxRjDN THig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@LenovoBeijing.onmicrosoft.com header.s=selector1-lenovo-com header.b=Dy10svHo; 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=lenovo.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y5-v6si15492989pgq.276.2018.05.25.02.43.38; Fri, 25 May 2018 02:43:53 -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; dkim=pass header.i=@LenovoBeijing.onmicrosoft.com header.s=selector1-lenovo-com header.b=Dy10svHo; 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=lenovo.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965405AbeEYJn2 (ORCPT + 99 others); Fri, 25 May 2018 05:43:28 -0400 Received: from mail1.bemta12.messagelabs.com ([216.82.251.2]:31948 "EHLO mail1.bemta12.messagelabs.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965130AbeEYJnZ (ORCPT ); Fri, 25 May 2018 05:43:25 -0400 Received: from [216.82.251.40] (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256 bits)) by server-2.bemta-12.messagelabs.com id AF/DF-15744-ABAD70B5; Fri, 25 May 2018 09:43:22 +0000 X-Brightmail-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UDPdWh8N6i9oG1FS8Fi2oqpCqsoTl/vunlUNS3xDr/4e0jq9eVrt9YsXVx2s1X7u0Nxg Kdxx40F26M/hA2DTx98yp/aE1iOrc4/rinp27268WDu0Z+GS3P//S9lXYjIUuCOQ93ycI/UQm eJyMEAAA= X-Env-Sender: yehs1@lenovo.com X-Msg-Ref: server-7.tower-168.messagelabs.com!1527241399!70494808!1 X-Originating-IP: [104.232.225.2] X-SYMC-ESS-Client-Auth: outbound-route-from=pass X-StarScan-Received: X-StarScan-Version: 9.9.15; banners=-,-,- X-VirusChecked: Checked Received: (qmail 80578 invoked from network); 25 May 2018 09:43:22 -0000 Received: from unknown (HELO maesmtp01.lenovo.com) (104.232.225.2) by server-7.tower-168.messagelabs.com with DHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 25 May 2018 09:43:22 -0000 Received: from USEXEDGE02.lenovo.com (unknown [10.62.65.5]) by maesmtp01.lenovo.com with smtp (TLS: TLSv1/SSLv3,256bits,ECDHE-RSA-AES256-SHA) id 372d_dacf_a58411a6_daa9_40e9_a9d8_65bef7ce0f22; Fri, 25 May 2018 09:43:13 +0000 Received: from APC01-PU1-obe.outbound.protection.outlook.com (65.55.88.23) by USEXEDGE02.lenovo.com (10.62.65.5) with Microsoft SMTP Server (TLS) id 14.3.123.3; Fri, 25 May 2018 05:43:13 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=LenovoBeijing.onmicrosoft.com; s=selector1-lenovo-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=V5QycdgQJC3OlXAq3xIsB0uHiWhlPP7Y1f9qkJvX/gc=; b=Dy10svHoa0zVhRAt3bUV7tiTTdvhQrd/FuGaoLOIkv1kD7Zg48tWlEQxzGfwj6sP+vgXNG68HLoaUeGc+XWts69sVLtZzpkerPKMok1r6SoV7pjWu/1ItLtGm9Vbm0j3f4ncqpCdadkWShsCFCJySXSNmQPJHn73WcBnLNytbvk= Received: from HK2PR03MB1684.apcprd03.prod.outlook.com (10.165.178.14) by HK2PR03MB1362.apcprd03.prod.outlook.com (10.165.56.28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.820.5; Fri, 25 May 2018 09:43:11 +0000 Received: from HK2PR03MB1684.apcprd03.prod.outlook.com ([fe80::bd0b:1233:5126:db12]) by HK2PR03MB1684.apcprd03.prod.outlook.com ([fe80::bd0b:1233:5126:db12%5]) with mapi id 15.20.0797.011; Fri, 25 May 2018 09:43:10 +0000 From: Huaisheng HS1 Ye To: Michal Hocko 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 Thread-Topic: [External] Re: [RFC PATCH v2 00/12] get rid of GFP_ZONE_TABLE/BAD Thread-Index: AQHT8fwDC41BG7Nw7kKYsFRFURgRZqQ9b40ggAFfPYCAAVqTEA== Date: Fri, 25 May 2018 09:43:09 +0000 Message-ID: References: <1526916033-4877-1-git-send-email-yehs2007@gmail.com> <20180522183728.GB20441@dhcp22.suse.cz> <20180524121853.GG20441@dhcp22.suse.cz> In-Reply-To: <20180524121853.GG20441@dhcp22.suse.cz> Accept-Language: zh-CN, en-US Content-Language: zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [114.253.18.226] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;HK2PR03MB1362;7:35iKEqCoI/SWozhr6NnUfJUPFd4+0Qi8zsVe4PgT6KO0/ThlssgFW+jGWH8/wHTr/b3232uJNFg7dfe0zD5H+ItRzGs2LPm0vCFdJJHfV6sfoeEIHWIKfre/z4I/C7heW9Evq4kIEZpnQFRhG19nKJXmxU6RpU1FAi8V+He3yRC8ukY+DAOmZuUGrDwkGZeCq44AXoE09fnfCwLrvec+DR+xr819J+K/g3JZlln2wGNscU+9Aj7rp8AWSU2dl4fY;20:ZrEiUD/muCY0Egc54FzJ/2Kx4NwqYm7qXMYvaxAVTYK7ByDxNBf3zu4IQNNrjZjfG3fRnvXrM45R81sOVvz4UORw4sonmtZ90ELBzEam3nhf6+XTzbB9Oqzt/6vFA5reeotR5wFUC8b9UBAwYnMVacsk97uYWWqS5MVnRsD9Jbqnq7iZWvidkeDC4HtG1ieNWxlLpN+zGvxFsl0Gd09yK6ERzNli3UaGPP+BvD+C/lUIsVUd7+C8/UgS0EiAvaiiV0rMAWiCZZfMjmC79Wbk1t/qZxCwlvD90dm4O/m8S3pfMufNT+f1GK/dP5qHph2RemKNwlHYSsLvLPGvmOR+9A== x-ms-exchange-antispam-srfa-diagnostics: SOS;SOR; x-forefront-antispam-report: SFV:SKI;SCL:-1;SFV:NSPM;SFS:(10019020)(39860400002)(39380400002)(376002)(366004)(346002)(396003)(189003)(199004)(76176011)(59450400001)(9686003)(6506007)(102836004)(6116002)(3846002)(229853002)(186003)(6436002)(26005)(25786009)(5250100002)(5660300001)(486006)(6916009)(86362001)(3280700002)(8936002)(97736004)(7416002)(478600001)(3660700001)(14454004)(81166006)(81156014)(55016002)(446003)(11346002)(74316002)(33656002)(305945005)(476003)(8676002)(7736002)(93886005)(68736007)(316002)(54906003)(4326008)(99286004)(66066001)(7696005)(6246003)(2906002)(2900100001)(53936002)(106356001)(105586002)(26583001)(217873001);DIR:OUT;SFP:1102;SCL:1;SRVR:HK2PR03MB1362;H:HK2PR03MB1684.apcprd03.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:1; x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(5600026)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020);SRVR:HK2PR03MB1362; x-ms-traffictypediagnostic: HK2PR03MB1362: x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:; x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(6040522)(2401047)(8121501046)(5005006)(3231254)(944501410)(52105095)(93006095)(93001095)(3002001)(10201501046)(149027)(150027)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123562045)(20161123560045)(20161123558120)(6072148)(201708071742011)(7699016);SRVR:HK2PR03MB1362;BCL:0;PCL:0;RULEID:;SRVR:HK2PR03MB1362; x-forefront-prvs: 06833C6A67 received-spf: None (protection.outlook.com: lenovo.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: 3RRMXl47Dqq/bKKO+0kCmCt7OmTcFsNwwi1jljLEhFZP7BXsi2dq8I55Q7ryS64gKAYr9RE5G+m5Sh2jC6MsyUVHgnDVAM76zCqy3FjTjbmCjrrpP3YFjjIsh9v5W7EP0HHF1h/rCtQzEMDsizxA5DBTcgfZU9kvJSMfj5rkIOZVad/tcKOy6nGhi9cIfXHW spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: b956728e-65b3-44f6-a97d-08d5c223ed21 X-MS-Exchange-CrossTenant-Network-Message-Id: b956728e-65b3-44f6-a97d-08d5c223ed21 X-MS-Exchange-CrossTenant-originalarrivaltime: 25 May 2018 09:43:10.0332 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 5c7d0b28-bdf8-410c-aa93-4df372b16203 X-MS-Exchange-Transport-CrossTenantHeadersStamped: HK2PR03MB1362 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Michal Hocko [mailto:mhocko@kernel.org] Sent: Thursday, May 24, 2018 8:19 PM>=20 > > Let me try to reply your questions. > > Exactly, GFP_ZONE_TABLE is too complicated. I think there are two advan= tages > > 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 i= s for > > checking the to be returned type is a correct or not. But with these pa= tch XOR > > operation just needs to use once. Because the bottom 3 bits of GFP bitm= ask 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 re= turned > > zone type in gfp_zone needs to be no more than ZONE_MOVABLE. >=20 > 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 o= f 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. Ideally, before any user wants to modify the address zone modifier, they sh= ould clear it firstly, then ORing the GFP zone flag which comes from the zo= ne they prefer. With these patches, we can loudly announce that, the bottom 3 bits of zone = mask couldn't accept internal ORing operations. The operations like __GFP_DMA | __GFP_DMA32 | __GFP_HIGHMEM is illegal. The= current GFP_ZONE_TABLE is precisely the root of this problem, that is __GF= P_DMA, __GFP_DMA32 and __GFP_HIGHMEM are formatted as 0x1, 0x2 and 0x4. >=20 > > 2. GFP_ZONE_TABLE has limit with the amount of zone types. Current GFP_= ZONE_TABLE > > is 32 bits, in general, there are 4 zone types for most ofX86_64 platfo= rm, they > > are ZONE_DMA, ZONE_DMA32, ZONE_NORMAL and ZONE_MOVABLE. If we want to e= xpand the > > amount of zone types to larger than 4, the zone shift should be 3. >=20 > But we do not want to expand the number of zones IMHO. The existing zoo > is quite a maint. pain. >=20 > 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 be= low. * The address zone modifiers have new operation method, that is, user shoul= d decide which zone is preferred at first, then give the encoded zone numbe= r 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, gf= p_zone() just needs one XOR. * Up to 8 zones can be used. At least it isn't a disadvantage, right? Sincerely, Huaisheng Ye