fs/select.c [patch > to >=]

From: Silvio Cesare (silvio@qualys.com)
Date: Tue Aug 20 2002 - 20:00:29 EST

fs/select.c (from 2.4.19 but present in 2.5.x also)

asmlinkage long sys_poll(struct pollfd * ufds, unsigned int nfds, long timeout)
        int i, j, fdcount, err;
        struct pollfd **fds;
        poll_table table, *wait;
        int nchunks, nleft;

[ skip ]

        nchunks = 0;
        nleft = nfds;
        while (nleft > POLLFD_PER_PAGE) { /* allocate complete PAGE_SIZE chunks
                fds[nchunks] = (struct pollfd *)__get_free_page(GFP_KERNEL);
                if (fds[nchunks] == NULL)
                        goto out_fds;
                nleft -= POLLFD_PER_PAGE;
        if (nleft) { /* allocate last PAGE_SIZE chunk, only nleft elements used

why not -->

        while (nleft >= POLLFD_PER_PAGE) {

in this case we will use only nchunks in the case that this will end up
page aligned.. the current way of using only > POLLFD_PER_PAGE will
end up with nchunks, and nleft == PAGE_SIZE / sizeof(pollfd) etc..

silly optimisation by changing > to >=, but still an optimisation.. if there
is something obviously wrong with changing > to >=, ignore me since I
probably should get more sleep.. but I dont see any problem though I havent
really looked at it too much.

attachment has 1 line (1 character) patch ;-)


- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/

This archive was generated by hypermail 2b29 : Fri Aug 23 2002 - 22:00:21 EST