Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6167389
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T22:30:11+00:00 2026-05-23T22:30:11+00:00

In the original vmsplice() implementation, it was suggested that if you had a user-land

  • 0

In the original vmsplice() implementation, it was suggested that if you had a user-land buffer 2x the maximum number of pages that could fit in a pipe, a successful vmsplice() on the second half of the buffer would guarantee that the kernel was done using the first half of the buffer.

But that was not true after all, and particularly for TCP, the kernel pages would be kept until receiving ACK from the other side. Fixing this was left as future work, and thus for TCP, the kernel would still have to copy the pages from the pipe.

vmsplice() has the SPLICE_F_GIFT option that sort-of deals with this, but the problem is that this exposes two other problems – how to efficiently get fresh pages from the kernel, and how to reduce cache trashing. The first issue is that mmap requires the kernel to clear the pages, and the second issue is that although mmap might use the fancy kscrubd feature in the kernel, that increases the working set of the process (cache trashing).

Based on this, I have these questions:

  • What is the current state for notifying userland about the safe re-use of pages? I am especially interested in pages splice()d onto a socket (TCP). Did anything happen during the last 5 years?
  • Is mmap / vmsplice / splice / munmap the current best practice for zero-copying in a TCP server or have we better options today?
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T22:30:14+00:00Added an answer on May 23, 2026 at 10:30 pm

    Yes, due to the TCP socket holding on to the pages for an indeterminate time you cannot use the double-buffering scheme mentioned in the example code. Also, in my use case the pages come from circular buffer so I cannot gift the pages to the kernel and alloc fresh pages. I can verify that I am seeing data corruption in the received data.

    I resorted to polling the level of the TCP socket’s send queue until it drains to 0. This fixes data corruption but is suboptimal because draining the send queue to 0 affects throughput.

    n = ::vmsplice(mVmsplicePipe.fd.w, &iov, 1, 0);
    while (n) {
        // splice pipe to socket
        m = ::splice(mVmsplicePipe.fd.r, NULL, mFd, NULL, n, 0);
        n -= m;
    }
    
    while(1) {
        int outsize=0;
        int result;
    
        usleep(20000);
    
        result = ::ioctl(mFd, SIOCOUTQ, &outsize);
        if (result == 0) {
            LOG_NOISE("outsize %d", outsize);
        } else {
            LOG_ERR_PERROR("SIOCOUTQ");
            break;
        }
        //if (outsize <= (bufLen >> 1)) {
        if (outsize == 0) {
            LOG("outsize %d <= %u", outsize, bufLen>>1);
            break;
        }
    };
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

ORIGINAL Q: I'm wondering if anyone has had experience of migrating a large Cobol/PL1
ORIGINAL (see UPDATED QUESTION below) I am designing a new laboratory database that tests
Original Question: i read that for RESTful websites. it is not good to use
Original Problem: I have 3 boxes each containing 200 coins, given that there is
Original Question Is there a jQuery method that will check the selection type and
Original demo http://jsfiddle.net/anglimass/NVTzx/9/ Updated demo (that actually demonstrates the problem) http://jsfiddle.net/NVTzx/16/ Please click see
Original question: An affiliate partner of us has a website that is vulnerable to
Original connectionstring whitch working on MSSQL 2000: Provider=SQLOLEDB.1; Persist Security Info=True; User ID=XXXXXXXX; Initial
Original Question I am looking for a function that attempts to quantify how distant
Original goal: I have a TreeMenu that i use to display my Menu. In

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.