[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Minios-devel] [UNIKRAFT PATCH] lib/ukallocbbuddy: Fix the number of pages when resetting memory regions
- To: minios-devel@xxxxxxxxxxxxx
- From: Costin Lupu <costin.lupu@xxxxxxxxx>
- Date: Wed, 3 Apr 2019 13:43:04 +0300
- Cc: felipe.huici@xxxxxxxxx, Florian.Schmidt@xxxxxxxxx, simon.kuenzer@xxxxxxxxx, yuri.volchkov@xxxxxxxxx, sharan.santhanam@xxxxxxxxx
- Delivery-date: Wed, 03 Apr 2019 10:43:15 +0000
- Ironport-phdr: 9a23:X9HfQh31D/WZjMpPsmDT+DRfVm0co7zxezQtwd8ZsesXKv/xwZ3uMQTl6Ol3ixeRBMOHsqsC07Gd6/2oGTRZp8rY6DZaKN0EfiRGoP1epxYnDs+BBB+zB9/RRAt+Iv5/UkR49WqwK0lfFZW2TVTTpnqv8WxaQU2nZkJ6KevvB4Hdkdm82fys9J3PeQVIgye2ba9vIBmsogjdq9QajZF+Jqs/xRfFvntFcPlSyW90OF6fhRnx6tqs8JJ57yhcp/ct/NNcXKvneKg1UaZWByk8PWAv483ruxjDTQ+R6XYZT24bjBlGDRXb4R/jRpv+vTf0ueR72CmBIM35Vqs0Vii476dqUxDnliEKPCMk/W7Ni8xwiKVboA+9pxF63oXZbp2ZOOZ4c6jAe94RWGhPUdtLVyFZAo2ycZYBAeQCM+hftITxu0cCoAGiCQS2GO/j1jlFjWL2060g1OQhFBnL0RInH9IVrHTUrdP1P7oUX+Co1KnI0CjIYvRK1jf684jIbhEhofeWUbJ0bMrR0VQvGhjZgVWLs4DlJy6V2f8Xv2iB6OptTOSigHMkpQFpujWj28ghhpTTio8Wyl3I7zt1zJg3KNGiRkN3ecOoHZRNuy2ANIZ7QtkuT39mtSs00LEKpJG2cDYMxZ863RDQceaHfJKN4h/7UeaRJip3i2x9dbKkghay7VCgyurhVsmoyFpKrjRKkt3Ltn0VyRzT79KISvp5/ku7xTmPzBrf6vlZIU8vj6bbMZkhzqYxlpoVr0vDAjf7lFj5gaOLbEkp+eil5/75brn4pJKQLYF5hhn7Mqs0m8y/Beo4MhIJX2ie4emzyLrj/VblQLVLiP06iK3ZsI3CJcQGvaO2HxRV3pw76xaiFDiqys4YnX4fIFJfZB2Hl5TpO03JIP3gCPe/glKskDZsx/DdJ7HuH4vCLmbdn7flZrt9709cyBEvzdBE/Z5VBa8OIPTpVk/2rtzYAQczMxaozOb/FNV9yoQeVHqPDK+dN6PSq16I6fgpI+WWeYEapDb9K/0k5/HzkX80glkdcre10psTcn+3Be5qLFuEYXD0mNcODX8KvhYiTOztkFCCXyBcZ3KzX6Ik+D43EoKmDZrCRo+xgbyMxyG7EYNKaWBCEF+DCm3keJuZW/0UciKdPtdhkiAYVbimU4IhzhGuuxXgy7V9KOrY4DYYuojl1Nhp5+3cjxcy+iZxD8mG1WGCUX17nmcSSDAtxqxwv1F9wE+Z0adkm/xYCcBT5/RRXwchNJ7cyut6C9boVgLCY9eGVlCmQ9S4DjErVd8xxcEBbFp5G9q4lR/PxTSlA6INnbyRGJM06r7c32T2J8tly3fGybMhj1g8TstRMm2mgrJw9wjQB47OjUWUjKCqeroA0y7J7miM1nCCs19FUF04baKQWHEZZ0zN6Nj0+E7GZ7uvEqg8dBtMz4iFMKQZRMfuiABtQ+z/OdKWR3+phi/kDhGT2rKKKo73Y3g11z6bEFUO1RoUqyXVfTMiDzus9jqNRAdlEkjiNhvh
- Ironport-sdr: uykUlobi4kq6uvBywMUARDRqIe2Y6K1yLLoKik1zp/mIkKdE7veKa4R5CcZmrax2UdPTa/2XQ1 LXwJZLGpyv7w==
- List-id: Mini-os development list <minios-devel.lists.xenproject.org>
If len=0x7ec2000, when using the formula we get memr->nr_pages=32448. On
the other hand range value becomes 0x7ec1000 and (range >> __PAGE_SHIFT)
== 32449 which is wrong. Therefore we should memr->nr_pages as the
correct number of pages.
Signed-off-by: Costin Lupu <costin.lupu@xxxxxxxxx>
---
lib/ukallocbbuddy/bbuddy.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/ukallocbbuddy/bbuddy.c b/lib/ukallocbbuddy/bbuddy.c
index 13a7942b..7f6aad51 100644
--- a/lib/ukallocbbuddy/bbuddy.c
+++ b/lib/ukallocbbuddy/bbuddy.c
@@ -411,7 +411,7 @@ static int bbuddy_addmem(struct uk_alloc *a, void *base,
size_t len)
memr->mm_alloc_bitmap_size);
/* free up the memory we've been given to play with */
- map_free(b, min, (unsigned long)(range >> __PAGE_SHIFT));
+ map_free(b, min, memr->nr_pages);
count = 0;
while (range != 0) {
--
2.11.0
_______________________________________________
Minios-devel mailing list
Minios-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/minios-devel
|