Coder Social home page Coder Social logo

Comments (10)

RazrFalcon avatar RazrFalcon commented on September 3, 2024 2

madvice is in libc. And it already caused too many problems. I'm not interested in maintaining more features.

from memmap2-rs.

ollie-etl avatar ollie-etl commented on September 3, 2024 1

There is no libc function for mbind, it involves either using libnuma, or calling syscall directly, with the appropriate op. As that's all libnuma does, i think the latter is preferable.

from memmap2-rs.

RazrFalcon avatar RazrFalcon commented on September 3, 2024

If someone is willing to implement it - sure.

from memmap2-rs.

ollie-etl avatar ollie-etl commented on September 3, 2024

I am, it save the hacks i've currently got in place. The headache is either upstreaming the mbind call to libc, or using syscall here directly

from memmap2-rs.

adamreichold avatar adamreichold commented on September 3, 2024

The headache is either upstreaming the mbind call to libc, or using syscall here directly

I think as a third option, you could also just put the prototype of the libc function into this crate until the upstreaming is complete. (We do use the same approach for the Windows API calls used here for example.)

from memmap2-rs.

RazrFalcon avatar RazrFalcon commented on September 3, 2024

Then I guess this is out of scope.

from memmap2-rs.

ollie-etl avatar ollie-etl commented on September 3, 2024

How do you feel about a dependency on the syscalls crate?

You end up with something like this (different function):

pub fn get_mem_policy() -> Result<(i32, [usize; 1]), Errno> {
    let mut mode: i32 = 0;
    let mut node_mask: [usize; 1] = [0; 1];
    unsafe {
        syscall5(
            Sysno::get_mempolicy,
            ((&mut mode) as *mut i32) as usize,
            node_mask.as_mut_ptr() as usize,
            8 * std::mem::size_of::<usize>(),
            0,
            0,
        )
    }
    .map(drop);
    Ok((mode, node_mask))
}

from memmap2-rs.

RazrFalcon avatar RazrFalcon commented on September 3, 2024

It's way out of scope. This crate is for memory mapping only.

from memmap2-rs.

ollie-etl avatar ollie-etl commented on September 3, 2024

its exactly the same rational as mlock and madvise, both of which have apis: you'd like to control some aspect of the mapping, in this case its allocation onto a specific numa node. Ignore the get_mem_policy - that was to highlight the use of syscalls directly, not a function we'd nessesarily use

from memmap2-rs.

ollie-etl avatar ollie-etl commented on September 3, 2024

understood. Closing this issue.

from memmap2-rs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.