On Thu, Sep 22, 2005 at 02:54:22PM +0200, Andi Kleen wrote:
> > > +void *vmalloc_node(unsigned long size, int node)
> > > +{
> > > + void *result;
> > > + struct mempolicy *oldpol = current->mempolicy;
> > > + mm_segment_t oldfs = get_fs();
> > > + DECLARE_BITMAP(prefnode, MAX_NUMNODES);
> > > +
> > > + mpol_get(oldpol);
> > > + bitmap_zero(prefnode, MAX_NUMNODES);
> > > + set_bit(node, prefnode);
> > > +
> > > + set_fs(KERNEL_DS);
> > > + sys_set_mempolicy(MPOL_PREFERRED, prefnode, MAX_NUMNODES);
> > > + set_fs(oldfs);
> > > +
> > > + result = vmalloc(size);
> > > +
> > > + mpol_free(current->mempolicy);
> > > + current->mempolicy = oldpol;
> > > + return result;
> > > +}
> >
> > No way, sorry. If you want a vmalloc node do it right.
>
> The implementation looks fine to me, so I think it's already right.
Umm, no - adding set_fs/get_fs mess for things like that is not right.
If we want to go down the mempolicy-based route we need to add a proper
kernel entry point for setting a mempolicy
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[Index of Archives]
[Kernel Newbies]
[Netfilter]
[Bugtraq]
[Photo]
[Gimp]
[Yosemite News]
[MIPS Linux]
[ARM Linux]
[Linux Security]
[Linux RAID]
[Video 4 Linux]
[Linux for the blind]
|
|