Received: by 2002:ac0:950c:0:0:0:0:0 with SMTP id f12csp4157266imc; Thu, 14 Mar 2019 13:49:09 -0700 (PDT) X-Google-Smtp-Source: APXvYqwGZHuYAeBm9zUBITOqpUjjBBUMVghlQu47zwuyaVt4GIiIDRJyl794QJr/8nJwxnnXJ4qN X-Received: by 2002:aa7:84cf:: with SMTP id x15mr210118pfn.203.1552596549566; Thu, 14 Mar 2019 13:49:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552596549; cv=none; d=google.com; s=arc-20160816; b=fV0bHImbmB35smxVdttb8e3kAuStNppj88TI3F+UlWgUwdzMLvYGq0LkzOYk2mgKoh 8J9u5l3HNwWksjbHPOOHpYCquZAOmaZ88lS25AH2Kn2wRRZcxFdkdSu91eS5qjugmPZk 08CDsB68sBjOMFC40Y2l/gCdOxwAVntAQAxKfFPuCtng4j8B4YzuFKgw7NfeszRTWgHs Un83BbWkArnXKgDSP0Tzi1VJWo29g1NV031k8E7jWgW9aujt4hJCTQXcNoh2MHx1f3WU hweD5MpRLPjlwQCm8UlEbvIjatA7j9uZs3IZOY22zKO1CHS63bdOas4IteqztM4umiBH sVcQ== 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:dkim-signature; bh=yLDcuHp0DhRpR1BcCx+aKpC2sxaXs3xGUSd0iNo1cIA=; b=IVjajZr0PRwUSXRS98OlvyW9exIe0jpuD4ZISfB371m04eNBp/ItA4R4tmC0JZULyO 5kFhYtV0M+Dy49aBXdizxh4WA7stn5A30szpxJuaMmLLYQA60IgKA1Dovp1eN2MgqB/2 K6m5q5aglLqKlrKra2C9EEenYaXC9/J20ddVcCkuRS2BLszRprxQ+x6RIXVzBJCKTkOG U+o0pFZ4HDRC8dEXW5hYZc+IAu0y+h7c4fxnMcF5AD7B8YkSeEWsLON2ooIEADrj7mOn KB1Li93+4l9gasNxHYS37KYSBL3d7O52VeLHvZkZTxxjrzUq8ilFk63W4NRlt+MjdrcI /fEg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@tobin.cc header.s=fm2 header.b=KLueMx+1; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=CYSoMbcW; 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 m7si19984pgp.187.2019.03.14.13.48.54; Thu, 14 Mar 2019 13:49:09 -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=@tobin.cc header.s=fm2 header.b=KLueMx+1; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=CYSoMbcW; 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 S1727911AbfCNUrX (ORCPT + 99 others); Thu, 14 Mar 2019 16:47:23 -0400 Received: from out2-smtp.messagingengine.com ([66.111.4.26]:56901 "EHLO out2-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726829AbfCNUrW (ORCPT ); Thu, 14 Mar 2019 16:47:22 -0400 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id B91D521D35; Thu, 14 Mar 2019 16:47:21 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute5.internal (MEProxy); Thu, 14 Mar 2019 16:47:21 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tobin.cc; h=date :from:to:cc:subject:message-id:references:mime-version :content-type:in-reply-to; s=fm2; bh=yLDcuHp0DhRpR1BcCx+aKpC2sxa Xs3xGUSd0iNo1cIA=; b=KLueMx+1d35u7zYB1YugeyNJvkHB9+RQ2+4Eu43no2U lTg9F9j4s+Vzl65H7V6YTohqtBGV6HWcm9/5+rX9DYCgCRqbjXKcETXe3xj+acr8 WNDOZYCl0xrG4C6yq6kr1iSVrtWHxGlEI48r+Mb3wOwmFM8TMRGzcOKARZKdlpSk iLSWPF2sMq2IdkFdbEAyTUVvo3M9f/hQMxPKRpAynB8a23J29OvZGYiWE3woqV5W fDaPHLr+3GaDyu566qe3vQP32B/2iAFOVFnfe30E9bvIyBrQmhzzJzwMlNQkvSQ+ SeErVmc8/o4lVzcN/F9Bk6rkNZ+RA1sRXqldn41w4Fg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; bh=yLDcuH p0DhRpR1BcCx+aKpC2sxaXs3xGUSd0iNo1cIA=; b=CYSoMbcWmJisv+NFYF4Tc1 xLDK+MjQ1+1CGnzo95WdVdYekFNjO8F680UHJ7f5c01fkJrj7FtMcvXPhvRgN7Cp LOgkVk/ySl7FTp+1mkDHrTtZ234rlBuTzdM7sal+qFM9K6GNNROfK02v3qTDo6xO U+6GlqRxHP4RXTEZi/3lUIpHTwPM+0AoWHpIn1Q+6o8txM9TKt8aX6ijUrB+FScX j3hxuDOdQ+bAfdEm9GR5BSW6w7lcUwDee9V4hChWvIy2nmyZk2xQ1vbmMAd3B8NG ++XzlD72M82KxdCJvL5ZhFGpNkFs+7dM9rxI6r8b/m7/y+KlYu1gqbZmqpcFbroQ == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedutddrheefgdehtdcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenfg hrlhcuvffnffculddutddmnecujfgurhepfffhvffukfhfgggtuggjofgfsehttdertdfo redvnecuhfhrohhmpedfvfhosghinhcuvedrucfjrghrughinhhgfdcuoehmvgesthhosg hinhdrtggtqeenucfkphepuddvgedrudeiledrvdefrddukeegnecurfgrrhgrmhepmhgr ihhlfhhrohhmpehmvgesthhosghinhdrtggtnecuvehluhhsthgvrhfuihiivgeptd X-ME-Proxy: Received: from localhost (124-169-23-184.dyn.iinet.net.au [124.169.23.184]) by mail.messagingengine.com (Postfix) with ESMTPA id 6813F100E5; Thu, 14 Mar 2019 16:47:19 -0400 (EDT) Date: Fri, 15 Mar 2019 07:47:00 +1100 From: "Tobin C. Harding" To: Roman Gushchin Cc: "Tobin C. Harding" , Andrew Morton , Christoph Lameter , Pekka Enberg , David Rientjes , Joonsoo Kim , Matthew Wilcox , "linux-mm@kvack.org" , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH v3 3/7] slob: Use slab_list instead of lru Message-ID: <20190314204700.GA10222@eros.localdomain> References: <20190314053135.1541-1-tobin@kernel.org> <20190314053135.1541-4-tobin@kernel.org> <20190314185219.GA6441@tower.DHCP.thefacebook.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190314185219.GA6441@tower.DHCP.thefacebook.com> X-Mailer: Mutt 1.11.3 (2019-02-01) User-Agent: Mutt/1.11.3 (2019-02-01) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Mar 14, 2019 at 06:52:25PM +0000, Roman Gushchin wrote: > On Thu, Mar 14, 2019 at 04:31:31PM +1100, Tobin C. Harding wrote: > > Currently we use the page->lru list for maintaining lists of slabs. We > > have a list_head in the page structure (slab_list) that can be used for > > this purpose. Doing so makes the code cleaner since we are not > > overloading the lru list. > > > > The slab_list is part of a union within the page struct (included here > > stripped down): > > > > union { > > struct { /* Page cache and anonymous pages */ > > struct list_head lru; > > ... > > }; > > struct { > > dma_addr_t dma_addr; > > }; > > struct { /* slab, slob and slub */ > > union { > > struct list_head slab_list; > > struct { /* Partial pages */ > > struct page *next; > > int pages; /* Nr of pages left */ > > int pobjects; /* Approximate count */ > > }; > > }; > > ... > > > > Here we see that slab_list and lru are the same bits. We can verify > > that this change is safe to do by examining the object file produced from > > slob.c before and after this patch is applied. > > > > Steps taken to verify: > > > > 1. checkout current tip of Linus' tree > > > > commit a667cb7a94d4 ("Merge branch 'akpm' (patches from Andrew)") > > > > 2. configure and build (select SLOB allocator) > > > > CONFIG_SLOB=y > > CONFIG_SLAB_MERGE_DEFAULT=y > > > > 3. dissasemble object file `objdump -dr mm/slub.o > before.s > > 4. apply patch > > 5. build > > 6. dissasemble object file `objdump -dr mm/slub.o > after.s > > 7. diff before.s after.s > > > > Use slab_list list_head instead of the lru list_head for maintaining > > lists of slabs. > > > > Reviewed-by: Roman Gushchin > > Signed-off-by: Tobin C. Harding > > --- > > mm/slob.c | 8 ++++---- > > 1 file changed, 4 insertions(+), 4 deletions(-) > > > > diff --git a/mm/slob.c b/mm/slob.c > > index 39ad9217ffea..94486c32e0ff 100644 > > --- a/mm/slob.c > > +++ b/mm/slob.c > > @@ -112,13 +112,13 @@ static inline int slob_page_free(struct page *sp) > > > > static void set_slob_page_free(struct page *sp, struct list_head *list) > > { > > - list_add(&sp->lru, list); > > + list_add(&sp->slab_list, list); > > __SetPageSlobFree(sp); > > } > > > > static inline void clear_slob_page_free(struct page *sp) > > { > > - list_del(&sp->lru); > > + list_del(&sp->slab_list); > > __ClearPageSlobFree(sp); > > } > > > > @@ -282,7 +282,7 @@ static void *slob_alloc(size_t size, gfp_t gfp, int align, int node) > > > > spin_lock_irqsave(&slob_lock, flags); > > /* Iterate through each partially free page, try to find room */ > > - list_for_each_entry(sp, slob_list, lru) { > > + list_for_each_entry(sp, slob_list, slab_list) { > > #ifdef CONFIG_NUMA > > /* > > * If there's a node specification, search for a partial > > > Hi Tobin! > > How about list_rotate_to_front(&next->lru, slob_list) from the previous patch? > Shouldn't it use slab_list instead of lru too? I'll let this sit for a day or two in case we get any more comments on the list.h stuff then do another version ready for US Monday morning. Thanks again, Tobin.