From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on gnuweeb.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=ALL_TRUSTED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NO_DNS_FOR_FROM,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 Received: from mail-lf1-f47.google.com (mail-lf1-f47.google.com [209.85.167.47]) by gnuweeb.org (Postfix) with ESMTPSA id 4F61B7E340 for ; Tue, 22 Mar 2022 12:36:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gnuweeb.org; s=default; t=1647952584; bh=zaO3f9MqO+jyU3/PSQufuaTwNiwMTpP9slV5vtpUGQo=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=CN+3kFgpCahxQCFE2/8IVa7DhTgsK22ryIcMeDSq8wNPSKZVa8GPKkH4vacPmzIEe TyLiJb+Lt1j4jUhGiS9lCjSv1eIylLW782hk9yegdXfB8Kze3z3VRmoyReCY86HF22 YgRG2eWt8R079C8yPhwkfngRTNaH1fNkDQi0kERKELZXtOVelAtfb68TNFWr9X4c2X M8hk+pbzE8LzuRyycg7JvC0hFinbYk8PbVfJo0cnE1EpDMX+odKWuiLnol8ZfA7nEy PmlnUgA3TN5Yp0BKmi/v22iswZxu+D/ibG5jFOGFNZLZL4xc2LyNSl6N/t58W/2mID 4IyyH0AsGLJ6Q== Received: by mail-lf1-f47.google.com with SMTP id t25so29513567lfg.7 for ; Tue, 22 Mar 2022 05:36:24 -0700 (PDT) X-Gm-Message-State: AOAM531pKN2M/7lPv0kLQA8uIuBwD6AIVQ4DjIjc5nLAwzN1kzsYDWyP 7e1tJlBUDegjCgFZkuMCtS05D55DIBEmy0DkbmE= X-Google-Smtp-Source: ABdhPJzEbQlDjpVTXWmS7ePPfXTDNcuGBC93PTWZNLb6GxYsm1QyP1VqWjJPbZDZebqLPCcpINZX1m6Scoe/hAjxWxs= X-Received: by 2002:a05:6512:c06:b0:44a:2a0f:9d3c with SMTP id z6-20020a0565120c0600b0044a2a0f9d3cmr7475894lfu.136.1647952582433; Tue, 22 Mar 2022 05:36:22 -0700 (PDT) MIME-Version: 1.0 References: <20220322102115.186179-1-ammarfaizi2@gnuweeb.org> <20220322102115.186179-7-ammarfaizi2@gnuweeb.org> <56935393241242adab6f32c50dd74c23@AcuMS.aculab.com> <28dd5f67-0c59-8ea0-8798-55757a6b05f6@gnuweeb.org> In-Reply-To: <28dd5f67-0c59-8ea0-8798-55757a6b05f6@gnuweeb.org> From: Alviro Iskandar Setiawan Date: Tue, 22 Mar 2022 19:36:11 +0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [RFC PATCH v2 6/8] tools/nolibc/stdlib: Implement `malloc()`, `calloc()`, `realloc()` and `free()` To: Ammar Faizi Cc: David Laight , Willy Tarreau , "Paul E. McKenney" , Nugraha , Linux Kernel Mailing List , "GNU/Weeb Mailing List" Content-Type: text/plain; charset="UTF-8" List-Id: On Tue, Mar 22, 2022 at 7:18 PM Ammar Faizi wrote: > Rounding up is not useful here, because we don't have any free list to keep > track the unused block of memory. I mean, even if it's rounded up, the extra > space after rounded up cannot be utilized with this design. There is no > book-keeping that tracks it. > > Though, the kernel still allocates the size in multiple page size. BTW, what David meant probably, don't call mmap() again if heap->len is greater than new_len. Isn't that simple enough to give it a go? -- Viro