From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stephen Boyd Subject: Re: [PATCH v9 03/18] kunit: test: add string_stream a std::stream like string builder Date: Mon, 15 Jul 2019 15:04:06 -0700 Message-ID: <20190715220407.0030420665@mail.kernel.org> References: <20190712081744.87097-1-brendanhiggins@google.com> <20190712081744.87097-4-brendanhiggins@google.com> <20190715204356.4E3F92145D@mail.kernel.org> Mime-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Return-path: In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org To: Brendan Higgins Cc: Frank Rowand , Greg KH , Josh Poimboeuf , Kees Cook , Kieran Bingham , Luis Chamberlain , Peter Zijlstra , Rob Herring , shuah , Theodore Ts'o , Masahiro Yamada , devicetree , dri-devel , kunit-dev@googlegroups.com, "open list:DOCUMENTATION" , linux-fsdevel@vger.kernel.org, linux-kbuild , Linux Kernel Mailing List , open list:KERNEL SELFTEST FRAMEWORK List-Id: dri-devel@lists.freedesktop.org Quoting Brendan Higgins (2019-07-15 14:11:50) > On Mon, Jul 15, 2019 at 1:43 PM Stephen Boyd wrote: > > > > I also wonder if it would be better to just have a big slop buffer of a > > 4K page or something so that we almost never have to allocate anything > > with a string_stream and we can just rely on a reader consuming data > > while writers are writing. That might work out better, but I don't quite > > understand the use case for the string stream. >=20 > That makes sense, but might that also waste memory since we will > almost never need that much memory? Why do we care? These are unit tests. Having allocations in here makes things more complicated, whereas it would be simpler to have a pointer and a spinlock operating on a chunk of memory that gets flushed out periodically.