Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp2938798ybl; Sun, 11 Aug 2019 11:47:13 -0700 (PDT) X-Google-Smtp-Source: APXvYqwaSblYmZluF8FCTNPEoLVW/Ox7GENsempCWSudj36ypUz64gXBhwkuh1y7KcamqI3f0a+R X-Received: by 2002:a17:902:3363:: with SMTP id a90mr28161314plc.119.1565549233649; Sun, 11 Aug 2019 11:47:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565549233; cv=none; d=google.com; s=arc-20160816; b=bFStU6xhpny50zvsqXYmDiKZ0KhwLEK4+NZ91RGe5g/lVVkcqTVzhkFuQEBS9mfOLD j4jJn/siMbHaFRBFMhwZAE2kAaLzcqj3rjFczyEC9Qep/zmgRwdRwt5KCU5HyqsXaSjS gyC9WKFEYJ0EyqU9pTAYXuQp8kN67gtkl/NmsswthhSAsW/N9RPfXncvYMtZrnOZOFtg ulNUwXuuE77im95PsKa2/b5a5fwYqu72cRkbfkJKUna08pxdEc5kyIlpbkeCJEOYR3VS J5Sdknz32+LOc+vk0xIHofLotQH30CrBOq9zVeLzcBrN3OivL83LE8EafBpTM+GOv1/q i5dA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature; bh=G0DOFHA8eVoNDoQdcja02y/muQPflx5tBcQTBpoDNTE=; b=h2kZMGGBzRBpMrpw3k+6tLmQ1nzjItVYRamjSawIYys8NYGTLr7JIiLpFTUKvWY/k9 lJO1skoMwGRtl3ym1ii1rvgC410vHiT15gH6ocFxD4Hw7epzYhDpNDCVC5x4i5P7T0qy Xj1JRqsAI3IymWU1Guyw/iX867q9+LIvcp9KA45IB3bCZ+9GJzTZiblGWAH7LE4tMRaw C8rsY330zbPhEn9hHjrk4dg7w4Eq26/2skeL3KzlejY5kbe5fr3nFm5tB5sO3ugoZQON KmoC09e75BVjstne2IEyKBKJmlEsjqAd/tFbQZT6r3ICgW0lYIlfY4pzWIl1OAYX0cz0 d5vQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=DAUesqdC; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h194si3754451pfe.144.2019.08.11.11.46.58; Sun, 11 Aug 2019 11:47:13 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=DAUesqdC; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726094AbfHKSq0 (ORCPT + 99 others); Sun, 11 Aug 2019 14:46:26 -0400 Received: from mail-lj1-f196.google.com ([209.85.208.196]:35185 "EHLO mail-lj1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725847AbfHKSq0 (ORCPT ); Sun, 11 Aug 2019 14:46:26 -0400 Received: by mail-lj1-f196.google.com with SMTP id l14so6506189lje.2 for ; Sun, 11 Aug 2019 11:46:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=G0DOFHA8eVoNDoQdcja02y/muQPflx5tBcQTBpoDNTE=; b=DAUesqdCL/UDY5CBh48z8ZaXw12W2P3pXntHhwx0odgZ90g6ku9enum8kXMj7Jl801 6xIuICl2jKUK2CGqqzqvsRbGp+woveSHR3StSkXSDyDHQCIzVSzV8tHX6r0x6QDuFA0p Tl5Ah3Ss0AWssXrSPISLfUk9BBDGMPA3wAT7nOMeIgs58B/zPC20CleNlmJhCXn7wgVJ DrFos1G+JBSvRaUHW9/cc5JiRZM39+vJ3ZMX0w0oygqknabbOEtTYE9TabDNyOWfSEqR JCfZeImwzo+h/mwkX6uyWEJOlm6djgasegJGuUyydgrRvAcSA/GK/NLut58O+o10DMt6 0Iqg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=G0DOFHA8eVoNDoQdcja02y/muQPflx5tBcQTBpoDNTE=; b=O4YbVVOJx2MWjNnKXY2K4LkSYVb795sYaWvyNhg9wqrER+s4yRgCnyDDVqYshyd8pc fefU1RB7AVsHMnTS+REgWXrWV9X+hWL6/OV71TZr4ZLGptpKhyxAALlw57ezm811JyN2 y7EZ1BJhBAHH1jCBb10z5XkOq2Uambia4LQpWy056SLetFsS/vQmFj5nar+nCgLlAbAn jDLNN730Fv/ajTPfbdx+VmDWZbq2jnzpmV8VqenjNyCAo3+O5fzGXQ3fpA66Nxe6lxY4 iIOu4JxmN3HuK/kAG7KbBQknJAQeV93xIm6RxXkGGT17oqRCrOm8IvZtRnADgKK6nUQ9 ScMA== X-Gm-Message-State: APjAAAWKG/QkdyBD1oZASk7+AczbS8tFKQ0XRgyE5i16vDmloteR3gJr vNjjp6ecPDyQmPqib42DUT/2ywB+kf3PEA== X-Received: by 2002:a2e:9889:: with SMTP id b9mr7541875ljj.230.1565549183913; Sun, 11 Aug 2019 11:46:23 -0700 (PDT) Received: from localhost.localdomain ([37.212.199.11]) by smtp.gmail.com with ESMTPSA id t66sm1536425lje.66.2019.08.11.11.46.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 11 Aug 2019 11:46:23 -0700 (PDT) From: "Uladzislau Rezki (Sony)" To: Andrew Morton , Michel Lespinasse Cc: linux-mm@kvack.org, LKML , Peter Zijlstra , Roman Gushchin , Uladzislau Rezki , Hillf Danton , Michal Hocko , Matthew Wilcox , Oleksiy Avramchenko , Steven Rostedt Subject: [PATCH 0/2] some cleanups related to RB_DECLARE_CALLBACKS_MAX Date: Sun, 11 Aug 2019 20:46:11 +0200 Message-Id: <20190811184613.20463-1-urezki@gmail.com> X-Mailer: git-send-email 2.11.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Recently we have got RB_DECLARE_CALLBACKS_MAX template that is supposed to be used in case of having an augmented value as scalar value. First patch just simplifies the *_compute_max() callback by using max3() macro that makes the code more transparent, i think. No functional changes. Second patch reuses RB_DECLARE_CALLBACKS_MAX template's internal functionality, that is generated to manage augment red-black tree instead of using our own and the same logic in vmalloc. Just get rid of duplication. No functional changes. Also i have open question related to validating of the augment tree, i mean in case of debugging to check that nodes are maintained correctly. Please have a look here: https://lkml.org/lkml/2019/7/29/304 Basically we can add one more function under RB_DECLARE_CALLBACKS_MAX template making it public that checks a tree and its augmented nodes. At least i see two users where it can be used: vmalloc and lib/rbtree_test.c. Appreciate for any comments. Uladzislau Rezki (Sony) (2): augmented rbtree: use max3() in the *_compute_max() function mm/vmalloc: use generated callback to populate subtree_max_size include/linux/rbtree_augmented.h | 40 +++++++++++++++++----------------- mm/vmalloc.c | 31 +------------------------- tools/include/linux/rbtree_augmented.h | 40 +++++++++++++++++----------------- 3 files changed, 41 insertions(+), 70 deletions(-) -- 2.11.0