2020-01-27 18:04:07 +00:00
|
|
|
load("//tools:defs.bzl", "go_library", "go_test")
|
2018-04-27 17:37:02 +00:00
|
|
|
load("//tools/go_generics:defs.bzl", "go_template_instance")
|
|
|
|
|
2019-10-16 23:27:55 +00:00
|
|
|
package(licenses = ["notice"])
|
|
|
|
|
2019-04-30 20:55:41 +00:00
|
|
|
go_template_instance(
|
|
|
|
name = "evictable_range",
|
|
|
|
out = "evictable_range.go",
|
|
|
|
package = "pgalloc",
|
|
|
|
prefix = "Evictable",
|
|
|
|
template = "//pkg/segment:generic_range",
|
|
|
|
types = {
|
|
|
|
"T": "uint64",
|
|
|
|
},
|
|
|
|
)
|
|
|
|
|
|
|
|
go_template_instance(
|
|
|
|
name = "evictable_range_set",
|
|
|
|
out = "evictable_range_set.go",
|
|
|
|
package = "pgalloc",
|
|
|
|
prefix = "evictableRange",
|
|
|
|
template = "//pkg/segment:generic_set",
|
|
|
|
types = {
|
|
|
|
"Key": "uint64",
|
|
|
|
"Range": "EvictableRange",
|
|
|
|
"Value": "evictableRangeSetValue",
|
|
|
|
"Functions": "evictableRangeSetFunctions",
|
|
|
|
},
|
|
|
|
)
|
|
|
|
|
2018-04-27 17:37:02 +00:00
|
|
|
go_template_instance(
|
|
|
|
name = "usage_set",
|
|
|
|
out = "usage_set.go",
|
|
|
|
consts = {
|
|
|
|
"minDegree": "10",
|
|
|
|
},
|
|
|
|
imports = {
|
2019-06-13 23:49:09 +00:00
|
|
|
"platform": "gvisor.dev/gvisor/pkg/sentry/platform",
|
2018-04-27 17:37:02 +00:00
|
|
|
},
|
2019-03-14 15:11:36 +00:00
|
|
|
package = "pgalloc",
|
2018-04-27 17:37:02 +00:00
|
|
|
prefix = "usage",
|
|
|
|
template = "//pkg/segment:generic_set",
|
|
|
|
types = {
|
|
|
|
"Key": "uint64",
|
|
|
|
"Range": "platform.FileRange",
|
|
|
|
"Value": "usageInfo",
|
|
|
|
"Functions": "usageSetFunctions",
|
|
|
|
},
|
|
|
|
)
|
|
|
|
|
|
|
|
go_library(
|
2019-03-14 15:11:36 +00:00
|
|
|
name = "pgalloc",
|
2018-04-27 17:37:02 +00:00
|
|
|
srcs = [
|
2019-03-14 15:11:36 +00:00
|
|
|
"context.go",
|
2019-04-30 20:55:41 +00:00
|
|
|
"evictable_range.go",
|
|
|
|
"evictable_range_set.go",
|
2019-03-14 15:11:36 +00:00
|
|
|
"pgalloc.go",
|
|
|
|
"pgalloc_unsafe.go",
|
|
|
|
"save_restore.go",
|
2018-04-27 17:37:02 +00:00
|
|
|
"usage_set.go",
|
|
|
|
],
|
|
|
|
visibility = ["//pkg/sentry:internal"],
|
|
|
|
deps = [
|
2020-01-27 23:17:58 +00:00
|
|
|
"//pkg/context",
|
2018-04-27 17:37:02 +00:00
|
|
|
"//pkg/log",
|
2019-06-07 21:51:18 +00:00
|
|
|
"//pkg/memutil",
|
2020-01-27 23:17:58 +00:00
|
|
|
"//pkg/safemem",
|
2018-04-27 17:37:02 +00:00
|
|
|
"//pkg/sentry/arch",
|
2019-06-06 23:26:00 +00:00
|
|
|
"//pkg/sentry/hostmm",
|
2018-04-27 17:37:02 +00:00
|
|
|
"//pkg/sentry/platform",
|
|
|
|
"//pkg/sentry/usage",
|
|
|
|
"//pkg/state",
|
2020-01-10 06:00:42 +00:00
|
|
|
"//pkg/sync",
|
2018-04-27 17:37:02 +00:00
|
|
|
"//pkg/syserror",
|
2020-01-27 23:17:58 +00:00
|
|
|
"//pkg/usermem",
|
2018-04-27 17:37:02 +00:00
|
|
|
],
|
|
|
|
)
|
|
|
|
|
|
|
|
go_test(
|
2019-03-14 15:11:36 +00:00
|
|
|
name = "pgalloc_test",
|
2018-04-27 17:37:02 +00:00
|
|
|
size = "small",
|
2019-03-14 15:11:36 +00:00
|
|
|
srcs = ["pgalloc_test.go"],
|
2020-01-27 18:04:07 +00:00
|
|
|
library = ":pgalloc",
|
2020-01-27 23:17:58 +00:00
|
|
|
deps = ["//pkg/usermem"],
|
2018-04-27 17:37:02 +00:00
|
|
|
)
|