All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andi Kleen <ak@suse.de>
To: "Chen, Kenneth W" <kenneth.w.chen@intel.com>
Cc: "'William Lee Irwin III'" <wli@holomorphy.com>,
	linux-kernel@vger.kernel.org, linux-ia64@vger.kernel.org, "Seth,
	Rohit" <rohit.seth@intel.com>
Subject: Re: Hugetlb demanding paging for -mm tree
Date: Thu, 5 Aug 2004 16:04:55 +0200	[thread overview]
Message-ID: <20040805140455.GE16763@wotan.suse.de> (raw)
In-Reply-To: <200408051342.i75DgGY26555@unix-os.sc.intel.com>

On Thu, Aug 05, 2004 at 06:42:15AM -0700, Chen, Kenneth W wrote:
> +int hugetlb_acct_memory(long delta)
> +{
> +	atomic_add(delta, &hugetlbzone_resv);
> +	if (delta > 0 && atomic_read(&hugetlbzone_resv) >
> +			VMACCTPG(hugetlb_total_pages())) {
> +		atomic_add(-delta, &hugetlbzone_resv);
> +		return -ENOMEM;
> +	}
> +	return 0;

Wouldn't this be safer with a bit of locking? 
Even if the current code works lockless it would be more safer
for long term mainteance.

> +}
> +
> +struct file_region {
> +	struct list_head link;
> +	int from;
> +	int to;

Shouldn't these be long instead of int? 


> +	/* Check for and consume any regions we now overlap with. */

[...]

I remember writing very similar, but simpler code for NUMA API
regions. The PAT patches also have similar code. 
It's also tricky to get right.

Maybe it would be time to move variable length region list handling
into a nice library in lib/, so that it can be used by other users.

-Andi

WARNING: multiple messages have this Message-ID (diff)
From: Andi Kleen <ak@suse.de>
To: "Chen, Kenneth W" <kenneth.w.chen@intel.com>
Cc: 'William Lee Irwin III' <wli@holomorphy.com>,
	linux-kernel@vger.kernel.org, linux-ia64@vger.kernel.org, "Seth,
	Rohit" <rohit.seth@intel.com>
Subject: Re: Hugetlb demanding paging for -mm tree
Date: Thu, 05 Aug 2004 14:04:55 +0000	[thread overview]
Message-ID: <20040805140455.GE16763@wotan.suse.de> (raw)
In-Reply-To: <200408051342.i75DgGY26555@unix-os.sc.intel.com>

On Thu, Aug 05, 2004 at 06:42:15AM -0700, Chen, Kenneth W wrote:
> +int hugetlb_acct_memory(long delta)
> +{
> +	atomic_add(delta, &hugetlbzone_resv);
> +	if (delta > 0 && atomic_read(&hugetlbzone_resv) >
> +			VMACCTPG(hugetlb_total_pages())) {
> +		atomic_add(-delta, &hugetlbzone_resv);
> +		return -ENOMEM;
> +	}
> +	return 0;

Wouldn't this be safer with a bit of locking? 
Even if the current code works lockless it would be more safer
for long term mainteance.

> +}
> +
> +struct file_region {
> +	struct list_head link;
> +	int from;
> +	int to;

Shouldn't these be long instead of int? 


> +	/* Check for and consume any regions we now overlap with. */

[...]

I remember writing very similar, but simpler code for NUMA API
regions. The PAT patches also have similar code. 
It's also tricky to get right.

Maybe it would be time to move variable length region list handling
into a nice library in lib/, so that it can be used by other users.

-Andi

  reply	other threads:[~2004-08-05 14:06 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-08-05 13:29 Hugetlb demanding paging for -mm tree Chen, Kenneth W
2004-08-05 13:29 ` Chen, Kenneth W
2004-08-05 13:36 ` William Lee Irwin III
2004-08-05 13:36   ` William Lee Irwin III
2004-08-05 13:39   ` Chen, Kenneth W
2004-08-05 13:39     ` Chen, Kenneth W
2004-08-05 16:35     ` Hirokazu Takahashi
2004-08-05 16:35       ` Hirokazu Takahashi
2004-08-06 20:55       ` Chen, Kenneth W
2004-08-06 20:55         ` Chen, Kenneth W
2004-08-06 21:07         ` William Lee Irwin III
2004-08-06 21:07           ` William Lee Irwin III
2004-08-07  8:13           ` William Lee Irwin III
2004-08-07  8:13             ` William Lee Irwin III
2004-08-09 18:19           ` Chen, Kenneth W
2004-08-09 18:19             ` Chen, Kenneth W
2004-08-09 19:12             ` William Lee Irwin III
2004-08-09 19:12               ` William Lee Irwin III
2004-08-07  8:36     ` William Lee Irwin III
2004-08-07  8:36       ` William Lee Irwin III
2004-08-09 18:54       ` Chen, Kenneth W
2004-08-09 18:54         ` Chen, Kenneth W
2004-08-09 19:12         ` William Lee Irwin III
2004-08-09 19:12           ` William Lee Irwin III
2004-08-05 13:42   ` Chen, Kenneth W
2004-08-05 13:42     ` Chen, Kenneth W
2004-08-05 14:04     ` Andi Kleen [this message]
2004-08-05 14:04       ` Andi Kleen
2004-08-06 21:06       ` Chen, Kenneth W
2004-08-06 21:06         ` Chen, Kenneth W
2004-08-05 13:43 ` Andi Kleen
2004-08-05 13:43   ` Andi Kleen
2004-08-09 18:43 Seth, Rohit
2004-08-09 18:43 ` Seth, Rohit
2004-08-09 18:59 ` William Lee Irwin III
2004-08-09 18:59   ` William Lee Irwin III
2004-08-10  8:52 Seth, Rohit
2004-08-10  8:52 ` Seth, Rohit
2004-08-10  8:55 ` William Lee Irwin III
2004-08-10  8:55   ` William Lee Irwin III
2004-08-11  0:28 Seth, Rohit
2004-08-11  0:28 ` Seth, Rohit
2004-08-11  0:45 ` William Lee Irwin III
2004-08-11  0:45   ` William Lee Irwin III
2004-08-11  6:36 Seth, Rohit
2004-08-11  6:36 ` Seth, Rohit
2004-08-11  6:38 ` William Lee Irwin III
2004-08-11  6:38   ` William Lee Irwin III

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=20040805140455.GE16763@wotan.suse.de \
    --to=ak@suse.de \
    --cc=kenneth.w.chen@intel.com \
    --cc=linux-ia64@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rohit.seth@intel.com \
    --cc=wli@holomorphy.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.