[lkml]   [2002]   [Jun]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
    SubjectRe: [PATCH] 2.5.21 Nonlinear CPU support
    On Jun 12, 2002  21:41 +0100, Anton Altaparmakov wrote:
    > At 20:39 12/06/02, Andreas Dilger wrote:
    > >At most you
    > >will need to loop once for each available CPU if you are unlucky enough
    > >to be rescheduled to a different CPU after each call to vmalloc().
    > Um are you suggesting compression buffers to be per mounted volume? That
    > would be more wasteful than the current approach of one buffer per CPU
    > globally for all of ntfs driver.

    No, my mistake. You should check whatever array you want.

    > vfree() at a guess (I may be completely wrong on that one in which case I
    > appologize!) can also sleep so that breaks that scheme.

    Well, just get rid of the while loop then and use an if+goto for both
    the vmalloc and the vfree case. At most we can loop NR_CPUS times.

    char *newbuf = NULL;
    int cpunum;

    cpunum = current_cpu();
    if (unlikely(ntfs_compr_array[cpunum] == NULL)) {
    newbuf = vmalloc(NTFS_DECOMPR_BUFFER_SIZE);

    * Re-check the buffer case we slept in vmalloc() and
    * someone else already allocated a buffer for "this" CPU.
    if (likely(ntfs_compr_array[cpunum] == NULL)) {
    ntfs_compr_array[cpunum] = newbuf;
    newbuf = NULL;
    goto recheck;
    /* Hmm, we slept in vmalloc and we don't need the new buffer */
    if (unlikely(newbuf != NULL)) {
    goto recheck;

    > But if doing something like that I might as well use the present
    > approach and just allocate all buffers at once if they haven't been
    > allocated yet and be done with it. Then no vfree()s are needed either and
    > then it really does work. (-;

    But then you may be allocating a lot of memory for CPUs that don't
    even exist, which is the whole point of this exercise. Better to do
    it on-demand and loop for the very few times needed.

    Cheers, Andreas
    Andreas Dilger

    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to
    More majordomo info at
    Please read the FAQ at

     \ /
      Last update: 2005-03-22 13:26    [W:0.024 / U:8.584 seconds]
    ©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site