From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: ** X-Spam-Status: No, score=2.4 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,HTML_MESSAGE,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5C1D0C433DF for ; Tue, 26 May 2020 11:41:07 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 1AF64207CB for ; Tue, 26 May 2020 11:41:07 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="cNlYSE56" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1AF64207CB Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id A3C5B800A5; Tue, 26 May 2020 07:41:06 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 9ECC180061; Tue, 26 May 2020 07:41:06 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 901FD800A5; Tue, 26 May 2020 07:41:06 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0127.hostedemail.com [216.40.44.127]) by kanga.kvack.org (Postfix) with ESMTP id 770B280061 for ; Tue, 26 May 2020 07:41:06 -0400 (EDT) Received: from smtpin09.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 3F31940D0 for ; Tue, 26 May 2020 11:41:06 +0000 (UTC) X-FDA: 76858678932.09.paste43_26b24867cfb47 X-HE-Tag: paste43_26b24867cfb47 X-Filterd-Recvd-Size: 5343 Received: from mail-qt1-f194.google.com (mail-qt1-f194.google.com [209.85.160.194]) by imf20.hostedemail.com (Postfix) with ESMTP for ; Tue, 26 May 2020 11:41:05 +0000 (UTC) Received: by mail-qt1-f194.google.com with SMTP id x12so15772582qts.9 for ; Tue, 26 May 2020 04:41:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=MmJSjoVal7xy6kWiiZWvx4LrbmJNvk5ne8y23H4F+YQ=; b=cNlYSE56Hr1+Hws3RQpjdVEGmoyIuv+jPLAx5dsptKS2roP8jLrPjhRyd0v4rngrUG POpey414GPa6OXblgmtrVq5WXsZPtPY8xid22hE97bo+9I/4nvey7R56/eoat4eRuSLx iDWpGrvUWVd2t07d93vzBui2sE4Dy5wUU9Mz97a+RqjSt3hsCixmEXsjFjJSwFRdOcHP idYPNn7WGUBfug0FQzN0OmiJh82htyqDe9UITKg4JPjlm5BhlK/uuX0oGsjkvNpLfFSK juzbcx6lNMv+szeDbK+Gv5zd5C1NWfGTZJm/mAhOTfnlGY0EiKqDALdFFhZaKiUFTUD/ YEsQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=MmJSjoVal7xy6kWiiZWvx4LrbmJNvk5ne8y23H4F+YQ=; b=h9RcQuSIuKDRHLsvYNnd8y+x4rJOOWbMEglGXa++/c6jboNveozR7lFu41FFIyA2AB 348wosoajXN6Kup6NSV7d3lWPoq2Na+M6xyX2kGgWtsiv9Qz1xwOuHgK02vytr2W7u05 xONVIgHl9++WTKfTTCANnYxU9Ro41vk/BLJwYXEn9IP/zKWoNVFJaSje5Rzn9ONOa9iE BO7ksBHwJj+3s+DZTfR+RE+bfo8Q1UbE7xdgVCOx64+3Eh6gJ7rCcC1/SKYvT6ILF5nu COJCD+C+BqHad54IT1QoXbP0SYieTxUeYuXXMmVzlxnTbH3gk9/mznxvLIONIKyslKWT THdw== X-Gm-Message-State: AOAM531Vt2FaXfWy1kgkED89OXc1R+EpoPuKlp8RcmOsgZsUCDylQjZi ujb69YqsVrcfo2x8Tl/JCXE4wy6QrKg0fAmN55Q= X-Google-Smtp-Source: ABdhPJyprjT877iD7Z77pILWEy4G5vIGP42HZYXaOzLbNhQVbANVjTRAG4jAyOcYS8IXv2HLiOnWfczTRHdvaoLu8Ow= X-Received: by 2002:ac8:7106:: with SMTP id z6mr759809qto.310.1590493265266; Tue, 26 May 2020 04:41:05 -0700 (PDT) MIME-Version: 1.0 References: <20200524174021.f37b8fd9b9ffa9fafab0970e@linux-foundation.org> In-Reply-To: <20200524174021.f37b8fd9b9ffa9fafab0970e@linux-foundation.org> From: Phi Debian Date: Tue, 26 May 2020 13:40:54 +0200 Message-ID: Subject: Re: [Bug 207861] New: mremap MAP_ANONYMOUS|MAP_SHARED grow provide bad mapping. To: Andrew Morton Cc: bugzilla-daemon@bugzilla.kernel.org, linux-mm@kvack.org, Rik van Riel , Hugh Dickins Content-Type: multipart/alternative; boundary="000000000000180b4305a68b9233" X-Bogosity: Ham, tests=bogofilter, spamicity=0.122833, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: --000000000000180b4305a68b9233 Content-Type: text/plain; charset="UTF-8" Hi All, Following up, I think I got the big picture with what you said, and then I think, that 'may be' there is no real use case for MAP__ANONYMOUS|MAP_SHARED, well I guess we can even say there is none otherwise they would have voiced long ago :) I got trapped into it in a multithreaded app trying to be smart and grow the regions that way :). I guess this could be closed with a simple little notice in the man page, eventually in the BUGS section, specifying that using mremap() on MAP_SHARED is not supported beside the virtual addr aliasing already mentioned. I got trapped after rereading again and again the fine manual, and thinking for a minute I must miss something. Note that MAP__ANONYMOUS|MAP_SHARED works nicely, and this one is very useful to implement performant 'realloc' without copy for page (multipages) realloc, with all the precaution that no addr of the memory region got to be taken due to the vaddr migration potential, that's already mentioned in the man page. So the fix is simply docco I guess :) Cheers, Phi --000000000000180b4305a68b9233 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi All,

Following up, I thin= k I got the big picture with what you said, and then I think, that 'may= be' there is no real use case for MAP__ANONYMOUS|MAP_SHARED, well I gu= ess we can even say there is none otherwise they would have voiced long ago= :) I got trapped into it in a multithreaded app trying to be smart and gro= w the regions that way :). I guess this could be closed with a simple littl= e notice in the man page, eventually in the BUGS section, specifying that u= sing mremap() on MAP_SHARED is not supported beside the virtual addr aliasi= ng already mentioned. I got trapped after rereading again and again the fin= e manual, and thinking for a minute I must miss something.
Note that MAP__ANONYMOUS|MAP_SHARED works nicely, and this one= is very useful to implement performant 'realloc' without copy for = page (multipages) realloc, with all the precaution that no addr of the memo= ry region got to be taken due to the vaddr migration potential, that's = already mentioned in the man page.

So the fix is s= imply docco I guess :)

Cheers,
Phi
=


--000000000000180b4305a68b9233--