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=-4.0 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED 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 3B485C433E4 for ; Tue, 28 Jul 2020 02:41:05 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id C864A2070A for ; Tue, 28 Jul 2020 02:41:04 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=bytedance-com.20150623.gappssmtp.com header.i=@bytedance-com.20150623.gappssmtp.com header.b="v9x4Nd39" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C864A2070A Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=bytedance.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 05D566B0002; Mon, 27 Jul 2020 22:41:04 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 00DB16B0005; Mon, 27 Jul 2020 22:41:03 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E3F126B0006; Mon, 27 Jul 2020 22:41:03 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0073.hostedemail.com [216.40.44.73]) by kanga.kvack.org (Postfix) with ESMTP id CC1FD6B0002 for ; Mon, 27 Jul 2020 22:41:03 -0400 (EDT) Received: from smtpin06.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 7DD06181AC9B6 for ; Tue, 28 Jul 2020 02:41:03 +0000 (UTC) X-FDA: 77085932406.06.hole70_3002e4526f66 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin06.hostedemail.com (Postfix) with ESMTP id 4F52A10037CC4 for ; Tue, 28 Jul 2020 02:41:03 +0000 (UTC) X-HE-Tag: hole70_3002e4526f66 X-Filterd-Recvd-Size: 4326 Received: from mail-pg1-f194.google.com (mail-pg1-f194.google.com [209.85.215.194]) by imf11.hostedemail.com (Postfix) with ESMTP for ; Tue, 28 Jul 2020 02:41:02 +0000 (UTC) Received: by mail-pg1-f194.google.com with SMTP id t6so11071587pgq.1 for ; Mon, 27 Jul 2020 19:41:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=n68pwSghXWgsDmyZS0HNGk1OCTBojCVhiofwdUm2ZsI=; b=v9x4Nd39BbkbtN6v46io1CQ2wm0Poht3rOk8BlWHRzuZE3iOfy4N3sUVJcYetkL2f9 1A5RnpK/Qeo9Y+9zutxAJD1ljA23EYfHYf2PpQeqI5Zy9YhO8KSbA0J9t3CF+f2nl1FP zTYK78NYvesL1LJUnFBwp6pZhZqKtc+IgNss/kzGGTXyxR+Ki4TFu1heUnoRONe6U50H UuqDQykQ2NbjWUYy9xXEvMA8O3Dute3ClxWQ4oDf0JZiHgh+8QxOg1SW/x949Bnp0XW0 bEO9+IY56jrhGDcaos0R8EXSlTaI4Pjf+tLEnnHXufqgAA+FwUeFDLeqLPdw4+d2uf7+ D6uA== 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=n68pwSghXWgsDmyZS0HNGk1OCTBojCVhiofwdUm2ZsI=; b=P9VEHfBltc+F/xpwiN8tfE7ZWcA8tdG75bKIXMk5wtbi2HAiGH2IpeF4HbpHL+A4SW nQrHa9vF0T8Kxa6MFCtWcXfquR5fSaUuO3YWws61G9ukR1uyGdY7hkPx/cPsJMH3CjTm AoxVVBFTsSOLC+N9l2eWEQD/vB5oKVsxeBgoK+p9F5YHxy0U6Ta7/zv1IAz1I1NfCjQQ HNSIgTV/PlWzxRPhJ2EOweZRX+zvdn6m0oC4UTC0RYpa2IFgUKoXBSDy09z6HooxZtb7 tN7fmdW3tQauE24Y6mZ8RmzmFu0xDmImZa0rvlP5vQ0H71sScZoMeX/yIvgI26X3ENne 2Evg== X-Gm-Message-State: AOAM531qGbaPUNAifYTvR+RvMOD9YpRTnxo3nNJy1rtkvq61CRWlaD3w EDZAy6rB9kQ0cBrGYG2TMqb1J1sMXrRIHKLk/HMCwQ== X-Google-Smtp-Source: ABdhPJwH31/0tgUHWrYoecZ9F4UMDVgg17KdG5paKg3PUsxhHrUgBsch7aZCeHqY0LLOKgvJcfc7idTEDPYOOUMs+vw= X-Received: by 2002:a62:195:: with SMTP id 143mr22048348pfb.226.1595904061453; Mon, 27 Jul 2020 19:41:01 -0700 (PDT) MIME-Version: 1.0 References: <20200725080749.70470-1-songmuchun@bytedance.com> <20200727171953.443afb897bb88261facf5512@linux-foundation.org> In-Reply-To: <20200727171953.443afb897bb88261facf5512@linux-foundation.org> From: Muchun Song Date: Tue, 28 Jul 2020 10:40:22 +0800 Message-ID: Subject: Re: [External] Re: [PATCH v3] mm/hugetlb: add mempolicy check in the reservation routine To: Andrew Morton Cc: mike.kravetz@oracle.com, Michal Hocko , David Rientjes , mgorman@suse.de, Michel Lespinasse , Linux Memory Management List , LKML , Jianchao Guo Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 4F52A10037CC4 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam03 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, Jul 28, 2020 at 8:19 AM Andrew Morton wrote: > > On Sat, 25 Jul 2020 16:07:49 +0800 Muchun Song wrote: > > > In the reservation routine, we only check whether the cpuset meets > > the memory allocation requirements. But we ignore the mempolicy of > > MPOL_BIND case. If someone mmap hugetlb succeeds, but the subsequent > > memory allocation may fail due to mempolicy restrictions and receives > > the SIGBUS signal. This can be reproduced by the follow steps. > > > > 1) Compile the test case. > > cd tools/testing/selftests/vm/ > > gcc map_hugetlb.c -o map_hugetlb > > > > 2) Pre-allocate huge pages. Suppose there are 2 numa nodes in the > > system. Each node will pre-allocate one huge page. > > echo 2 > /proc/sys/vm/nr_hugepages > > > > 3) Run test case(mmap 4MB). We receive the SIGBUS signal. > > numactl --membind=0 ./map_hugetlb 4 > > > > With this patch applied, the mmap will fail in the step 3) and throw > > "mmap: Cannot allocate memory". > > This doesn't compile with CONFIG_NUMA=n - ther eis no implementation of > get_task_policy(). > > I think it needs more than a simple build fix - can we please rework > the patch so that its impact (mainly code size) on non-NUMA machines is > minimized? > OK. I will do that, thanks. -- Yours, Muchun