Skip to content

Commit

Permalink
allow to specify should unlimited memlock be used or not (facebookinc…
Browse files Browse the repository at this point in the history
…ubator#43)

Summary:
by default katran today requesting (during startup) unlimited amount
of locked memory. this is suboptimal for environments where
container managment system wants to enforce this number as well.
in this diff i'm adding a flag in katran's config, which would
allow us to bypas setting memlock limit to unlimited, and hence would
rely on external (to katran) managing system to do so

this diff wont change defautl behavior - by default we still would
try to set limit to RLIM_UNLIMITED

Tested By:
unittests + katran_tester
Pull Request resolved: facebookincubator#43

Pulled By: udippant

Reviewed By: sharma95

Differential Revision: D17097200

fbshipit-source-id: aff4f8aa956d24885fcaf911f52a3e17904e15bf
  • Loading branch information
udippant authored and tehnerd committed Aug 29, 2019
1 parent b8a12e4 commit 8ae40a9
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion katran/lib/KatranLb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ constexpr folly::StringPiece kEmptyString = "";

KatranLb::KatranLb(const KatranConfig& config)
: config_(config),
bpfAdapter_(!config.testing),
bpfAdapter_(config.memlockUnlimited),
ctlValues_(kCtlMapSize),
standalone_(true),
forwardingCores_(config.forwardingCores),
Expand Down
2 changes: 2 additions & 0 deletions katran/lib/KatranLbStructs.h
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ struct KatranMonitorConfig {
* @param uint32_t maxDecapDst maximum number of destinations for inline decap
* @param std::string hcInterface interface where we want to attach hc bpf prog
* @param KatranMonitorConfig monitorConfig for katran introspection
* @param memlockUnlimited should katran set memlock to unlimited by default
*
* note about rootMapPath and rootMapPos:
* katran has two modes of operation.
Expand Down Expand Up @@ -174,6 +175,7 @@ struct KatranConfig {
std::string hcInterface = kDefaultHcInterface;
uint32_t xdpAttachFlags = kNoFlags;
struct KatranMonitorConfig monitorConfig;
bool memlockUnlimited = true;
};

/**
Expand Down
6 changes: 5 additions & 1 deletion katran/lib/tests/KatranLbTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,11 @@ class KatranLbTest : public ::testing::Test {
{},
{},
10,
4}){};
4,
"eth0",
0,
{},
false}){}

void SetUp() override {
v1.address = "fc01::1";
Expand Down

0 comments on commit 8ae40a9

Please sign in to comment.