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=-5.1 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A, SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 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 BAAAFC2BB4D for ; Mon, 15 Mar 2021 13:58:15 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 4EEA564DAD for ; Mon, 15 Mar 2021 13:58:15 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4EEA564DAD Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id C0FEA6B0036; Mon, 15 Mar 2021 09:58:14 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B99286B006C; Mon, 15 Mar 2021 09:58:14 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9C49A6B0070; Mon, 15 Mar 2021 09:58:14 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0083.hostedemail.com [216.40.44.83]) by kanga.kvack.org (Postfix) with ESMTP id 77A0E6B0036 for ; Mon, 15 Mar 2021 09:58:14 -0400 (EDT) Received: from smtpin17.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 22573180AD820 for ; Mon, 15 Mar 2021 13:58:14 +0000 (UTC) X-FDA: 77922262908.17.AC3AB2A Received: from smtprelay.test.hostedemail.com (mail.test.hostedemail.com [216.40.41.5]) by imf20.hostedemail.com (Postfix) with ESMTP id 9FA6A927F for ; Mon, 15 Mar 2021 13:28:30 +0000 (UTC) Received: from forelay.test.hostedemail.com (10.5.29.251.rfc1918.com [10.5.29.251]) by smtprelay01.test.hostedemail.com (Postfix) with ESMTP id 58A9111CEC for ; Mon, 15 Mar 2021 13:28:30 +0000 (UTC) Received: from forelay.prod.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by fograve01.test.hostedemail.com (Postfix) with ESMTP id 3808123810 for ; Mon, 15 Mar 2021 13:28:30 +0000 (UTC) Received: from smtpin16.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id F10BB824999B for ; Mon, 15 Mar 2021 13:28:29 +0000 (UTC) X-FDA: 77922187980.16.9ADF400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by imf15.hostedemail.com (Postfix) with ESMTP id 2B1F3A00D206 for ; Mon, 15 Mar 2021 13:26:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1615814799; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Qzk8VRdGUUm6dVAUfVqYW6CB+CKrhhCXO30FiEA0udA=; b=JANu7vsjY7+2iWnYvMeC3ilB6lhZOE/HUKhH0bVQI/0I6xk4A3YFBfVDRshOzegD9y7Sfo SHZslwwLI70iIqkU2mOvY6YGLqUYxxUGxI70SL9nSLV3s0PiMw0YYvsvoV13AsV1nY6TJY jmNQVzcZHzbmBY4asW21ANNLj5VJD0c= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-411-G5XfeZlMPduQo4VSW7fwFA-1; Mon, 15 Mar 2021 09:26:34 -0400 X-MC-Unique: G5XfeZlMPduQo4VSW7fwFA-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id AD900801817; Mon, 15 Mar 2021 13:26:29 +0000 (UTC) Received: from [10.36.112.200] (ovpn-112-200.ams2.redhat.com [10.36.112.200]) by smtp.corp.redhat.com (Postfix) with ESMTP id 93C1B510ED; Mon, 15 Mar 2021 13:26:09 +0000 (UTC) To: "Kirill A. Shutemov" Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, Andrew Morton , Arnd Bergmann , Michal Hocko , Oscar Salvador , Matthew Wilcox , Andrea Arcangeli , Minchan Kim , Jann Horn , Jason Gunthorpe , Dave Hansen , Hugh Dickins , Rik van Riel , "Michael S . Tsirkin" , "Kirill A . Shutemov" , Vlastimil Babka , Richard Henderson , Ivan Kokshaysky , Matt Turner , Thomas Bogendoerfer , "James E.J. Bottomley" , Helge Deller , Chris Zankel , Max Filippov , Mike Kravetz , Peter Xu , Rolf Eike Beer , linux-alpha@vger.kernel.org, linux-mips@vger.kernel.org, linux-parisc@vger.kernel.org, linux-xtensa@linux-xtensa.org, linux-arch@vger.kernel.org, Linux API References: <20210308164520.18323-1-david@redhat.com> <20210315122213.k52wtlbbhsw42pks@box> <7d607d1c-efd5-3888-39bb-9e5f8bc08185@redhat.com> <20210315130353.iqnwsnp2c2wpt4y2@box> From: David Hildenbrand Organization: Red Hat GmbH Subject: Re: [PATCH RFCv2] mm/madvise: introduce MADV_POPULATE_(READ|WRITE) to prefault/prealloc memory Message-ID: Date: Mon, 15 Mar 2021 14:26:08 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.0 MIME-Version: 1.0 In-Reply-To: <20210315130353.iqnwsnp2c2wpt4y2@box> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Received-SPF: none (redhat.com>: No applicable sender policy available) receiver=imf15; identity=mailfrom; envelope-from=""; helo=us-smtp-delivery-124.mimecast.com; client-ip=216.205.24.124 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1615814802-769275 Content-Transfer-Encoding: quoted-printable X-Stat-Signature: bpn44dr8hmhe9opnrki9to497nbkor53 X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: 9FA6A927F Received-SPF: none (redhat.com>: No applicable sender policy available) receiver=imf20; identity=mailfrom; envelope-from=""; helo=smtprelay.test.hostedemail.com; client-ip=216.40.41.5 X-HE-DKIM-Result: fail/fail (message has been altered) X-HE-Tag: 1615814910-220144 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 15.03.21 14:03, Kirill A. Shutemov wrote: > On Mon, Mar 15, 2021 at 01:25:40PM +0100, David Hildenbrand wrote: >> On 15.03.21 13:22, Kirill A. Shutemov wrote: >>> On Mon, Mar 08, 2021 at 05:45:20PM +0100, David Hildenbrand wrote: >>>> + case -EHWPOISON: /* Skip over any poisoned pages. */ >>>> + start +=3D PAGE_SIZE; >>>> + continue; >>> >>> Why is it good approach? It's not abvious to me. >> >> My main motivation was to simplify return code handling. I don't want = to >> return -EHWPOISON to user space >=20 > Why? Hiding the problem under the rug doesn't help anybody. SIGBUS late= r > is not better than an error upfront. Well, if you think about "prefaulting page tables", the first intuition=20 is certainly not to check for poisoned pages, right? After all, you are=20 not actually accessing memory, you are allocating memory if required and=20 fill page tables. OTOH, mlock() will also choke on poisoned pages. With the current semantics, you can start and run a VM just fine.=20 Preallocation/prefaulting succeeded after all. On access you will get a=20 SIGBUS, from which e.g., QEMU can recover by injecting an MCE into the=20 guest - just like if you would hit a poisoned page later. The problem we are talking about is most probably very rare, especially=20 when using MADV_POPULATE_ for actual preallocation. I don't have a strong opinion; not bailing out on poisoned pages felt=20 like the right thing to do. --=20 Thanks, David / dhildenb