[dpdk-dev] [PATCH v4 8/8] eal/windows: implement basic memory management

Dmitry Kozlyuk dmitry.kozliuk at gmail.com
Fri May 1 21:19:33 CEST 2020


On 2020-04-28 18:18 GMT-0700 Ranjit Menon wrote:
> On 4/28/2020 4:50 PM, Dmitry Kozlyuk wrote:
[snip]
> > +void *
> > +eal_mem_reserve(void *requested_addr, size_t size, int flags)
> > +{
> > +	void *virt;
> > +
> > +	/* Windows requires hugepages to be committed. */
> > +	if (flags & EAL_RESERVE_HUGEPAGES) {
> > +		rte_errno = ENOTSUP;
> > +		return NULL;
> > +	}
> > +
> > +	virt = VirtualAlloc2(GetCurrentProcess(), requested_addr, size,
> > +		MEM_RESERVE | MEM_RESERVE_PLACEHOLDER, PAGE_NOACCESS,
> > +		NULL, 0);
> > +	if (virt == NULL) {
> > +		DWORD err = GetLastError();
> > +		RTE_LOG_WIN32_ERR("VirtualAlloc2()");
> > +		set_errno_from_win32_alloc_error(err);

return NULL;
is also missing here, thanks for making me re-check this part.

> > +	}
> > +
> > +	if ((flags & EAL_RESERVE_FORCE_ADDRESS) && (virt != requested_addr)) {
> > +		if (!VirtualFree(virt, 0, MEM_RELEASE))  
> 
> Shouldn't this be VirtualFreeEx() here?

You're right, there were a few more places like this within the file.

-- 
Dmitry Kozlyuk


More information about the dev mailing list