Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp4561541imm; Mon, 25 Jun 2018 18:56:21 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIrZ0vZyISAwSmovFdPzCEPFYET+lcQpYDvknjojYE9R280a5/GqI//0j0jCyqU9prXycd5 X-Received: by 2002:a62:a6dd:: with SMTP id r90-v6mr15231559pfl.60.1529978181851; Mon, 25 Jun 2018 18:56:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529978181; cv=none; d=google.com; s=arc-20160816; b=yT0VUH70cB0HHbw9mhwj6SvTYEuZvXJ0RQ/n7em8pjVdgGZ0HE8mie+lrLiSytIFUC tQhVNUXhz2rJrL3C2sGL1089wSyOTJe4s0gLQuf34XsA8retjqmnU532SDCFTdtIkqaY 9by/27iZ4JEJwWaGR5ecWWBYjwZ7tcsGBTqJ8dRILFME1vBAGCYRzfzesG+eMEfzaI1L IwaBgU0KRrRjbsSpmUueQQUQ1TRgG+mADE3mz4mAlENY0qQ+NsC6vWFafw8dAtTdjEZh oaUIOq8cXwF9sOMeOi4seuMjfJz9cJ5dAOoBWBlULes/ZwES4DNaSEAIFSiXn7W4XZou 6rng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :arc-authentication-results; bh=dNjVQJ5jVOdK6qxmOU7QcOYOSP6333EyGqBkXZPdr3c=; b=pRYSWCmypruNh5wdMoMVy2/QKtPwVGfYl7k4xsm0vetqcRY9EGEHHpTGVt1VSCj72r PuhIGzQk8QEgeWpIkfAHh62LfTVopOQFvfU62lL0QRV90YL/EcolIKFJqTVapdaIjOva IQAUIXc8w4Kjlr6ww4Eh9qLiHCrNjbPC+S4jqLQwKRmgL7xThRWzBhrUj6BBBoEfNdst 9LKwkdDjBxr7qRiNZ0IUw+DrcXiL2OyXYUWkGg+eS/PsEWKs3vUBktnJjaHSEIDTtP6y Bgar7yYZ3ySvykYzEcKcT7KMtCUOCz8b5717eRxUWDN4hibv6A8hn+kustAcbXEeME6F TYpw== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o25-v6si377958pge.7.2018.06.25.18.56.07; Mon, 25 Jun 2018 18:56:21 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935173AbeFZBza (ORCPT + 99 others); Mon, 25 Jun 2018 21:55:30 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:38332 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S934740AbeFZBz3 (ORCPT ); Mon, 25 Jun 2018 21:55:29 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 90CC0401EF1D; Tue, 26 Jun 2018 01:55:28 +0000 (UTC) Received: from redhat.com (ovpn-122-22.rdu2.redhat.com [10.10.122.22]) by smtp.corp.redhat.com (Postfix) with SMTP id 7D8C12026D67; Tue, 26 Jun 2018 01:55:26 +0000 (UTC) Date: Tue, 26 Jun 2018 04:55:26 +0300 From: "Michael S. Tsirkin" To: Linus Torvalds Cc: wei.w.wang@intel.com, virtio-dev@lists.oasis-open.org, Linux Kernel Mailing List , virtualization , KVM list , linux-mm , Michal Hocko , Andrew Morton , Paolo Bonzini , liliang.opensource@gmail.com, yang.zhang.wz@gmail.com, quan.xu0@gmail.com, nilal@redhat.com, Rik van Riel , peterx@redhat.com Subject: Re: [PATCH v33 1/4] mm: add a function to get free page blocks Message-ID: <20180626045118-mutt-send-email-mst@kernel.org> References: <1529037793-35521-1-git-send-email-wei.w.wang@intel.com> <1529037793-35521-2-git-send-email-wei.w.wang@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.5]); Tue, 26 Jun 2018 01:55:28 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.5]); Tue, 26 Jun 2018 01:55:28 +0000 (UTC) for IP:'10.11.54.4' DOMAIN:'int-mx04.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'mst@redhat.com' RCPT:'' Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Jun 16, 2018 at 08:08:53AM +0900, Linus Torvalds wrote: > On Fri, Jun 15, 2018 at 2:08 PM Wei Wang wrote: > > > > This patch adds a function to get free pages blocks from a free page > > list. The obtained free page blocks are hints about free pages, because > > there is no guarantee that they are still on the free page list after > > the function returns. ... > > +uint32_t get_from_free_page_list(int order, __le64 buf[], uint32_t size) ... > > Ack. This is the kind of simple interface where I don't need to worry > about the MM code calling out to random drivers or subsystems. > > I think that "order" should be checked for validity, but from a MM > standpoint I think this is fine. > > Linus The only issue seems to be getting hold of buf that's large enough - and we don't really know what the size is, or whether one buf would be enough. Linus, do you think it would be ok to have get_from_free_page_list actually pop entries from the free list and use them as the buffer to store PAs? Caller would be responsible for freeing the returned entries. -- MST