From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751583AbcGMQlG (ORCPT ); Wed, 13 Jul 2016 12:41:06 -0400 Received: from merlin.infradead.org ([205.233.59.134]:44327 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750950AbcGMQk4 (ORCPT ); Wed, 13 Jul 2016 12:40:56 -0400 Date: Wed, 13 Jul 2016 18:40:07 +0200 From: Peter Zijlstra To: Daniel Borkmann Cc: davem@davemloft.net, alexei.starovoitov@gmail.com, tgraf@suug.ch, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH net-next 1/3] perf, events: add non-linear data support for raw records Message-ID: <20160713164007.GV30154@twins.programming.kicks-ass.net> References: <20160713134231.GT30154@twins.programming.kicks-ass.net> <57864B77.9090105@iogearbox.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <57864B77.9090105@iogearbox.net> User-Agent: Mutt/1.5.23.1 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jul 13, 2016 at 04:08:55PM +0200, Daniel Borkmann wrote: > Hi Peter, > > On 07/13/2016 03:42 PM, Peter Zijlstra wrote: > > > >Ok so the nonlinear thing was it doing _two_ copies, one the regular > >__output_copy() on raw->data and second the optional fragment thingy > >using __output_custom(). > > > >Would something like this work instead? > > > >It does the nonlinear thing and the custom copy function thing but > >allows more than 2 fragments and allows each fragment to have a custom > >copy. > > > >It doesn't look obviously more expensive; it has the one ->copy branch > >extra, but then it doesn't recompute the sizes. > > Yes, that would work as well on a quick glance with diff just a bit > bigger, but more generic this way. Do you want me to adapt this into > the first patch? Please. > One question below: > > >- u64 zero = 0; > >- if (real_size - raw_size) > >- __output_copy(handle, &zero, real_size - raw_size); > > We still need the zero padding here from above with the computed > raw->size, right? Ah, yes, we need some __output*() in order to advance the handle offset. We don't _need_ to copy the 0s, but I doubt __output_skip() is much cheaper for these 1-3 bytes worth of data; we've already touched that line anyway.