Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp650643ybl; Fri, 30 Aug 2019 05:15:58 -0700 (PDT) X-Google-Smtp-Source: APXvYqzRLuGoq71eDk2vbLWKrEtnyN5O36/f057gdqc7a8yKGtb7wh3o+V5+4sRYI0HgZldzlF/R X-Received: by 2002:a62:ac0d:: with SMTP id v13mr17428325pfe.129.1567167358317; Fri, 30 Aug 2019 05:15:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567167358; cv=none; d=google.com; s=arc-20160816; b=amX72mZlBZEMOb4B9AZt45WhFJKzh8Yd11fXzT3+G5BUzYivCUI571p3dT0Ezvq6Jd cVZpTrGSd/fbWeRWkmoVKBeo5TnokYvsn7DXafFr8l643xD9pApdzvwIeEwfTa9xy8hm Zv+p2tuyFOdqnkSriiqhmu73C6ZuXoyrfzJLN66Iywg8M373JL4M2ysvxnHaCNdZva80 tgwfDPgvkpdcOkke9erNxCECDFnMg/ZEHvl6QZxsVKv2Olm5Q8vRNhEa7+vjXY0Bh/ZQ CiYk2JYaJoK/7i1ONUMMT1u8KVgFhjN+t3c872590nYV2+KguS0Bm8UI70MAfNSkoTwi CJWg== 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; bh=mjQtDq3pb/VAtPTEz3xKzzt8j8xMT956dt0bx+4aT8k=; b=tKnNCw3cQ32BHxZWBhozUHB1/qCzgxp6UcI+MJ9GhQ2REvFl4jDpE6dEAydDQA24Yt 6i93vj7cYZn/HLMqb2F5kRR9K9q+RuUp+PC6p3wUpJ4Ucq5qaG6W/29nKBYcLl4ZkUDc Gt/X29uojE/80nIqwvva6FjoDIxA8H+/2zVR7EGH3nLDP+QBxdcyWxGX3toxYfhsl8L0 ycFymF7kwSkUoaomrCE/hmNsMPQ5Zk1KVIYxMhtOWAUEhTt17ya6vNSmr4s+cRme2/RL BR9cqvBjpCtS/DOkilnVuqL++CTEfkYOFMwfbPV4nJp/qfvJDEd3DpOqDmdNaY5BGPA9 FlFg== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f23si4330972pga.449.2019.08.30.05.15.41; Fri, 30 Aug 2019 05:15:58 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727901AbfH3MOm (ORCPT + 99 others); Fri, 30 Aug 2019 08:14:42 -0400 Received: from youngberry.canonical.com ([91.189.89.112]:51897 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727326AbfH3MOl (ORCPT ); Fri, 30 Aug 2019 08:14:41 -0400 Received: from [213.220.153.21] (helo=wittgenstein) by youngberry.canonical.com with esmtpsa (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.76) (envelope-from ) id 1i3flt-0003iW-0H; Fri, 30 Aug 2019 12:12:53 +0000 Date: Fri, 30 Aug 2019 14:12:52 +0200 From: Christian Brauner To: Greg KH Cc: Joel Fernandes , Peikan Tsai , arve@android.com, tkjos@android.com, maco@android.com, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] binder: Use kmem_cache for binder_thread Message-ID: <20190830121251.rvdhohyykekhh25r@wittgenstein> References: <20190829054953.GA18328@mark-All-Series> <20190829064229.GA30423@kroah.com> <20190829135359.GB63638@google.com> <20190829152721.ttsyfwaeygmwmcu7@wittgenstein> <20190830063851.GG15257@kroah.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20190830063851.GG15257@kroah.com> User-Agent: NeoMutt/20180716 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Aug 30, 2019 at 08:38:51AM +0200, Greg KH wrote: > On Thu, Aug 29, 2019 at 05:27:22PM +0200, Christian Brauner wrote: > > On Thu, Aug 29, 2019 at 09:53:59AM -0400, Joel Fernandes wrote: > > > On Thu, Aug 29, 2019 at 08:42:29AM +0200, Greg KH wrote: > > > > On Thu, Aug 29, 2019 at 01:49:53PM +0800, Peikan Tsai wrote: > > > [snip] > > > > > The allocated size for each binder_thread is 512 bytes by kzalloc. > > > > > Because the size of binder_thread is fixed and it's only 304 bytes. > > > > > It will save 208 bytes per binder_thread when use create a kmem_cache > > > > > for the binder_thread. > > > > > > > > Are you _sure_ it really will save that much memory? You want to do > > > > allocations based on a nice alignment for lots of good reasons, > > > > especially for something that needs quick accesses. > > > > > > Alignment can be done for slab allocations, kmem_cache_create() takes an > > > align argument. I am not sure what the default alignment of objects is > > > though (probably no default alignment). What is an optimal alignment in your > > > view? > > > > Probably SLAB_HWCACHE_ALIGN would make most sense. > > This isn't memory accessing hardware, so I don't think it would, right? I was more thinking of cacheline bouncing under contention. But maybe that's not worth it in this case...