diff mbox series

[2/2] core: replace sysconf(_SC_PAGESIZE) with qemu_real_host_page_size

Message ID 20191015031350.4345-3-richardw.yang@linux.intel.com
State New
Headers show
Series replace sysconf(_SC_PAGESIZE) with qemu_real_host_page_size | expand

Commit Message

Wei Yang Oct. 15, 2019, 3:13 a.m. UTC
Signed-off-by: Wei Yang <richardw.yang@linux.intel.com>
Suggested-by: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
CC: Richard Henderson <richard.henderson@linaro.org>
---
 block/file-posix.c              | 2 +-
 net/l2tpv3.c                    | 2 +-
 tests/tcg/multiarch/test-mmap.c | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

Comments

Stefano Garzarella Nov. 11, 2019, 10:06 a.m. UTC | #1
Why "core:" in the commit title?

Perhaps to indicate that the patch concerns different subsystems,
I'd use "qemu: ", but I'm not sure :-)

On Tue, Oct 15, 2019 at 11:13:50AM +0800, Wei Yang wrote:
> Signed-off-by: Wei Yang <richardw.yang@linux.intel.com>
> Suggested-by: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
> CC: Richard Henderson <richard.henderson@linaro.org>
> ---
>  block/file-posix.c              | 2 +-
>  net/l2tpv3.c                    | 2 +-
>  tests/tcg/multiarch/test-mmap.c | 2 +-
>  3 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/block/file-posix.c b/block/file-posix.c
> index 5d1995a07c..853ed42134 100644
> --- a/block/file-posix.c
> +++ b/block/file-posix.c
> @@ -2562,7 +2562,7 @@ static void check_cache_dropped(BlockDriverState *bs, Error **errp)
>      off_t end;
>  
>      /* mincore(2) page status information requires 1 byte per page */
> -    page_size = sysconf(_SC_PAGESIZE);
> +    page_size = qemu_real_host_page_size;
>      vec = g_malloc(DIV_ROUND_UP(window_size, page_size));
>  
>      end = raw_getlength(bs);
> diff --git a/net/l2tpv3.c b/net/l2tpv3.c
> index 55fea17c0f..5f843240de 100644
> --- a/net/l2tpv3.c
> +++ b/net/l2tpv3.c
> @@ -41,7 +41,7 @@
>   * chosen to be sufficient to accommodate one packet with some headers
>   */
>  
> -#define BUFFER_ALIGN sysconf(_SC_PAGESIZE)
> +#define BUFFER_ALIGN qemu_real_host_page_size
>  #define BUFFER_SIZE 2048
>  #define IOVSIZE 2
>  #define MAX_L2TPV3_MSGCNT 64
> diff --git a/tests/tcg/multiarch/test-mmap.c b/tests/tcg/multiarch/test-mmap.c
> index 9ea49e2307..370842e5c2 100644
> --- a/tests/tcg/multiarch/test-mmap.c
> +++ b/tests/tcg/multiarch/test-mmap.c
> @@ -466,7 +466,7 @@ int main(int argc, char **argv)
>      if (argc > 1) {
>          qemu_strtoul(argv[1], NULL, 0, &pagesize);
>      } else {
> -        pagesize = sysconf(_SC_PAGESIZE);
> +        pagesize = qemu_real_host_page_size;
>      }
>  
>      /* Assume pagesize is a power of two.  */

The patch LGTM:
Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>

Thanks,
Stefano
Wei Yang Nov. 11, 2019, 3:46 p.m. UTC | #2
On Mon, Nov 11, 2019 at 11:06:41AM +0100, Stefano Garzarella wrote:
>Why "core:" in the commit title?
>
>Perhaps to indicate that the patch concerns different subsystems,
>I'd use "qemu: ", but I'm not sure :-)
>

I didn't find a better one. Maybe "qemu" is better :-)

