Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756617AbdLOO31 (ORCPT ); Fri, 15 Dec 2017 09:29:27 -0500 Received: from aserp2130.oracle.com ([141.146.126.79]:53358 "EHLO aserp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755503AbdLOO3Z (ORCPT ); Fri, 15 Dec 2017 09:29:25 -0500 Subject: Re: [PATCH] xen/balloon: Mark unallocated host memory as UNUSABLE To: Juergen Gross , xen-devel@lists.xen.org, linux-kernel@vger.kernel.org References: <1513119066-10748-1-git-send-email-boris.ostrovsky@oracle.com> <14852f9f-f234-3226-f32b-3080ca114332@suse.com> Cc: helgaas@kernel.org, christian.koenig@amd.com From: Boris Ostrovsky Message-ID: Date: Fri, 15 Dec 2017 09:24:50 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: <14852f9f-f234-3226-f32b-3080ca114332@suse.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8745 signatures=668648 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=2 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1711220000 definitions=main-1712150204 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 801 Lines: 27 >> + >> + hostmem_resource->start = max_addr; >> + hostmem_resource->end = entry->addr + entry->size; >> + for (; i < memmap.nr_entries; i++) { >> + entry = &xen_e820_table->entries[i]; >> + if (entry->type == E820_TYPE_RAM) > Shouldn't that be != ? No, the idea here is to populate hostmem_resource with ranges already taken by things other than RAM, leaving memory regions as available for the balloon hotplug. This will allow us to use allocate_resource(), which searches for a free range, in the balloon driver. > >> + continue; >> + >> + res = kzalloc(sizeof(*res), GFP_KERNEL); >> + if (!res) { >> + pr_warn("%s: Out of memory\n", __func__); > Don't print error message in case of allocation failures. Right, In fact checkpatch also suggested that I drop it. And I forgot. -boris