/* * kern/dqdt.h - Distributed Quad Decision Tree * * Author : Alain Greiner (2016,2017,2018) * * Copyright (c) UPMC Sorbonne Universites * * This file is part of ALMOS-MKH * * ALMOS-kernel is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by * the Free Software Foundation; version 2.0 of the License. * * ALMOS-kernel is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with ALMOS-kernel; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef _DQDT_H_ #define _DQDT_H_ #include #include #include /**************************************************************************************** * This DQDT infrastructure maintains a topological description of ressources usage * in each cluster: number of threads, and number of physical pages allocated. * * - If X_SIZE or Y_SIZE are equal to 1, it makes the assumption that the cluster * topology is a one dimensionnal vector, an build the smallest one-dimensionnal * quad-tree covering this one-dimensionnal vector. If the number of clusters * is not a power of 4, the tree is truncated as required. * * TODO : the mapping for the one dimensionnal topology is not implemented yet [AG]. * * - If both Y_SIZE and Y_SIZE are larger than 1, it makes the assumption that * the clusters topology is a 2D mesh. The [X,Y] coordinates of a cluster are * obtained from the CXY identifier using the Rrelevant macros. * X = CXY >> Y_WIDTH / Y = CXY & ((1< argument, as specified by the argument. The level 0 * DQDT node is udated, and this change is immediately propagated to upper levels. * They are called by PPM on each physical memory page allocation or release. **************************************************************************************** * @ cxy : target cluster identifier. * @ order : ln2( number of 4 Kbytes pages ) ***************************************************************************************/ void dqdt_increment_pages( cxy_t cxy , uint32_t order ); void dqdt_decrement_pages( cxy_t cxy, uint32_t order ); /**************************************************************************************** * This function can be called in any cluster. It traverses the DQDT tree * from the root to the bottom, to analyse the computing load and select the cluster * with the lowest number ot threads to place a new process. **************************************************************************************** * @ returns the cluster identifier with the lowest computing load. ***************************************************************************************/ cxy_t dqdt_get_cluster_for_process( void ); /**************************************************************************************** * This function can be called in any cluster. It traverses the DQDT tree * from the root to the bottom, to analyse the memory load and select the cluster * with the lowest memory load for dynamic memory allocation with no locality constraint. **************************************************************************************** * @ returns the cluster identifier with the lowest memory load. ***************************************************************************************/ cxy_t dqdt_get_cluster_for_memory( void ); /**************************************************************************************** * This function displays on kernel TXT0 the DQDT state for all nodes in the quad-tree. * It traverses the quadtree from root to bottom, and can be called by a thread * running in any cluster ***************************************************************************************/ void dqdt_display( void ); #endif /* _DQDT_H_ */