staging: lustre: replace memory_presure funcitons by standard interfaces.
[linux-2.6-microblaze.git] / drivers / staging / lustre / include / linux / libcfs / libcfs_prim.h
1 // SPDX-License-Identifier: GPL-2.0
2 /*
3  * GPL HEADER START
4  *
5  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License version 2 only,
9  * as published by the Free Software Foundation.
10  *
11  * This program is distributed in the hope that it will be useful, but
12  * WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * General Public License version 2 for more details (a copy is included
15  * in the LICENSE file that accompanied this code).
16  *
17  * You should have received a copy of the GNU General Public License
18  * version 2 along with this program; If not, see
19  * http://www.gnu.org/licenses/gpl-2.0.html
20  *
21  * GPL HEADER END
22  */
23 /*
24  * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
25  * Use is subject to license terms.
26  */
27 /*
28  * This file is part of Lustre, http://www.lustre.org/
29  * Lustre is a trademark of Sun Microsystems, Inc.
30  *
31  * libcfs/include/libcfs/libcfs_prim.h
32  *
33  * General primitives.
34  *
35  */
36
37 #ifndef __LIBCFS_PRIM_H__
38 #define __LIBCFS_PRIM_H__
39
40 /*
41  * Memory
42  */
43 #if BITS_PER_LONG == 32
44 /* limit to lowmem on 32-bit systems */
45 #define NUM_CACHEPAGES \
46         min(totalram_pages, 1UL << (30 - PAGE_SHIFT) * 3 / 4)
47 #else
48 #define NUM_CACHEPAGES totalram_pages
49 #endif
50
51 #endif