Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp787933ybl; Fri, 9 Aug 2019 13:58:49 -0700 (PDT) X-Google-Smtp-Source: APXvYqzqK09y7ZpKLblDvo1gV0XaTY9xSItiFHuKzblZH9Yag8BKTv3DZ6VCOpgOG7rF1Nf5ENdr X-Received: by 2002:a17:902:fa5:: with SMTP id 34mr15795823plz.285.1565384329629; Fri, 09 Aug 2019 13:58:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565384329; cv=none; d=google.com; s=arc-20160816; b=0Wg4iU/wnNlj0fLqYgnlv2Ww/cpfG4VB0e1//meowLeF4zR54K7hDrmqjW2a+InxEl r7HJhnOANzHf3WXXDcc0YGQsXAN4vx11GOqQhsPdVBdHb54VTEdIoCAfxfwzqT/tLM09 hgRDyUoxW+9tR3RZTve0huZXE07MqVhQhl2rBS287p3bKD08Tmj2fvmMfzn2mcshIcs9 bye+vFlEhlNzHD+wxj+ireFBIZPGFa0oQ4FNCQh4BnkzFcJZzBt5vKb6mOjrHvf9Q0/f XEG/EbRvS5NgKlnREKz+/Szb6cVIb9kBXTBVQ2ci3Eh6X3vnjcF1qN6Zb8D9+b93sUm9 sLxg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=oOFZs7lWd/cRN6ArflLZND+4GUEsB210O2v04GTqqFo=; b=tRQjhj8bttYWLrPa61sDI9ikrTnrC6UvZnggIdP8Gqe7hEYJPuqXJZcN/Ycr4uQcZh npaRfXHCTUKYNOkKCNSLTUjzZkcW8ZNVN14jYyl5kfhHnM0RbuC5GhSE/h5ErsHigVLT aexLPV8rBaCFRihLnbVW0P7tWGXxzNoxXs6IP/tEje1wIuiTzY/Vd/lpImg6vD61mqYk 4etnNFFJ/73I78/5vTAbOI9SQuClsCyVvV0kqDI/SR9HZQc7olVqJA6FsNXGm8LCCI9o w8AmkcHPy0oeHbMY3x8RcDxlU+Ji6DcvuUbEishy3GExOtKvAbAlRfV9iFxv2Pb6J9KW Quvw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=oaMUzgnk; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m35si5079622pje.84.2019.08.09.13.58.33; Fri, 09 Aug 2019 13:58:49 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=oaMUzgnk; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726053AbfHIU5y (ORCPT + 99 others); Fri, 9 Aug 2019 16:57:54 -0400 Received: from mail-ot1-f65.google.com ([209.85.210.65]:33134 "EHLO mail-ot1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725985AbfHIU5x (ORCPT ); Fri, 9 Aug 2019 16:57:53 -0400 Received: by mail-ot1-f65.google.com with SMTP id q20so137586476otl.0 for ; Fri, 09 Aug 2019 13:57:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=oOFZs7lWd/cRN6ArflLZND+4GUEsB210O2v04GTqqFo=; b=oaMUzgnkhQr8vDqzN541ro79UdzcKWW6RPUgaYRCoEUrv2bw3hFwhciMuc/FZdo5rD vxMv49GFSKxSdt8Guqkl3Ym6D8NQAmj6ZogWqxgFOIOGN12mqRCCvqwrbBbrIFOD37y6 M8RFhPFm8h2kqEcagvwI1ThRn2pW3BdZ4bWVhjR2aCUZMabFWTTkHEC+DlulLPsBkURQ J0N4hEZBmjU0BxVSkNq5NHcKLgXOHBc/TjM+c2Dd9gJEOJcM2D3+BJTM+E7rwtry6ONZ dZKKJ/RYUEo65s59sGogF3VXgWK0crDgh1g5Ht0zprHVMqVwqRhhHk2rQfVwWDNTQrMI 6Lrw== 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:content-transfer-encoding; bh=oOFZs7lWd/cRN6ArflLZND+4GUEsB210O2v04GTqqFo=; b=r3jfspSbBm/Fo5ti3pmcxCaVIrBMr7WBhSIm3AkvGXAueP5uPWpWYS805KwyopL6wr rfRYERXp+gk0NNmTQC2riyiIzE8PGTMVvooExW1FEj+22Afxc2j+J99hR21jB6qEYPx3 70wBavu5umKqxR92HRLhO2Oj06CvK5hh/llUyzDaM399Mgzfl7oR69vP66pWIeFk7BSS J94Y9l3ORyXKF5I/7IMhUpI/6dfyC8KYuixW1ZmdJm9UpfD7/Gj/pI0jiAKn6krdZGYG TSiw3PaUC4P3SHOnWw8iIwvBKsKB2TbNRNkjRdlS/P3gOvAjwfZGa7MLXaeQlOpaVMdO wmcg== X-Gm-Message-State: APjAAAWX61hayxNyE42YwOGF7qSHE0Oll+zXWI5vwTxL/Bx7lodUsRsu 6gjJWszR9zC303IM6T+2Li8TVniUaaEJB2NZVuEa4KI4/sM= X-Received: by 2002:a9d:6216:: with SMTP id g22mr18398597otj.349.1565384272566; Fri, 09 Aug 2019 13:57:52 -0700 (PDT) MIME-Version: 1.0 References: <20190808194002.226688-1-almasrymina@google.com> <20190809112738.GB13061@blackbody.suse.cz> In-Reply-To: From: Mina Almasry Date: Fri, 9 Aug 2019 13:57:41 -0700 Message-ID: Subject: Re: [RFC PATCH] hugetlbfs: Add hugetlb_cgroup reservation limits To: Mike Kravetz Cc: =?UTF-8?Q?Michal_Koutn=C3=BD?= , shuah , David Rientjes , Shakeel Butt , Greg Thelen , akpm@linux-foundation.org, khalid.aziz@oracle.com, open list , linux-mm@kvack.org, linux-kselftest@vger.kernel.org, cgroups@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Aug 9, 2019 at 1:39 PM Mike Kravetz wrote= : > > On 8/9/19 11:05 AM, Mina Almasry wrote: > > On Fri, Aug 9, 2019 at 4:27 AM Michal Koutn=C3=BD wr= ote: > >>> Alternatives considered: > >>> [...] > >> (I did not try that but) have you considered: > >> 3) MAP_POPULATE while you're making the reservation, > > > > I have tried this, and the behaviour is not great. Basically if > > userspace mmaps more memory than its cgroup limit allows with > > MAP_POPULATE, the kernel will reserve the total amount requested by > > the userspace, it will fault in up to the cgroup limit, and then it > > will SIGBUS the task when it tries to access the rest of its > > 'reserved' memory. > > > > So for example: > > - if /proc/sys/vm/nr_hugepages =3D=3D 10, and > > - your cgroup limit is 5 pages, and > > - you mmap(MAP_POPULATE) 7 pages. > > > > Then the kernel will reserve 7 pages, and will fault in 5 of those 7 > > pages, and will SIGBUS you when you try to access the remaining 2 > > pages. So the problem persists. Folks would still like to know they > > are crossing the limits on mmap time. > > If you got the failure at mmap time in the MAP_POPULATE case would this > be useful? > > Just thinking that would be a relatively simple change. Not quite, unfortunately. A subset of the folks that want to use hugetlb memory, don't want to use MAP_POPULATE (IIRC, something about mmaping a huge amount of hugetlb memory at their jobs' startup, and doing that with MAP_POPULATE adds so much to their startup time that it is prohibitively expensive - but that's just what I vaguely recall offhand. I can get you the details if you're interested). > -- > Mike Kravetz