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=-3.8 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,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 996ABC56202 for ; Tue, 17 Nov 2020 15:58:45 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 0872524686 for ; Tue, 17 Nov 2020 15:58:44 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="p8sWlliy" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0872524686 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 620E66B0036; Tue, 17 Nov 2020 10:58:44 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 5D0976B006E; Tue, 17 Nov 2020 10:58:44 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 499B96B0070; Tue, 17 Nov 2020 10:58:44 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0171.hostedemail.com [216.40.44.171]) by kanga.kvack.org (Postfix) with ESMTP id 1A1376B0036 for ; Tue, 17 Nov 2020 10:58:44 -0500 (EST) Received: from smtpin13.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id B53228249980 for ; Tue, 17 Nov 2020 15:58:43 +0000 (UTC) X-FDA: 77494368126.13.idea97_150252227332 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin13.hostedemail.com (Postfix) with ESMTP id 85FDE18140B70 for ; Tue, 17 Nov 2020 15:58:43 +0000 (UTC) X-HE-Tag: idea97_150252227332 X-Filterd-Recvd-Size: 4498 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf08.hostedemail.com (Postfix) with ESMTP for ; Tue, 17 Nov 2020 15:58:42 +0000 (UTC) Received: from kernel.org (unknown [77.125.7.142]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id D3B60238E6; Tue, 17 Nov 2020 15:58:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1605628721; bh=9is+MjALfTGepw57FVx0JouySPxlzfHt3CDVLQ4Unmk=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=p8sWlliyDkUNYoXZjFWSoiuQvdgEZNX+2SxP4AeRu3E6J1nQ7q1oTfz+6Ip2yE0wn cmwAFaK1S/AmhU4S6q0bHx0jhCupiexg9VCuzKWD3rTOMD16YOJ0wT4exivwNxppfK VG9oFzcdjadQK9Y3xyHqBPePYLUqwIL58wy/neZo= Date: Tue, 17 Nov 2020 17:58:29 +0200 From: Mike Rapoport To: David Hildenbrand Cc: Andrew Morton , Alexander Viro , Andy Lutomirski , Arnd Bergmann , Borislav Petkov , Catalin Marinas , Christopher Lameter , Dan Williams , Dave Hansen , Elena Reshetova , "H. Peter Anvin" , Ingo Molnar , James Bottomley , "Kirill A. Shutemov" , Matthew Wilcox , Mark Rutland , Mike Rapoport , Michael Kerrisk , Palmer Dabbelt , Paul Walmsley , Peter Zijlstra , Rick Edgecombe , Shuah Khan , Thomas Gleixner , Tycho Andersen , Will Deacon , linux-api@vger.kernel.org, linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-nvdimm@lists.01.org, linux-riscv@lists.infradead.org, x86@kernel.org Subject: Re: [PATCH v8 2/9] mmap: make mlock_future_check() global Message-ID: <20201117155829.GJ370813@kernel.org> References: <20201112190827.GP4758@kernel.org> <7A16CA44-782D-4ABA-8D93-76BDD0A90F94@redhat.com> <20201115082625.GT4758@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: Content-Transfer-Encoding: quoted-printable X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Tue, Nov 17, 2020 at 04:09:39PM +0100, David Hildenbrand wrote: > On 15.11.20 09:26, Mike Rapoport wrote: > > On Thu, Nov 12, 2020 at 09:15:18PM +0100, David Hildenbrand wrote: ... > > My thinking was that since secretmem does what mlock() does wrt > > swapability, it should at least obey the same limit, i.e. > > RLIMIT_MEMLOCK. >=20 > Right, but at least currently, it behaves like any other CMA allocation > (IIRC they are all unmovable and, therefore, not swappable). In the fut= ure, > if pages would be movable (but not swappable), I guess it might makes m= ore > sense. I assume we never ever want to swap secretmem. >=20 > "man getrlimit" states for RLIMIT_MEMLOCK: >=20 > "This is the maximum number of bytes of memory that may be > locked into RAM. [...] This limit affects > mlock(2), mlockall(2), and the mmap(2) MAP_LOCKED operation. > Since Linux 2.6.9, it also affects the shmctl(2) SHM_LOCK op=E2=80=90 > eration [...]" >=20 > So that place has to be updated as well I guess? Otherwise this might c= ome > as a surprise for users. Sure. > >=20 > > > E.g., we also don=E2=80=98t > > > account for gigantic pages - which might be allocated from CMA and = are > > > not swappable. > > Do you mean gigantic pages in hugetlbfs? >=20 > Yes >=20 > > It seems to me that hugetlbfs accounting is a completely different > > story. >=20 > I'd say it is right now comparable to secretmem - which is why I though > similar accounting would make sense. IMHO, using RLIMIT_MEMLOCK and memcg is a more straightforward way than a custom cgroup. And if we'll see a need for additional mechanism, we can always add it. =20 > --=20 > Thanks, >=20 > David / dhildenb >=20 >=20 --=20 Sincerely yours, Mike.