Skip to content

Commit 1d9f0b6

Browse files
mauri870gopherbot
authored andcommitted
unix: add linux cachestat system call
The cachestat system call is an alternative to mincore that offers more extensive page cache statistics, aiming to enhance scalability. It was added on Linux 6.5. Fixes golang/go#61917 Change-Id: If1b6b96f859dd6bf09f1a0c048abfa743a42c540 GitHub-Last-Rev: d18fbb9 GitHub-Pull-Request: #176 Reviewed-on: https://go-review.googlesource.com/c/sys/+/533242 Reviewed-by: Ian Lance Taylor <[email protected]> Reviewed-by: Dmitri Shuralyov <[email protected]> Auto-Submit: Ian Lance Taylor <[email protected]> LUCI-TryBot-Result: Go LUCI <[email protected]>
1 parent 8ccaaf0 commit 1d9f0b6

File tree

4 files changed

+41
-0
lines changed

4 files changed

+41
-0
lines changed

Diff for: unix/linux/types.go

+17
Original file line numberDiff line numberDiff line change
@@ -461,6 +461,20 @@ struct my_can_bittiming_const {
461461
462462
struct riscv_hwprobe {};
463463
#endif
464+
465+
// copied from /usr/include/uapi/linux/mman.h
466+
struct cachestat_range {
467+
__u64 off;
468+
__u64 len;
469+
};
470+
471+
struct cachestat {
472+
__u64 nr_cache;
473+
__u64 nr_dirty;
474+
__u64 nr_writeback;
475+
__u64 nr_evicted;
476+
__u64 nr_recently_evicted;
477+
};
464478
*/
465479
import "C"
466480

@@ -5813,3 +5827,6 @@ const (
58135827
type SchedAttr C.struct_sched_attr
58145828

58155829
const SizeofSchedAttr = C.sizeof_struct_sched_attr
5830+
5831+
type Cachestat_t C.struct_cachestat
5832+
type CachestatRange C.struct_cachestat_range

Diff for: unix/syscall_linux.go

+2
Original file line numberDiff line numberDiff line change
@@ -2482,3 +2482,5 @@ func SchedGetAttr(pid int, flags uint) (*SchedAttr, error) {
24822482
}
24832483
return attr, nil
24842484
}
2485+
2486+
//sys Cachestat(fd uint, crange *CachestatRange, cstat *Cachestat_t, flags uint) (err error)

Diff for: unix/zsyscall_linux.go

+10
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: unix/ztypes_linux.go

+12
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)