From patchwork Thu Nov 25 11:27:07 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Eric Ren X-Patchwork-Id: 12638959 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6A730C433EF for ; Thu, 25 Nov 2021 11:27:39 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id DEBE56B0074; Thu, 25 Nov 2021 06:27:23 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id D9A7C6B0075; Thu, 25 Nov 2021 06:27:23 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C62A96B007B; Thu, 25 Nov 2021 06:27:23 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0054.hostedemail.com [216.40.44.54]) by kanga.kvack.org (Postfix) with ESMTP id B906D6B0074 for ; Thu, 25 Nov 2021 06:27:23 -0500 (EST) Received: from smtpin09.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id D67448CE34 for ; Thu, 25 Nov 2021 11:27:12 +0000 (UTC) X-FDA: 78847226346.09.FF58C40 Received: from mail-pj1-f49.google.com (mail-pj1-f49.google.com [209.85.216.49]) by imf24.hostedemail.com (Postfix) with ESMTP id B1ED1B0000B2 for ; Thu, 25 Nov 2021 11:27:08 +0000 (UTC) Received: by mail-pj1-f49.google.com with SMTP id cq22-20020a17090af99600b001a9550a17a5so7564279pjb.2 for ; Thu, 25 Nov 2021 03:27:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=to:cc:from:subject:message-id:date:user-agent:mime-version :content-transfer-encoding; bh=vWKO68zsc+vJfNWs2rXBi28hvn6q7TtokUmUL73MPo0=; b=Iw6005183TDXUckZg8HL9xLNZDU26P3gZduh2Kdu1gfpiu4Lva7sszoNgdwsePvPap P5AuWFtvapWLIOlp7auyb+2biihrnhCJobS33Nw4ozHOhCAP1y3G2N2WtleTJibA0SgE /zJJywy5VFOhThEtRJ9qaNfsR3aEC5iIp2UIvC3K4QV55de7NtjeMMm0YzMGM0FbGzC+ A+n2+cWEIEjYDvLZrKU7+IR+JnpB+dkHrMGC2JuXo9PlTY8xwzUzi6CK3seb+uPdbqev xQWlCx2foMkzTgvXxm39F6OxiINbkmSW8HtIIKTXxXhJ8B3POmR9b7ffO83MUt645xtL /qDQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:to:cc:from:subject:message-id:date:user-agent :mime-version:content-transfer-encoding; bh=vWKO68zsc+vJfNWs2rXBi28hvn6q7TtokUmUL73MPo0=; b=IH4TP9GW6cBLqpWOxEa/rwd7yy0QHNKGGzAd/aiuGcgOMwac88MoLDTYDUQ4v1d9Id zDZJB7NA2TaMof/9vq8slFk4zU0ktd91BH1wd5AaIBqP66Wd1GQ+GaM5CjcLqAUVo0ux uInKua9O80c4kdxg8i3BfQUofEq6ExqCWeqaEGSTMP3Pkx+yv4AcFADQ4XkuQZ0XHY5W esAakxBwOM2+Onug3xjAm+h5aXctSij82Owbs3niT99R63G2RYqnD/NizQcJq+AQctpW UWBMPfu88kvT1CkEGZ8/MctVim4j0nW6XArMncsVRbVIiTh/vcZEgsO1rq//p2jL0kJw yfYA== X-Gm-Message-State: AOAM533NqJzaXng8Vu9cxGId9qZfxRwfBNuhcrPFaJ4orPcIQ37lqJqY CK9MzNEmFPU27gtBKwOKm9dWkuE0uXNVdQ== X-Google-Smtp-Source: ABdhPJwMCiemJKSHcNm2KPTulHsRls6dPMLEngnX0y5N3LVL9W4oMfBw9VAyPUars9ehkk0m5RUtOw== X-Received: by 2002:a17:90b:3e8c:: with SMTP id rj12mr6099356pjb.152.1637839630658; Thu, 25 Nov 2021 03:27:10 -0800 (PST) Received: from ali-6c96cfe09cf9.local ([205.204.117.106]) by smtp.gmail.com with ESMTPSA id v1sm2230173pgs.21.2021.11.25.03.27.09 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 25 Nov 2021 03:27:10 -0800 (PST) To: David Hildenbrand Cc: linux-mm@kvack.org From: Eric Ren Subject: =?utf-8?q?Question_about_virtio=5Fmm=3A_why_plug/unplug_with_4MB_gr?= =?utf-8?q?anularity=EF=BC=9F?= Message-ID: <7299f769-3dc8-1f77-c4f2-1e3dc7427689@gmail.com> Date: Thu, 25 Nov 2021 19:27:07 +0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.14.0 MIME-Version: 1.0 X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: B1ED1B0000B2 X-Stat-Signature: wo5qouoj1snpp9zu6bgrs7fc4qn3xkao Authentication-Results: imf24.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=Iw600518; spf=pass (imf24.hostedemail.com: domain of renzhengeek@gmail.com designates 209.85.216.49 as permitted sender) smtp.mailfrom=renzhengeek@gmail.com; dmarc=pass (policy=none) header.from=gmail.com X-HE-Tag: 1637839628-481391 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: Hi David, As the subject, I'm wondering if we can make virtio_mm plug/unplug with futher more fine granularity like 2MB? I gave it try as below, and it works. 1. Revert this patch:   aac65321ba69("mm/memory_hotplug: simplify page onlining"); 2. Tell mm hotplug core invoke online page callback with order 9 with changes as below; ``` order */ ``` 3. in virtio_mem driver, change subblock size to 2MB. Thought the hack testing works, I'm feeling not safe. Could you please help give some insights on these questions? 1. Is 4M a hard limitation? 2. What troubles we can foresee if using 2MB as granularity? Best regards, Eric diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c index 5873563a3518..22a9636402b1 100644 --- a/mm/memory_hotplug.c +++ b/mm/memory_hotplug.c @@ -622,7 +622,9 @@ static int online_pages_range(unsigned long start_pfn, unsigned long nr_pages,          * them as being online/belonging to this zone ("present").          */         for (pfn = start_pfn; pfn < end_pfn; pfn += 1ul << order) { -               order = min(MAX_ORDER - 1, get_order(PFN_PHYS(end_pfn - pfn))); +               /* 2MB callback */ +               order = min(MAX_ORDER - 2, get_order(PFN_PHYS(end_pfn - pfn)));                 /* __free_pages_core() wants pfns to be aligned to the