All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] linux-user: Do not treat madvise()'s advice as a bitmask
@ 2022-07-25 13:41 Ilya Leoshkevich
  2022-07-28 17:22 ` Laurent Vivier
  2022-07-29 13:09 ` Laurent Vivier
  0 siblings, 2 replies; 3+ messages in thread
From: Ilya Leoshkevich @ 2022-07-25 13:41 UTC (permalink / raw)
  To: Laurent Vivier; +Cc: qemu-devel, Christian Borntraeger, Ilya Leoshkevich

Advice is enum, not flags. Doing (advice & MADV_DONTNEED) also matches
e.g. MADV_MERGEABLE.

Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
---
 linux-user/mmap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/linux-user/mmap.c b/linux-user/mmap.c
index 4e7a6be6ee..edceaca4a8 100644
--- a/linux-user/mmap.c
+++ b/linux-user/mmap.c
@@ -891,7 +891,7 @@ abi_long target_madvise(abi_ulong start, abi_ulong len_in, int advice)
      * anonymous mappings. In this case passthrough is safe, so do it.
      */
     mmap_lock();
-    if ((advice & MADV_DONTNEED) &&
+    if (advice == MADV_DONTNEED &&
         can_passthrough_madv_dontneed(start, end)) {
         ret = get_errno(madvise(g2h_untagged(start), len, MADV_DONTNEED));
     }
-- 
2.35.3



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] linux-user: Do not treat madvise()'s advice as a bitmask
  2022-07-25 13:41 [PATCH] linux-user: Do not treat madvise()'s advice as a bitmask Ilya Leoshkevich
@ 2022-07-28 17:22 ` Laurent Vivier
  2022-07-29 13:09 ` Laurent Vivier
  1 sibling, 0 replies; 3+ messages in thread
From: Laurent Vivier @ 2022-07-28 17:22 UTC (permalink / raw)
  To: Ilya Leoshkevich; +Cc: qemu-devel, Christian Borntraeger

Le 25/07/2022 à 15:41, Ilya Leoshkevich a écrit :
> Advice is enum, not flags. Doing (advice & MADV_DONTNEED) also matches
> e.g. MADV_MERGEABLE.
> 
> Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
> ---
>   linux-user/mmap.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/linux-user/mmap.c b/linux-user/mmap.c
> index 4e7a6be6ee..edceaca4a8 100644
> --- a/linux-user/mmap.c
> +++ b/linux-user/mmap.c
> @@ -891,7 +891,7 @@ abi_long target_madvise(abi_ulong start, abi_ulong len_in, int advice)
>        * anonymous mappings. In this case passthrough is safe, so do it.
>        */
>       mmap_lock();
> -    if ((advice & MADV_DONTNEED) &&
> +    if (advice == MADV_DONTNEED &&
>           can_passthrough_madv_dontneed(start, end)) {
>           ret = get_errno(madvise(g2h_untagged(start), len, MADV_DONTNEED));
>       }

Fixes: 892a4f6a750a ("linux-user: Add partial support for MADV_DONTNEED")
Reviewed-by: Laurent Vivier <laurent@vivier.eu>


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] linux-user: Do not treat madvise()'s advice as a bitmask
  2022-07-25 13:41 [PATCH] linux-user: Do not treat madvise()'s advice as a bitmask Ilya Leoshkevich
  2022-07-28 17:22 ` Laurent Vivier
@ 2022-07-29 13:09 ` Laurent Vivier
  1 sibling, 0 replies; 3+ messages in thread
From: Laurent Vivier @ 2022-07-29 13:09 UTC (permalink / raw)
  To: Ilya Leoshkevich; +Cc: qemu-devel, Christian Borntraeger

Le 25/07/2022 à 15:41, Ilya Leoshkevich a écrit :
> Advice is enum, not flags. Doing (advice & MADV_DONTNEED) also matches
> e.g. MADV_MERGEABLE.
> 
> Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
> ---
>   linux-user/mmap.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/linux-user/mmap.c b/linux-user/mmap.c
> index 4e7a6be6ee..edceaca4a8 100644
> --- a/linux-user/mmap.c
> +++ b/linux-user/mmap.c
> @@ -891,7 +891,7 @@ abi_long target_madvise(abi_ulong start, abi_ulong len_in, int advice)
>        * anonymous mappings. In this case passthrough is safe, so do it.
>        */
>       mmap_lock();
> -    if ((advice & MADV_DONTNEED) &&
> +    if (advice == MADV_DONTNEED &&
>           can_passthrough_madv_dontneed(start, end)) {
>           ret = get_errno(madvise(g2h_untagged(start), len, MADV_DONTNEED));
>       }


Applied to my linux-user-for-7.1 branch.

Thanks,
Laurent


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-07-29 13:34 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-25 13:41 [PATCH] linux-user: Do not treat madvise()'s advice as a bitmask Ilya Leoshkevich
2022-07-28 17:22 ` Laurent Vivier
2022-07-29 13:09 ` Laurent Vivier

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.