lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Wed, 26 Sep 2007 22:12:27 +0200
From:	roel <12o3l@...cali.nl>
To:	Matthew Wilcox <willy@...ux.intel.com>
CC:	linux-kernel@...r.kernel.org
Subject: Re: [PATCH 4/4] dmapool: Improve memory usage for devices which can't
 cross boundaries

Matthew Wilcox wrote:

[...]

> @@ -142,14 +144,13 @@ struct dma_pool *dma_pool_create(const char *name, struct device *dev,
>  	if ((size % align) != 0)
>  		size = ALIGN(size, align);
>  
> -	if (allocation == 0) {
> -		if (PAGE_SIZE < size)
> -			allocation = size;
> -		else
> -			allocation = PAGE_SIZE;
> -		// FIXME: round up for less fragmentation
> -	} else if (allocation < size)
> +	allocation = max_t(size_t, size, PAGE_SIZE);
> +
> +	if (!boundary) {
> +		boundary = allocation;
> +	} else if ((boundary < size) || (boundary & (boundary - 1))) {
>  		return NULL;
> +	}

	if (!boundary)
		boundary = allocation;
	else if (boundary < size || boundary & (boundary - 1))
		return NULL;

[...]

> @@ -190,11 +192,14 @@ struct dma_pool *dma_pool_create(const char *name, struct device *dev,
>  static void pool_initialise_page(struct dma_pool *pool, struct dma_page *page)
>  {
>  	unsigned int offset = 0;
> +	unsigned int next_boundary = pool->boundary;
>  
>  	do {
>  		unsigned int next = offset + pool->size;
> -		if (unlikely((next + pool->size) >= pool->allocation))
> -			next = pool->allocation;
> +		if (unlikely((next + pool->size) >= next_boundary)) {

		if (unlikely(next + pool->size >= next_boundary)) {

[...]
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