Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp7212437pxb; Thu, 18 Feb 2021 04:40:23 -0800 (PST) X-Google-Smtp-Source: ABdhPJxoP2AsbovUe+bTBEdLCJ1rN6GEcADsoL1FZVdDNcd2+/JR7AJxdMkv09IYGkg8GaIqqCQw X-Received: by 2002:aa7:c555:: with SMTP id s21mr3882723edr.43.1613652022803; Thu, 18 Feb 2021 04:40:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613652022; cv=none; d=google.com; s=arc-20160816; b=CPP+QxFvLmx/ARWsD+Xi5W9h+ocYlZTMoJVB1K/mGw66o6TVZnYndrNn97i39fgoil WWV/IndYHWLqPFP06pUl/PleX2zLTg2lRvCSBQrj/EFwBqgxZpEEJqtZ66msketqvcx7 YjYbCc9YQ/tvdtL1eFAvefBFeiEaHRfpApZiGJYJz7vE8YibyFY9xUxjqsZqNpPeiN65 Sa0ReSeYoSZ/DlxV7BTnq7A2tpht0i7FiJohYpFfIWDIyRavpyUVcAV1IBgauR7JCcP0 /OTn2WdKwT4gZB1i62o/aS2KHN/Po4hx6s7pmWdCMV05r8gzkanFxI5Fg3OlHRPvv4la xziA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:organization :references:cc:to:from:subject:dkim-signature; bh=gcqiQcLIQresUmqBjSfx8mrrnANdscT5bovWT1NTSz4=; b=F+Gpl0I1mJe+Xg2MthI/ndYqw7Bqp4IV3B72KTo92f8Ai99gFD0JZRbq9o4AoDDO4e ceJH77S9t6QoxQ46vbMhh0cKcG9WyRId25AXh1t4GcqUiNaPFPWBZQT7dGb4NK1WXl2u wpQFyw30aP/K4iUOvqlk2cF1QYGGNWMrYlYz0avqZitLspZTQl1Au+8OuSxdZYLkp6ru eaifD+z3hiR+Tww9ax54x4fzLlNAyamfloSSTEu5Kxoa8d0Hhx3oMBDtsy9LZZF/QiIK oBh06B3frwlxxH2ifJBaDFkjJ9fkYHu0T028vli3afcNkTNzI9r6m6gkSxyzFMmVA38B 2ATw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=MhTHGU5Q; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bs15si3432540ejb.717.2021.02.18.04.39.58; Thu, 18 Feb 2021 04:40:22 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=MhTHGU5Q; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233023AbhBRMfU (ORCPT + 99 others); Thu, 18 Feb 2021 07:35:20 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:56592 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231129AbhBRK4e (ORCPT ); Thu, 18 Feb 2021 05:56:34 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1613645703; 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=gcqiQcLIQresUmqBjSfx8mrrnANdscT5bovWT1NTSz4=; b=MhTHGU5QZ7UOIvNh9DjoOnTQeYx3yhFZ0KBQ7TfyCNpRf6nrCWSrPFR+VDO5/qAgtfZlWL LJKoc60uGbTlvr/8cfrDAxkvfRrHmS4ATE5EPBc8y82Ds3TM8Ftinxw2DHdk5azT38KhRv fSvpcdZaWmnHAAouNAhZyMTWKN3fisk= 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-290-9O4f9C2-NQaWM_0J6rqvXQ-1; Thu, 18 Feb 2021 05:55:01 -0500 X-MC-Unique: 9O4f9C2-NQaWM_0J6rqvXQ-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 032E7107ACC7; Thu, 18 Feb 2021 10:54:58 +0000 (UTC) Received: from [10.36.114.59] (ovpn-114-59.ams2.redhat.com [10.36.114.59]) by smtp.corp.redhat.com (Postfix) with ESMTP id 29CF45D9C2; Thu, 18 Feb 2021 10:54:49 +0000 (UTC) Subject: Re: [PATCH RFC] mm/madvise: introduce MADV_POPULATE to prefault/prealloc memory From: David Hildenbrand To: Michal Hocko Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, Andrew Morton , Arnd Bergmann , 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 , 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 References: <20210217154844.12392-1-david@redhat.com> <3763a505-02d6-5efe-a9f5-40381acfbdfd@redhat.com> Organization: Red Hat GmbH Message-ID: Date: Thu, 18 Feb 2021 11:54:48 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.7.0 MIME-Version: 1.0 In-Reply-To: <3763a505-02d6-5efe-a9f5-40381acfbdfd@redhat.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org >>> If we hit >>> hardware errors on pages, ignore them - nothing we really can or >>> should do. >>> 3. On errors during MADV_POPULATED, some memory might have been >>> populated. Callers have to clean up if they care. >> >> How does caller find out? madvise reports 0 on success so how do you >> find out how much has been populated? > > If there is an error, something might have been populated. In my QEMU > implementation, I simply discard the range again, good enough. I don't > think we need to really indicate "error and populated" or "error and not > populated". Clarifying again: if madvise(MADV_POPULATED) succeeds, it returns 0. If there was a problem poopulating memory, it returns -ENOMEM (similar to MADV_WILLNEED). Callers can detect the error and discard. -- Thanks, David / dhildenb