Releasing a Noncontiguous Memory Area

The vfree( ) function releases noncontiguous memory areas. Its parameter addr contains the initial linear address of the area to be released. vfree( ) first scans the list pointed to by vmlist to find the address of the area descriptor associated with the area to be released:

write lock(&vmlist lock);

for (p = &vmlist ; (tmp = *p) ; p = &tmp->next) { if (tmp->addr == addr) { *p = tmp->next;

vmfree area pages((unsigned long)(tmp->addr), tmp->size);

write unlock(&vmlist lock);



write unlock(&vmlist lock);

printk("Trying to vfree( ) nonexistent vm area (%p)\n", addr);

Continue reading here: As for vmalloc the kernel modifies the entries of the master kernel Page Global

Was this article helpful?

0 0