LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Randy Dunlap <randy.dunlap@oracle.com>
To: Nadia.Derbey@bull.net
Cc: linux-kernel@vger.kernel.org
Subject: Re: [RFC][PATCH 4/6] min and max kobjects
Date: Wed, 24 Jan 2007 14:41:48 -0800	[thread overview]
Message-ID: <20070124144148.8b164cc1.randy.dunlap@oracle.com> (raw)
In-Reply-To: <20070116063029.862885000@bull.net>

On Tue, 16 Jan 2007 07:15:20 +0100 Nadia.Derbey@bull.net wrote:

> [PATCH 04/06]
> 
> Introduces the kobjects associated to each tunable min and max value
> 
> Signed-off-by: Nadia Derbey <Nadia.Derbey@bull.net>
> ---
>  include/linux/akt.h         |   30 ++++
>  include/linux/akt_ops.h     |  311 ++++++++++++++++++++++++++++++++++++++++++++
>  kernel/autotune/akt.c       |  120 ++++++++++++++++
>  kernel/autotune/akt_sysfs.c |    8 +
>  4 files changed, 469 insertions(+)
> 
> Index: linux-2.6.20-rc4/include/linux/akt.h
> ===================================================================
> --- linux-2.6.20-rc4.orig/include/linux/akt.h	2007-01-15 15:08:41.000000000 +0100
> +++ linux-2.6.20-rc4/include/linux/akt.h	2007-01-15 15:21:47.000000000 +0100
> @@ -62,6 +62,13 @@ struct tunable_kobject {
>   * auto_tune structure.
>   * These values are type dependent and are used as high / low boundaries when
>   * tuning up or down.
> + * The show and store routines (thare are type dependent too) are here for

                                   they (or these ?)

> + * sysfs support (since the min and max can be updated through sysfs).
> + * The abs_value field is used to check that we are not:
> + *   . falling under the very 1st min value when updating the min value
> + *     through sysfs
> + *   . going over the very 1st max value when updating the max value
> + *     through sysfs
>   * The type is known when the tunable is defined (see DEFINE_TUNABLE macro).
>   */
>  struct typed_value {

> Index: linux-2.6.20-rc4/kernel/autotune/akt.c
> ===================================================================
> --- linux-2.6.20-rc4.orig/kernel/autotune/akt.c	2007-01-15 15:13:31.000000000 +0100
> +++ linux-2.6.20-rc4/kernel/autotune/akt.c	2007-01-15 15:25:35.000000000 +0100
> @@ -203,5 +207,121 @@ ssize_t store_tuning_mode(struct auto_tu
>  }
>  
>  
> +/*
> + * FUNCTION:    Get operation called by tunable_attr_show (i.e. when the file
> + *              /sys/tunables/<tunable>/min is displayed).
> + *              Outputs the current tunable minimum value
> + *
> + * RETURN VALUE: >0 : output string length (including the '\0')
> + *               <0 : failure
> + */

Since you are providing function comment header blocks, please use
the accepted kernel-doc format for (all of) these.

> +ssize_t show_tunable_min(struct auto_tune *tun_addr, char *buf)
> +{
> +	ssize_t rc;
> +
> +	if (tun_addr == NULL) {
> +		printk(KERN_ERR
> +			" show_tunable_min(): tunable address is invalid\n");
> +		return -EINVAL;
> +	}
> +
> +	spin_lock(&tun_addr->tunable_lck);
> +
> +	rc = tun_addr->min.show(tun_addr, buf);
> +
> +	spin_unlock(&tun_addr->tunable_lck);
> +
> +	return rc;
> +}
> +
> +
> +/*
> + * FUNCTION:    Set operation called by tunable_attr_store (i.e. when a
> + *              string is stored into /sys/tunables/<tunable>/min).
> + *
> + * PARAMETERS:  count: input buffer size (including the '\0')
> + *
> + * RETURN VALUE: >0: number of characters used from the input buffer
> + *               <= 0: failure

I would expect a return value of 0 not to indicate failure;
only <0 should do that.  So is this a typo or a real case where
a return of 0 indicates failure?

> + */
> +ssize_t store_tunable_min(struct auto_tune *tun_addr, const char *buf,
> +			size_t count)
> +{
> +	ssize_t rc;
> +
> +	if (tun_addr == NULL) {
> +		printk(KERN_ERR
> +			" store_tunable_min(): tunable address is invalid\n");
> +		return -EINVAL;
> +	}
> +
> +	spin_lock(&tun_addr->tunable_lck);
> +
> +	rc = tun_addr->min.store(tun_addr, buf, count);
> +
> +	spin_unlock(&tun_addr->tunable_lck);
> +
> +	return rc;
> +}
> +
> +
> +
> +
> +/*
> + * FUNCTION:    Set operation called by tunable_attr_store (i.e. when a
> + *              string is stored into /sys/tunables/<tunable>/max).
> + *
> + * PARAMETERS:  count: input buffer size (including the '\0')
> + *
> + * RETURN VALUE: >0: number of characters used from the input buffer
> + *               <= 0: failure

same question.

> + */
> +ssize_t store_tunable_max(struct auto_tune *tun_addr, const char *buf,
> +			size_t count)
> +{
> +	ssize_t rc;
> +
> +	if (tun_addr == NULL) {
> +		printk(KERN_ERR
> +			" store_tunable_max(): tunable address is invalid\n");
> +		return -EINVAL;
> +	}
> +
> +	spin_lock(&tun_addr->tunable_lck);
> +
> +	rc = tun_addr->max.store(tun_addr, buf, count);
> +
> +	spin_unlock(&tun_addr->tunable_lck);
> +
> +	return rc;
> +}
> +
> +
>  EXPORT_SYMBOL_GPL(register_tunable);
>  EXPORT_SYMBOL_GPL(unregister_tunable);

Thanks.

---
~Randy

  reply	other threads:[~2007-01-24 22:47 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-01-16  6:15 [RFC][PATCH 0/6] Automatice kernel tunables (AKT) Nadia.Derbey
2007-01-16  6:15 ` [RFC][PATCH 1/6] Tunable structure and registration routines Nadia.Derbey
2007-01-25  0:32   ` Randy Dunlap
2007-01-25 16:26     ` Nadia Derbey
2007-01-25 16:34       ` Randy Dunlap
2007-01-25 17:01         ` Nadia Derbey
2007-01-16  6:15 ` [RFC][PATCH 2/6] auto_tuning activation Nadia.Derbey
2007-01-16  6:15 ` [RFC][PATCH 3/6] tunables associated kobjects Nadia.Derbey
2007-01-16  6:15 ` [RFC][PATCH 4/6] min and max kobjects Nadia.Derbey
2007-01-24 22:41   ` Randy Dunlap [this message]
2007-01-25 16:34     ` Nadia Derbey
2007-01-16  6:15 ` [RFC][PATCH 5/6] per namespace tunables Nadia.Derbey
2007-01-24 22:41   ` Randy Dunlap
2007-01-16  6:15 ` [RFC][PATCH 6/6] automatic tuning applied to some kernel components Nadia.Derbey
2007-01-22 19:56   ` Andrew Morton
2007-01-23 14:40     ` Nadia Derbey
2007-02-07 21:18       ` Eric W. Biederman
2007-02-09 12:27         ` Nadia Derbey
2007-02-09 18:35           ` Eric W. Biederman
2007-02-13  9:06             ` Nadia Derbey
2007-02-13 10:10               ` Eric W. Biederman
2007-02-15  7:07                 ` Nadia Derbey
2007-02-15  7:49                   ` Eric W. Biederman
2007-02-15  8:25                     ` Nadia Derbey

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=20070124144148.8b164cc1.randy.dunlap@oracle.com \
    --to=randy.dunlap@oracle.com \
    --cc=Nadia.Derbey@bull.net \
    --cc=linux-kernel@vger.kernel.org \
    --subject='Re: [RFC][PATCH 4/6] min and max kobjects' \
    /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

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).