From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 46B98C49ED7 for ; Tue, 10 Sep 2019 14:48:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1DB162168B for ; Tue, 10 Sep 2019 14:48:55 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="PzcNTtgF" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388527AbfIJOsy (ORCPT ); Tue, 10 Sep 2019 10:48:54 -0400 Received: from mail-io1-f68.google.com ([209.85.166.68]:43872 "EHLO mail-io1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726132AbfIJOsy (ORCPT ); Tue, 10 Sep 2019 10:48:54 -0400 Received: by mail-io1-f68.google.com with SMTP id r8so13156316iol.10; Tue, 10 Sep 2019 07:48:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=y51Wmq0LRgJPRQu0wESyACMKgIN3oGN4hPyCwS8B9Fw=; b=PzcNTtgFRZmzMv0K1KK0mg45o4Yljkgb90mn498QkmecMBhhZ5hVU/NDRq0XyRodXv oqt8Gfa8DdtOS8BNXSn78trtFzo/cG4x2Q3hTi0E8/87ACzQRuE0GaG6NPFNj2w7i5hz d9eH/XfpdFJ4ZsSIItHV5fPjLK39IDFhjDsIgyoeiWYb/OgukBbYhH7k63i7aX9m43JY B2q7D5PGC8y5aL/e8xurQByjUcIrfbOUk1u3uk1YXpi2aKIq2f9GOVhCzAD0nNiZ6KBc mxNmVjxT2XEjrQHY1egt7O+EREMCd1qYYvBFoCb6XuBlHZGCELCMyobbvgTykr1X77AJ JGUw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=y51Wmq0LRgJPRQu0wESyACMKgIN3oGN4hPyCwS8B9Fw=; b=jUjXbcwCx+FQJvXSp97hvAgMMT5MvCcmQR8TxZUPgWJkk5Ygpz0qpZJNhU3RP6xRv9 1ugbaLGR1Mnd5ZRQzgwSNTODWTsIPZ4WkQooqlvM2VKjKhCFnlnLhTl1YIIrcJzQCTRl JFBCaVf1n0bEURuCHgIyb9gGo2/ZhDpGOl2bU6dsVvhgz0E+EJIjF7SNdaf7QUgELmks fzmqRNW+jg14azlr8BKN7Lxh5JZQ5vqYedSyqB9/G7pQdNgw16MNR2f7gq1A7+ebjsFU QjmGfQEGdufyHH2IXHZKzG0EBwewGfnXVxqp1iCkdtuw6i/c/dfzEX/Q2SwGyvxoXmT7 aH6A== X-Gm-Message-State: APjAAAVwhWPDTStoyJZUXEmTAu1seJaMmiwTih5Ii94zwtC/veit2yyt NuvupbHSCU4HqJenLjPaSDFm8CxYGv+HHwJEBmY= X-Google-Smtp-Source: APXvYqwN74shiAyKliNs3JxV0dTTuWrOoxH7hX54E/H8prvfohDIALH6Vobq+JG8UlF+hibP/Y2WKvw7cp3R4NGGfXs= X-Received: by 2002:a5d:8908:: with SMTP id b8mr1353105ion.237.1568126932604; Tue, 10 Sep 2019 07:48:52 -0700 (PDT) MIME-Version: 1.0 References: <20190907172225.10910.34302.stgit@localhost.localdomain> <20190907172520.10910.83100.stgit@localhost.localdomain> <20190910122030.GV2063@dhcp22.suse.cz> In-Reply-To: <20190910122030.GV2063@dhcp22.suse.cz> From: Alexander Duyck Date: Tue, 10 Sep 2019 07:48:41 -0700 Message-ID: Subject: Re: [PATCH v9 2/8] mm: Adjust shuffle code to allow for future coalescing To: Michal Hocko Cc: virtio-dev@lists.oasis-open.org, kvm list , "Michael S. Tsirkin" , Catalin Marinas , David Hildenbrand , Dave Hansen , LKML , Matthew Wilcox , linux-mm , Andrew Morton , will@kernel.org, linux-arm-kernel@lists.infradead.org, Oscar Salvador , Yang Zhang , Pankaj Gupta , Konrad Rzeszutek Wilk , Nitesh Narayan Lal , Rik van Riel , lcapitulino@redhat.com, "Wang, Wei W" , Andrea Arcangeli , ying.huang@intel.com, Paolo Bonzini , Dan Williams , Fengguang Wu , Alexander Duyck , "Kirill A. Shutemov" Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Sep 10, 2019 at 5:20 AM Michal Hocko wrote: > > On Sat 07-09-19 10:25:20, Alexander Duyck wrote: > > From: Alexander Duyck > > > > Move the head/tail adding logic out of the shuffle code and into the > > __free_one_page function since ultimately that is where it is really > > needed anyway. By doing this we should be able to reduce the overhead > > and can consolidate all of the list addition bits in one spot. > > This changelog doesn't really explain why we want this. You are > reshuffling the code, allright, but why do we want to reshuffle? Is the > result readability a better code reuse or something else? Where > does the claimed reduced overhead coming from? > > From a quick look buddy_merge_likely looks nicer than the code splat > we have. Good. > > But then > > > Reviewed-by: Dan Williams > > Signed-off-by: Alexander Duyck > > [...] > > > - if (is_shuffle_order(order)) > > - add_to_free_area_random(page, &zone->free_area[order], > > - migratetype); > > + area = &zone->free_area[order]; > > + if (is_shuffle_order(order) ? shuffle_pick_tail() : > > + buddy_merge_likely(pfn, buddy_pfn, page, order)) > > Ouch this is just awful don't you think? Yeah. I am going to go with Kirill's suggestion and probably do something more along the lines of: bool to_tail; ... if (is_shuffle_order(order)) to_tail = shuffle_pick_tail(); else to_tail = buddy_merge_likely(pfn, buddy_pfn, page, order); if (to_tail) add_to_free_area_tail(page, area, migratetype); else add_to_free_area(page, area, migratetype); From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 35482C49ED8 for ; Tue, 10 Sep 2019 14:48:55 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id EAA4421670 for ; Tue, 10 Sep 2019 14:48:54 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="PzcNTtgF" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org EAA4421670 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 8733C6B000A; Tue, 10 Sep 2019 10:48:54 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 84A986B000C; Tue, 10 Sep 2019 10:48:54 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 788766B000D; Tue, 10 Sep 2019 10:48:54 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0139.hostedemail.com [216.40.44.139]) by kanga.kvack.org (Postfix) with ESMTP id 59D816B000A for ; Tue, 10 Sep 2019 10:48:54 -0400 (EDT) Received: from smtpin14.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with SMTP id EAE58180AD7C3 for ; Tue, 10 Sep 2019 14:48:53 +0000 (UTC) X-FDA: 75919292946.14.food26_87d7092480f5d X-HE-Tag: food26_87d7092480f5d X-Filterd-Recvd-Size: 5517 Received: from mail-io1-f65.google.com (mail-io1-f65.google.com [209.85.166.65]) by imf32.hostedemail.com (Postfix) with ESMTP for ; Tue, 10 Sep 2019 14:48:53 +0000 (UTC) Received: by mail-io1-f65.google.com with SMTP id h144so38059497iof.7 for ; Tue, 10 Sep 2019 07:48:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=y51Wmq0LRgJPRQu0wESyACMKgIN3oGN4hPyCwS8B9Fw=; b=PzcNTtgFRZmzMv0K1KK0mg45o4Yljkgb90mn498QkmecMBhhZ5hVU/NDRq0XyRodXv oqt8Gfa8DdtOS8BNXSn78trtFzo/cG4x2Q3hTi0E8/87ACzQRuE0GaG6NPFNj2w7i5hz d9eH/XfpdFJ4ZsSIItHV5fPjLK39IDFhjDsIgyoeiWYb/OgukBbYhH7k63i7aX9m43JY B2q7D5PGC8y5aL/e8xurQByjUcIrfbOUk1u3uk1YXpi2aKIq2f9GOVhCzAD0nNiZ6KBc mxNmVjxT2XEjrQHY1egt7O+EREMCd1qYYvBFoCb6XuBlHZGCELCMyobbvgTykr1X77AJ JGUw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=y51Wmq0LRgJPRQu0wESyACMKgIN3oGN4hPyCwS8B9Fw=; b=iWF2tnpWqFJaGlUPIrHSAFx+I+49TN3XHui+1p6lbNTj9Vj+aPM9Lex3hyn2GzmTi6 EFFOZtQE8XJYJgVj3xDylZjBlKBwPUu5oEAAzEe0F6fl1rgKF+QPlZYouaNVYJnhwy1k EHUOKx7323kf7Qe0CA0WWqSAVVI70VWUYE/jOhZq8uZw0Bu880AwXcamgJNPR8krweQa LzYg0AF17BdS9NJgBYNlu5+0DIQGTrC0H7UowOBLfmaeIhm02yjsVq9opJAnvSmAbX46 KTJEfTiYsCFRrWt48yvUXfIxx3tyNofoBgheOyO4Bfn4eItgFJmR/m71wK4mquWWrCwF LzVw== X-Gm-Message-State: APjAAAUfClo6q9OfvxlsYpIV6kxdvmXFaIUWGxVzRsUg37N3rQobH0jN K2dOURP0DGwCCXnKaQmCpUisWV+YrEcY0TN/X4o= X-Google-Smtp-Source: APXvYqwN74shiAyKliNs3JxV0dTTuWrOoxH7hX54E/H8prvfohDIALH6Vobq+JG8UlF+hibP/Y2WKvw7cp3R4NGGfXs= X-Received: by 2002:a5d:8908:: with SMTP id b8mr1353105ion.237.1568126932604; Tue, 10 Sep 2019 07:48:52 -0700 (PDT) MIME-Version: 1.0 References: <20190907172225.10910.34302.stgit@localhost.localdomain> <20190907172520.10910.83100.stgit@localhost.localdomain> <20190910122030.GV2063@dhcp22.suse.cz> In-Reply-To: <20190910122030.GV2063@dhcp22.suse.cz> From: Alexander Duyck Date: Tue, 10 Sep 2019 07:48:41 -0700 Message-ID: Subject: Re: [PATCH v9 2/8] mm: Adjust shuffle code to allow for future coalescing To: Michal Hocko Cc: virtio-dev@lists.oasis-open.org, kvm list , "Michael S. Tsirkin" , Catalin Marinas , David Hildenbrand , Dave Hansen , LKML , Matthew Wilcox , linux-mm , Andrew Morton , will@kernel.org, linux-arm-kernel@lists.infradead.org, Oscar Salvador , Yang Zhang , Pankaj Gupta , Konrad Rzeszutek Wilk , Nitesh Narayan Lal , Rik van Riel , lcapitulino@redhat.com, "Wang, Wei W" , Andrea Arcangeli , ying.huang@intel.com, Paolo Bonzini , Dan Williams , Fengguang Wu , Alexander Duyck , "Kirill A. Shutemov" Content-Type: text/plain; charset="UTF-8" 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: On Tue, Sep 10, 2019 at 5:20 AM Michal Hocko wrote: > > On Sat 07-09-19 10:25:20, Alexander Duyck wrote: > > From: Alexander Duyck > > > > Move the head/tail adding logic out of the shuffle code and into the > > __free_one_page function since ultimately that is where it is really > > needed anyway. By doing this we should be able to reduce the overhead > > and can consolidate all of the list addition bits in one spot. > > This changelog doesn't really explain why we want this. You are > reshuffling the code, allright, but why do we want to reshuffle? Is the > result readability a better code reuse or something else? Where > does the claimed reduced overhead coming from? > > From a quick look buddy_merge_likely looks nicer than the code splat > we have. Good. > > But then > > > Reviewed-by: Dan Williams > > Signed-off-by: Alexander Duyck > > [...] > > > - if (is_shuffle_order(order)) > > - add_to_free_area_random(page, &zone->free_area[order], > > - migratetype); > > + area = &zone->free_area[order]; > > + if (is_shuffle_order(order) ? shuffle_pick_tail() : > > + buddy_merge_likely(pfn, buddy_pfn, page, order)) > > Ouch this is just awful don't you think? Yeah. I am going to go with Kirill's suggestion and probably do something more along the lines of: bool to_tail; ... if (is_shuffle_order(order)) to_tail = shuffle_pick_tail(); else to_tail = buddy_merge_likely(pfn, buddy_pfn, page, order); if (to_tail) add_to_free_area_tail(page, area, migratetype); else add_to_free_area(page, area, migratetype); From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.0 required=3.0 tests=DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C7DFBC49ED7 for ; Tue, 10 Sep 2019 14:49:00 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 9531121019 for ; Tue, 10 Sep 2019 14:49:00 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="sE6Z4Z1Q"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="PzcNTtgF" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9531121019 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:To:Subject:Message-ID:Date:From: In-Reply-To:References:MIME-Version:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=aPs3ntkeOa97TMpf0mxOkWUo7XYrDMVwnjnSu0bXTtU=; b=sE6Z4Z1Q9GQG/u Ht4rc5eHpxY+dXQhvsWaQJaWBg6nRwCjJL8iKRDD8Ly3k+ZOrlx49AiiZVt44IaKwn+ZJPUJsTxmD NRRZWeDloc8RmQ0FHKzJpgMC+YPgWbHf/vfaTSArsEL2Lmpdd0Iq7YAkLT/2kMGhHPRLgKY9ehGQG +4ZOvy7JhH3P5wQWZscF4PjVGgXG9h6WR23uNY+7m6q5wBUQB0ap4d+mWI8+ToYODso+R71aqLz/9 GpMC7mqwVnr1WsYCCFTCD3F6TduJH/N4PkzBGiu2TIrRI0DTxruK8K3HtG04maToxvq2zHc7YhYRT V8i+IOUhSNYb7zRE+hOg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1i7hRw-0006ka-Ss; Tue, 10 Sep 2019 14:48:56 +0000 Received: from mail-io1-xd44.google.com ([2607:f8b0:4864:20::d44]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1i7hRt-0006kC-Iv for linux-arm-kernel@lists.infradead.org; Tue, 10 Sep 2019 14:48:54 +0000 Received: by mail-io1-xd44.google.com with SMTP id r26so38016650ioh.8 for ; Tue, 10 Sep 2019 07:48:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=y51Wmq0LRgJPRQu0wESyACMKgIN3oGN4hPyCwS8B9Fw=; b=PzcNTtgFRZmzMv0K1KK0mg45o4Yljkgb90mn498QkmecMBhhZ5hVU/NDRq0XyRodXv oqt8Gfa8DdtOS8BNXSn78trtFzo/cG4x2Q3hTi0E8/87ACzQRuE0GaG6NPFNj2w7i5hz d9eH/XfpdFJ4ZsSIItHV5fPjLK39IDFhjDsIgyoeiWYb/OgukBbYhH7k63i7aX9m43JY B2q7D5PGC8y5aL/e8xurQByjUcIrfbOUk1u3uk1YXpi2aKIq2f9GOVhCzAD0nNiZ6KBc mxNmVjxT2XEjrQHY1egt7O+EREMCd1qYYvBFoCb6XuBlHZGCELCMyobbvgTykr1X77AJ JGUw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=y51Wmq0LRgJPRQu0wESyACMKgIN3oGN4hPyCwS8B9Fw=; b=MJ255Z9vW+33OolvEEyR1zg7c4MBq7PSOzjsQwnqoDWuu0muwVGOY3TJqCEjWCX1kR rlMD7jXtZEddDDhO6YSL6QKolJ4puLrWFPCkzvC23ZgfAkqXykKJqcBbLZIygy3nwE21 g/8pO13gpVJpbxx40tSN4vh7zlx95ttigYOtUySiOmrBl4vHHDZDgZpHpOZq2aHzV608 3uOgLHIbUnnIY8ozz5VKEviy/pM+kp3weA5MQns6x1HBJlyXokYH+9c1XYmd+DsvS2sj 6V4SlP7KMBbvOXbPoSjCZMVZucHjTEH0EhUkWSiKm/mIKC2TiPtHWgdcNcazYLy7XGuC mvIQ== X-Gm-Message-State: APjAAAWeF/9TpHXI6JdlaHkC9u3wyobwTTAT0xZYQ8ejk3B1c/MvjIjt QI2RPqVu5Xs9dQ3I9LawDvdVBkwT5qEJXkF9HJ21NYBe X-Google-Smtp-Source: APXvYqwN74shiAyKliNs3JxV0dTTuWrOoxH7hX54E/H8prvfohDIALH6Vobq+JG8UlF+hibP/Y2WKvw7cp3R4NGGfXs= X-Received: by 2002:a5d:8908:: with SMTP id b8mr1353105ion.237.1568126932604; Tue, 10 Sep 2019 07:48:52 -0700 (PDT) MIME-Version: 1.0 References: <20190907172225.10910.34302.stgit@localhost.localdomain> <20190907172520.10910.83100.stgit@localhost.localdomain> <20190910122030.GV2063@dhcp22.suse.cz> In-Reply-To: <20190910122030.GV2063@dhcp22.suse.cz> From: Alexander Duyck Date: Tue, 10 Sep 2019 07:48:41 -0700 Message-ID: Subject: Re: [PATCH v9 2/8] mm: Adjust shuffle code to allow for future coalescing To: Michal Hocko X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190910_074853_630316_413B88DD X-CRM114-Status: GOOD ( 15.87 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Yang Zhang , Pankaj Gupta , kvm list , David Hildenbrand , Catalin Marinas , lcapitulino@redhat.com, linux-mm , Alexander Duyck , will@kernel.org, Andrea Arcangeli , virtio-dev@lists.oasis-open.org, "Michael S. Tsirkin" , Matthew Wilcox , "Wang, Wei W" , ying.huang@intel.com, Rik van Riel , Konrad Rzeszutek Wilk , Dan Williams , linux-arm-kernel@lists.infradead.org, Oscar Salvador , Nitesh Narayan Lal , Dave Hansen , LKML , Paolo Bonzini , Andrew Morton , Fengguang Wu , "Kirill A. Shutemov" Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Tue, Sep 10, 2019 at 5:20 AM Michal Hocko wrote: > > On Sat 07-09-19 10:25:20, Alexander Duyck wrote: > > From: Alexander Duyck > > > > Move the head/tail adding logic out of the shuffle code and into the > > __free_one_page function since ultimately that is where it is really > > needed anyway. By doing this we should be able to reduce the overhead > > and can consolidate all of the list addition bits in one spot. > > This changelog doesn't really explain why we want this. You are > reshuffling the code, allright, but why do we want to reshuffle? Is the > result readability a better code reuse or something else? Where > does the claimed reduced overhead coming from? > > From a quick look buddy_merge_likely looks nicer than the code splat > we have. Good. > > But then > > > Reviewed-by: Dan Williams > > Signed-off-by: Alexander Duyck > > [...] > > > - if (is_shuffle_order(order)) > > - add_to_free_area_random(page, &zone->free_area[order], > > - migratetype); > > + area = &zone->free_area[order]; > > + if (is_shuffle_order(order) ? shuffle_pick_tail() : > > + buddy_merge_likely(pfn, buddy_pfn, page, order)) > > Ouch this is just awful don't you think? Yeah. I am going to go with Kirill's suggestion and probably do something more along the lines of: bool to_tail; ... if (is_shuffle_order(order)) to_tail = shuffle_pick_tail(); else to_tail = buddy_merge_likely(pfn, buddy_pfn, page, order); if (to_tail) add_to_free_area_tail(page, area, migratetype); else add_to_free_area(page, area, migratetype); _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: virtio-dev-return-6102-cohuck=redhat.com@lists.oasis-open.org Sender: List-Post: List-Help: List-Unsubscribe: List-Subscribe: Received: from lists.oasis-open.org (oasis-open.org [10.110.1.242]) by lists.oasis-open.org (Postfix) with ESMTP id C7F8A985AFA for ; Tue, 10 Sep 2019 14:48:53 +0000 (UTC) MIME-Version: 1.0 References: <20190907172225.10910.34302.stgit@localhost.localdomain> <20190907172520.10910.83100.stgit@localhost.localdomain> <20190910122030.GV2063@dhcp22.suse.cz> In-Reply-To: <20190910122030.GV2063@dhcp22.suse.cz> From: Alexander Duyck Date: Tue, 10 Sep 2019 07:48:41 -0700 Message-ID: Content-Type: text/plain; charset="UTF-8" Subject: [virtio-dev] Re: [PATCH v9 2/8] mm: Adjust shuffle code to allow for future coalescing To: Michal Hocko Cc: virtio-dev@lists.oasis-open.org, kvm list , "Michael S. Tsirkin" , Catalin Marinas , David Hildenbrand , Dave Hansen , LKML , Matthew Wilcox , linux-mm , Andrew Morton , will@kernel.org, linux-arm-kernel@lists.infradead.org, Oscar Salvador , Yang Zhang , Pankaj Gupta , Konrad Rzeszutek Wilk , Nitesh Narayan Lal , Rik van Riel , lcapitulino@redhat.com, "Wang, Wei W" , Andrea Arcangeli , ying.huang@intel.com, Paolo Bonzini , Dan Williams , Fengguang Wu , Alexander Duyck , "Kirill A. Shutemov" List-ID: On Tue, Sep 10, 2019 at 5:20 AM Michal Hocko wrote: > > On Sat 07-09-19 10:25:20, Alexander Duyck wrote: > > From: Alexander Duyck > > > > Move the head/tail adding logic out of the shuffle code and into the > > __free_one_page function since ultimately that is where it is really > > needed anyway. By doing this we should be able to reduce the overhead > > and can consolidate all of the list addition bits in one spot. > > This changelog doesn't really explain why we want this. You are > reshuffling the code, allright, but why do we want to reshuffle? Is the > result readability a better code reuse or something else? Where > does the claimed reduced overhead coming from? > > From a quick look buddy_merge_likely looks nicer than the code splat > we have. Good. > > But then > > > Reviewed-by: Dan Williams > > Signed-off-by: Alexander Duyck > > [...] > > > - if (is_shuffle_order(order)) > > - add_to_free_area_random(page, &zone->free_area[order], > > - migratetype); > > + area = &zone->free_area[order]; > > + if (is_shuffle_order(order) ? shuffle_pick_tail() : > > + buddy_merge_likely(pfn, buddy_pfn, page, order)) > > Ouch this is just awful don't you think? Yeah. I am going to go with Kirill's suggestion and probably do something more along the lines of: bool to_tail; ... if (is_shuffle_order(order)) to_tail = shuffle_pick_tail(); else to_tail = buddy_merge_likely(pfn, buddy_pfn, page, order); if (to_tail) add_to_free_area_tail(page, area, migratetype); else add_to_free_area(page, area, migratetype); --------------------------------------------------------------------- To unsubscribe, e-mail: virtio-dev-unsubscribe@lists.oasis-open.org For additional commands, e-mail: virtio-dev-help@lists.oasis-open.org