lkml.org 
[lkml]   [2004]   [Aug]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: Hugetlb demanding paging for -mm tree
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
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 14:04    [W:0.445 / U:1.280 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site