>On Tue, Oct 15, 2019 at 11:13:50AM +0800, Wei Yang wrote:
>> Signed-off-by: Wei Yang <richardw.yang@linux.intel.com>
>> Suggested-by: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
>> CC: Richard Henderson <richard.henderson@linaro.org>
>> ---
>>  block/file-posix.c              | 2 +-
>>  net/l2tpv3.c                    | 2 +-
>>  tests/tcg/multiarch/test-mmap.c | 2 +-
>>  3 files changed, 3 insertions(+), 3 deletions(-)
>> 
>> diff --git a/block/file-posix.c b/block/file-posix.c
>> index 5d1995a07c..853ed42134 100644
>> --- a/block/file-posix.c
>> +++ b/block/file-posix.c
>> @@ -2562,7 +2562,7 @@ static void check_cache_dropped(BlockDriverState *bs, Error **errp)
>>      off_t end;
>>  
>>      /* mincore(2) page status information requires 1 byte per page */
>> -    page_size = sysconf(_SC_PAGESIZE);
>> +    page_size = qemu_real_host_page_size;
>>      vec = g_malloc(DIV_ROUND_UP(window_size, page_size));
>>  
>>      end = raw_getlength(bs);
>> diff --git a/net/l2tpv3.c b/net/l2tpv3.c
>> index 55fea17c0f..5f843240de 100644
>> --- a/net/l2tpv3.c
>> +++ b/net/l2tpv3.c
>> @@ -41,7 +41,7 @@
>>   * chosen to be sufficient to accommodate one packet with some headers
>>   */
>>  
>> -#define BUFFER_ALIGN sysconf(_SC_PAGESIZE)
>> +#define BUFFER_ALIGN qemu_real_host_page_size
>>  #define BUFFER_SIZE 2048
>>  #define IOVSIZE 2
>>  #define MAX_L2TPV3_MSGCNT 64
>> diff --git a/tests/tcg/multiarch/test-mmap.c b/tests/tcg/multiarch/test-mmap.c
>> index 9ea49e2307..370842e5c2 100644
>> --- a/tests/tcg/multiarch/test-mmap.c
>> +++ b/tests/tcg/multiarch/test-mmap.c
>> @@ -466,7 +466,7 @@ int main(int argc, char **argv)
>>      if (argc > 1) {
>>          qemu_strtoul(argv[1], NULL, 0, &pagesize);
>>      } else {
>> -        pagesize = sysconf(_SC_PAGESIZE);
>> +        pagesize = qemu_real_host_page_size;
>>      }
>>  
>>      /* Assume pagesize is a power of two.  */
>
>The patch LGTM:
>Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
>
>Thanks,
>Stefano
>
diff mbox series

Patch

diff --git a/block/file-posix.c b/block/file-posix.c
index 5d1995a07c..853ed42134 100644
--- a/block/file-posix.c
+++ b/block/file-posix.c
@@ -2562,7 +2562,7 @@  static void check_cache_dropped(BlockDriverState *bs, Error **errp)
     off_t end;
 
     /* mincore(2) page status information requires 1 byte per page */
-    page_size = sysconf(_SC_PAGESIZE);
+    page_size = qemu_real_host_page_size;
     vec = g_malloc(DIV_ROUND_UP(window_size, page_size));
 
     end = raw_getlength(bs);
diff --git a/net/l2tpv3.c b/net/l2tpv3.c
index 55fea17c0f..5f843240de 100644
--- a/net/l2tpv3.c
+++ b/net/l2tpv3.c
@@ -41,7 +41,7 @@ 
  * chosen to be sufficient to accommodate one packet with some headers
  */
 
-#define BUFFER_ALIGN sysconf(_SC_PAGESIZE)
+#define BUFFER_ALIGN qemu_real_host_page_size
 #define BUFFER_SIZE 2048
 #define IOVSIZE 2
 #define MAX_L2TPV3_MSGCNT 64
diff --git a/tests/tcg/multiarch/test-mmap.c b/tests/tcg/multiarch/test-mmap.c
index 9ea49e2307..370842e5c2 100644
--- a/tests/tcg/multiarch/test-mmap.c
+++ b/tests/tcg/multiarch/test-mmap.c
@@ -466,7 +466,7 @@  int main(int argc, char **argv)
     if (argc > 1) {
         qemu_strtoul(argv[1], NULL, 0, &pagesize);
     } else {
-        pagesize = sysconf(_SC_PAGESIZE);
+        pagesize = qemu_real_host_page_size;
     }
 
     /* Assume pagesize is a power of two.  */