Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/external/bsd/drm2/include/linux Expand shrinker stubs.



details:   https://anonhg.NetBSD.org/src/rev/ac23d01f6641
branches:  trunk
changeset: 1027965:ac23d01f6641
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Sun Dec 19 01:22:37 2021 +0000

description:
Expand shrinker stubs.

diffstat:

 sys/external/bsd/drm2/include/linux/shrinker.h |  21 +++++++++++++++++++--
 1 files changed, 19 insertions(+), 2 deletions(-)

diffs (57 lines):

diff -r 76ab54368be0 -r ac23d01f6641 sys/external/bsd/drm2/include/linux/shrinker.h
--- a/sys/external/bsd/drm2/include/linux/shrinker.h    Sun Dec 19 01:22:29 2021 +0000
+++ b/sys/external/bsd/drm2/include/linux/shrinker.h    Sun Dec 19 01:22:37 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: shrinker.h,v 1.4 2018/08/27 07:18:18 riastradh Exp $   */
+/*     $NetBSD: shrinker.h,v 1.5 2021/12/19 01:22:37 riastradh Exp $   */
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -32,8 +32,11 @@
 #ifndef _LINUX_SHRINKER_H_
 #define _LINUX_SHRINKER_H_
 
+#include <uvm/uvm.h>
+
 struct shrink_control {
        unsigned long   nr_to_scan;
+       unsigned long   nr_scanned;
 };
 
 struct shrinker {
@@ -43,15 +46,17 @@
        unsigned long   (*scan_objects)(struct shrinker *,
                            struct shrink_control *);
        int             seeks;
+       size_t          batch;
 };
 
 #define        SHRINK_STOP     (~0UL)
 
 #define        DEFAULT_SEEKS   2       /* XXX cargo-culted from Linux */
 
-static inline void
+static inline int
 register_shrinker(struct shrinker *shrinker __unused)
 {
+       return 0;
 }
 
 static inline void
@@ -59,4 +64,16 @@
 {
 }
 
+static inline bool
+current_is_kswapd(void)
+{
+       return curlwp == uvm.pagedaemon_lwp;
+}
+
+static inline size_t
+get_nr_swap_pages(void)
+{
+       return uvmexp.swpages;
+}
+
 #endif  /* _LINUX_SHRINKER_H_ */



Home | Main Index | Thread Index | Old Index