Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp925023ybi; Fri, 12 Jul 2019 06:50:44 -0700 (PDT) X-Google-Smtp-Source: APXvYqzu/jK7TucwmKlNY7iiYAldFC+fv+WyPYJWSTd5iWyF3NMIXyn5eQBfG2qWdpCi8bFERvlz X-Received: by 2002:a17:902:a5c7:: with SMTP id t7mr11789197plq.288.1562939444640; Fri, 12 Jul 2019 06:50:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562939444; cv=none; d=google.com; s=arc-20160816; b=S4blk4B3rfuxq7bqdBdv5x5YI49HjDpo6clkLeyBknhNrPWseOT/COBf6ykju28Pnl KGQJjPSiZOijpxocK4QNrA+Op3CV/B77D5s+nd57G9Xq2NTYOAdKwaQQ37jsitinj3vW CIMc2kwU1ypQe6EfFgwPjsOApCaEqdnce7UIH9scLlZrSnRWugnAzVlVB9R7QzvKj98b zHA/YdZmmMRc82hnGqIAL9/tnOAntKN5Vm1cAsKPvdLufLUtc7VHYrOdWZoRghoxZYuf 4aobyuww9bCDumfSuMWk6xo3GqmTjgC5FsZK1nIpQZt7QG1l/wKeD8TMTo3MU4RTY/XH uNVA== 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:dkim-signature; bh=fnnfXjFvjoDoIQnQuaRvGkZvYrw5HXbBFVcsaXovgKE=; b=sEGI5QiZ+spzkeD/iwoeWi9Jg+iGkUDjIR/jaOW9kEOHX9ZlMT5MrSYax3NdQL/9m6 UTXFRx7mV2v3tgTdqHEEpV9EJxxKIBM22AwUOtaewkuATF+Wz4k6c84l6VDPAFPQpt4Y ZaSZ4IRDm/U2bCKvvK/2VG9pmcOE4zxvGXHVIbiUz4ea7bMdGu3oeNZL/xudpMiJp6bu X8it3kSqMMUAXKLngUZDIzg8+3hu8HC5VuDcd0SNUZP3boV1kHXORrNBSroobe6e6OT6 XuxL5QrNQLPsbO6ZmtLpj9X7HRt8Ns9ALvvIOurNyB7G4aNDS+G7XqXre4uF2ZMe1LOB hn9Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=cxBzmFcO; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x8si8194063pgj.322.2019.07.12.06.50.28; Fri, 12 Jul 2019 06:50:44 -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=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=cxBzmFcO; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727028AbfGLNuF (ORCPT + 99 others); Fri, 12 Jul 2019 09:50:05 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:51218 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726466AbfGLNuE (ORCPT ); Fri, 12 Jul 2019 09:50:04 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=fnnfXjFvjoDoIQnQuaRvGkZvYrw5HXbBFVcsaXovgKE=; b=cxBzmFcOfyCVzsiypcmiuOaB4 1fMOmo+ZpbRPzJh+dTAYCbGidK6YiB8fbVv+neUEMBO1XgD5lFgobanIPl08Mxk/kB4jbRHgSXVIu aCrx/4k1V+9nWoRLBofxtdG0zd64VyyVgfuiwVS4CYteqh5B/2nbBOW5hf5MTuWwDcRHDCn+/Nc3s kYe9yq9chH57EPO3w0dPdAmX2U5O3eJJvSfg/Gh1ezFs3FNLWsIKC+otRLOEJ92WvN6OkgNGvm8zt FQ0G1NL4KUEWiWWE3e355AGY9P4U+l/lSbUFWthv4KVBi3Bml3xpaj7zCqeXdvrhPgklF9DUhNVjI jOn4gFOmA==; Received: from willy by bombadil.infradead.org with local (Exim 4.92 #3 (Red Hat Linux)) id 1hlvvv-0007EF-C1; Fri, 12 Jul 2019 13:49:55 +0000 Date: Fri, 12 Jul 2019 06:49:55 -0700 From: Matthew Wilcox To: Pengfei Li Cc: akpm@linux-foundation.org, urezki@gmail.com, rpenyaev@suse.de, peterz@infradead.org, guro@fb.com, rick.p.edgecombe@intel.com, rppt@linux.ibm.com, aryabinin@virtuozzo.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v4 2/2] mm/vmalloc.c: Modify struct vmap_area to reduce its size Message-ID: <20190712134955.GV32320@bombadil.infradead.org> References: <20190712120213.2825-1-lpf.vector@gmail.com> <20190712120213.2825-3-lpf.vector@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190712120213.2825-3-lpf.vector@gmail.com> User-Agent: Mutt/1.11.4 (2019-03-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jul 12, 2019 at 08:02:13PM +0800, Pengfei Li wrote: > +++ b/include/linux/vmalloc.h > @@ -51,15 +51,37 @@ struct vmap_area { > unsigned long va_start; > unsigned long va_end; > > - /* > - * Largest available free size in subtree. > - */ > - unsigned long subtree_max_size; > - unsigned long flags; > - struct rb_node rb_node; /* address sorted rbtree */ > - struct list_head list; /* address sorted list */ > - struct llist_node purge_list; /* "lazy purge" list */ > - struct vm_struct *vm; > + union { > + /* In rbtree and list sorted by address */ > + struct { > + union { > + /* > + * In "busy" rbtree and list. > + * rbtree root: vmap_area_root > + * list head: vmap_area_list > + */ > + struct vm_struct *vm; > + > + /* > + * In "free" rbtree and list. > + * rbtree root: free_vmap_area_root > + * list head: free_vmap_area_list > + */ > + unsigned long subtree_max_size; > + }; > + > + struct rb_node rb_node; > + struct list_head list; > + }; > + > + /* > + * In "lazy purge" list. > + * llist head: vmap_purge_list > + */ > + struct { > + struct llist_node purge_list; > + }; I don't think you need struct union struct union. Because llist_node is just a pointer, you can get the same savings with just: union { struct llist_node purge_list; struct vm_struct *vm; unsigned long subtree_max_size; };