linux-acpi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Rafael J. Wysocki" <rjw@rjwysocki.net>
To: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: "Rafael J. Wysocki" <rafael@kernel.org>,
	Heikki Krogerus <heikki.krogerus@linux.intel.com>,
	Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	Mika Westerberg <mika.westerberg@linux.intel.com>,
	Linus Walleij <linus.walleij@linaro.org>,
	Ard Biesheuvel <ard.biesheuvel@linaro.org>,
	linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org,
	platform-driver-x86@vger.kernel.org
Subject: Re: [PATCH v6 11/15] software node: move small properties inline when copying
Date: Wed, 06 Nov 2019 00:42:02 +0100	[thread overview]
Message-ID: <47671501.dVG71sAca0@kreacher> (raw)
In-Reply-To: <20191023200233.86616-12-dmitry.torokhov@gmail.com>

On Wednesday, October 23, 2019 10:02:29 PM CET Dmitry Torokhov wrote:
> When copying/duplicating set of properties, move smaller properties that
> were stored separately directly inside property entry structures. We can
> move:
> 
> - up to 8 bytes from U8 arrays
> - up to 4 words
> - up to 2 double words
> - one U64 value
> - one or 2 strings.

Yes, we can do that, but how much of a difference does this really make?

Also, how can one distinguish between a single-value property and an inline
array which this change?  By looking at the length?

> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
> ---
>  drivers/base/swnode.c | 10 ++++++++++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/drivers/base/swnode.c b/drivers/base/swnode.c
> index 18a30fb3cc58..49e1108aa4b7 100644
> --- a/drivers/base/swnode.c
> +++ b/drivers/base/swnode.c
> @@ -280,6 +280,16 @@ static int property_entry_copy_data(struct property_entry *dst,
>  	if (!dst->name)
>  		goto out_free_data;
>  
> +	if (!dst->is_inline && dst->length <= sizeof(dst->value)) {
> +		/* We have an opportunity to move the data inline */
> +		const void *tmp = dst->pointer;
> +
> +		memcpy(&dst->value, tmp, dst->length);
> +		dst->is_inline = true;
> +
> +		kfree(tmp);

This would have been more useful if we had been able to avoid making the
allocation altogether.

> +	}
> +
>  	return 0;
>  
>  out_free_data:
> 





  reply	other threads:[~2019-11-05 23:42 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-23 20:02 [PATCH v6 00/15] software node: add support for reference properties Dmitry Torokhov
2019-10-23 20:02 ` [PATCH v6 01/15] software node: remove DEV_PROP_MAX Dmitry Torokhov
2019-10-23 20:02 ` [PATCH v6 02/15] software node: introduce PROPERTY_ENTRY_ARRAY_XXX_LEN() Dmitry Torokhov
2019-10-23 20:02 ` [PATCH v6 03/15] efi/apple-properties: use PROPERTY_ENTRY_U8_ARRAY_LEN Dmitry Torokhov
2019-10-23 20:02 ` [PATCH v6 04/15] software node: mark internal macros with double underscores Dmitry Torokhov
2019-10-23 20:02 ` [PATCH v6 05/15] software node: clean up property_copy_string_array() Dmitry Torokhov
2019-10-23 20:02 ` [PATCH v6 06/15] software node: get rid of property_set_pointer() Dmitry Torokhov
2019-10-23 20:02 ` [PATCH v6 07/15] software node: remove property_entry_read_uNN_array functions Dmitry Torokhov
2019-10-23 20:02 ` [PATCH v6 08/15] software node: unify PROPERTY_ENTRY_XXX macros Dmitry Torokhov
2019-10-23 20:02 ` [PATCH v6 09/15] software node: simplify property_entry_read_string_array() Dmitry Torokhov
2019-10-23 20:02 ` [PATCH v6 10/15] software node: rename is_array to is_inline Dmitry Torokhov
2019-10-23 20:02 ` [PATCH v6 11/15] software node: move small properties inline when copying Dmitry Torokhov
2019-11-05 23:42   ` Rafael J. Wysocki [this message]
2019-11-05 23:56     ` Dmitry Torokhov
2019-11-08  0:04       ` Rafael J. Wysocki
2019-11-08  0:28         ` Dmitry Torokhov
2019-11-08  0:45           ` Rafael J. Wysocki
2019-11-08  0:49             ` Dmitry Torokhov
2019-11-08  1:34               ` Rafael J. Wysocki
2019-11-08  3:45                 ` Dmitry Torokhov
2019-10-23 20:02 ` [PATCH v6 12/15] software node: implement reference properties Dmitry Torokhov
2019-10-23 20:02 ` [PATCH v6 13/15] platform/x86: intel_cht_int33fe: use inline " Dmitry Torokhov
2019-10-23 20:02 ` [PATCH v6 14/15] software node: remove separate handling of references Dmitry Torokhov
2019-10-23 20:02 ` [PATCH v6 15/15] software node: add basic tests for property entries Dmitry Torokhov
2019-10-30 22:43 ` [PATCH v6 00/15] software node: add support for reference properties Dmitry Torokhov
2019-11-05 22:09   ` Rafael J. Wysocki

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=47671501.dVG71sAca0@kreacher \
    --to=rjw@rjwysocki.net \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=ard.biesheuvel@linaro.org \
    --cc=dmitry.torokhov@gmail.com \
    --cc=heikki.krogerus@linux.intel.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mika.westerberg@linux.intel.com \
    --cc=platform-driver-x86@vger.kernel.org \
    --cc=rafael@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).