From nobody Sat Jul 03 08:34:50 2021 X-Original-To: freebsd-hackers@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 3FAC111F5E6A for ; Sat, 3 Jul 2021 08:34:53 +0000 (UTC) (envelope-from gusev.vitaliy@gmail.com) Received: from mail-lj1-x22c.google.com (mail-lj1-x22c.google.com [IPv6:2a00:1450:4864:20::22c]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GH4y50vZ3z4ZjM; Sat, 3 Jul 2021 08:34:52 +0000 (UTC) (envelope-from gusev.vitaliy@gmail.com) Received: by mail-lj1-x22c.google.com with SMTP id r16so16840068ljk.9; Sat, 03 Jul 2021 01:34:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:message-id:mime-version:subject:date:in-reply-to:cc:to :references; bh=/t+3DsHlBQDD99isBTOOhsJfCx5CG0ZoCFNJvgLaU98=; b=qs0aEFaUyoV271N1hP1WlyX5TIJ6Kl87R/nzumeVmOwnH15U8jAT82T96jO0Rr8LO/ 918kx+Q+Jvn8Tq9B6NF2ShbJ8jVAfnadGbz3IBovSjbbYXi6NaqR+MLMpztQ6vMollAz cyaOqY8mt5kiUZXWp67vuR76TIE0Fp8YGwyo56oN99ICFIwoXIi4vzXdh3NTGdXJbfPL jjvgltUtRX9+3TwLvxKkk7vMzQUbGGaoQ2OsKdKjrIRg+bNm2Wr357LjzcAeaejLDkeV N0p3S2h9wjJO3Y+d2eMNCVg4vVoCK9lTOc8JwX8BQyXCCH1MMeUklU5jGS6jKjRW5BTq Hzsw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:message-id:mime-version:subject:date :in-reply-to:cc:to:references; bh=/t+3DsHlBQDD99isBTOOhsJfCx5CG0ZoCFNJvgLaU98=; b=qKnSOnGcp2L3Ki8ppjywznvWiDlPysP91+COWlYTB6uP4Bg9DbbImeQh4T+PhmrRiD Z8R5Dr3A/im9YbYz1KJ/iCnHsM6CVojpgxO/txr2ZrC74nJKYoHsZC/MgcVHUolyFWmW QBMOSd8vnpscIWBa9pyKF8/dDU0mxtFE0vsKLie4HX2pGlhxTqOkRabMjRIF0Yoo4zKA JmCt/zKrt8S2Cvej/VCmpi43a/fKOb8ABnbkPAnGfVrNCRDWXDftYOsKqEIweqFwwwas QDuPk1umZ/MjMhIFN3Qwkb0o6DFbQvFuqPXG4BNqUFIYTYf2Zs37TLT46nQTM3gCBIAe L7Yw== X-Gm-Message-State: AOAM53389b7fKpTi9AVKKwaA8PO05OEWk7GdkVB40puL962JrWmPFR4r 4mNyyNRtQlIEi5bkUMl/fOg= X-Google-Smtp-Source: ABdhPJyRycJLnncugefjBAAwqP741bnakvrjWU9a9mQYJ8rNYOiTN8H0yRAuTbRlJMqgX4zEdFBDyQ== X-Received: by 2002:a05:651c:201e:: with SMTP id s30mr2854990ljo.364.1625301291519; Sat, 03 Jul 2021 01:34:51 -0700 (PDT) Received: from [10.42.0.5] ([188.187.60.230]) by smtp.gmail.com with ESMTPSA id v10sm547609ljp.20.2021.07.03.01.34.50 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 03 Jul 2021 01:34:51 -0700 (PDT) From: Vitaliy Gusev Message-Id: Content-Type: multipart/alternative; boundary="Apple-Mail=_E13708A3-36BC-422B-A795-631242F67439" List-Id: Technical discussions relating to FreeBSD List-Archive: https://lists.freebsd.org/archives/freebsd-hackers List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-hackers@freebsd.org Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.120.23.2.7\)) Subject: Re: madvise(MADV_FREE) doesn't work in some cases? Date: Sat, 3 Jul 2021 11:34:50 +0300 In-Reply-To: <20210703065420.6dbafb5f@ernst.home> Cc: freebsd-hackers@freebsd.org, "kib@freebsd.org" To: gljennjohn@gmail.com References: <20210703065420.6dbafb5f@ernst.home> X-Mailer: Apple Mail (2.3608.120.23.2.7) X-Rspamd-Queue-Id: 4GH4y50vZ3z4ZjM X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; TAGGED_FROM(0.00)[] X-ThisMailContainsUnwantedMimeParts: Y --Apple-Mail=_E13708A3-36BC-422B-A795-631242F67439 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > On 3 Jul 2021, at 09:54, Gary Jennejohn wrote: >=20 > The FreeBSD mail server apparently removed the attachment. >=20 > So either provide it in-line or put it on some pubic file server and > add a link to it. >=20 > --=20 > Gary Jennejohn #include #include #include #include #include #include int main(int argc, char *argv[]) { size_t len =3D (size_t)(argc > 1 ? atoi(argv[1]) : 1024) * 1024 = * 1024; uint8_t *ptr, *end, *p; unsigned pagesz =3D 1<<12; int pid; ptr =3D mmap(NULL, len, PROT_WRITE | PROT_READ, MAP_ANONYMOUS | = MAP_PRIVATE, -1, 0); if (ptr =3D=3D MAP_FAILED) err(1, "cannot mmap"); end =3D ptr + len; printf("mmap %p pid %d\n", ptr, getpid()); printf("end %p len %#lx\n", end, len); fflush(stdout); pid =3D fork(); if (pid < 0) err(1, "cannot fork"); printf("pid %d\n", getpid()); sleep(pid =3D=3D 0 ? 1 : 14); printf("%d: touch\n", getpid()); p =3D ptr; while (p < end) { *p =3D 1; p +=3D pagesz; } printf("%d: sleep before madvise\n", getpid()); sleep(pid =3D=3D 0 ? 1 : 4); printf("%d, madvise\n", getpid()); p =3D ptr; while (p < end) { int error; error =3D madvise(p, pagesz, MADV_FREE); if (error) { err(1, "cannot madvise"); } p +=3D pagesz; } printf("%d: Press enter to exit\n", getpid()); getchar(); } =E2=80=94=E2=80=94 Vitaliy Gusev= --Apple-Mail=_E13708A3-36BC-422B-A795-631242F67439--