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:	Mon, 03 May 2010 11:13:52 +0200
From:	Eric Dumazet <eric.dumazet@...il.com>
To:	Avi Kivity <avi@...hat.com>, Changli Gao <xiaosuo@...il.com>
Cc:	Tetsuo Handa <penguin-kernel@...ove.sakura.ne.jp>, jslaby@...e.cz,
	akpm@...ux-foundation.org, paulmck@...ux.vnet.ibm.com,
	adobriyan@...il.com, mingo@...e.hu, peterz@...radead.org,
	linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] fs: use kmalloc() to allocate fdmem if possible

Le lundi 03 mai 2010 à 11:49 +0300, Avi Kivity a écrit :

> A kmalloc()ed page is virtually contiguous, satisfying your requirement.
> 

Still, a different function pair is needed, at least for documentation
reasons.

Changli, _many_ patches like yours were suggested and refused in the
past for the reason it should be generic. Maybe its time...

So first introduce a pair of funtions, then we can use them.

At free time we can use is_vmalloc_addr() so that no extra bit is needed
to tell if a zone was vmalloced() or kmalloced()


One remark :

+       data = kmalloc(size, GFP_KERNEL);

If allocation fails (because of fragmentation), we would have a kernel
log.
Still, vmalloc() might be OK.
So you should add a __GFP_NOWARN flag.




/*
 * Warning: if size is not a power of two, kmalloc() might
 * waste memory because of its requirements.
 */
void *kvmalloc(size_t size)
{
	void *ptr = kmalloc(size, GFP_KERNEL | __GFP_NOWARN);

	if (ptr)
		return ptr;
	return vmalloc(size);
}

void kvfree(void *ptr)
{
	BUG_ON(in_interrupt());
	if (is_vmalloc_addr(ptr))
		vfree(ptr);
	else
		kfree(ptr);
}


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