Commit 945d07c 1 parent 9e5c591 commit 945d07c Copy full SHA for 945d07c
File tree 2 files changed +8
-0
lines changed
2 files changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -35,6 +35,7 @@ go_library(
35
35
"//pkg/util/logutil" ,
36
36
"//pkg/util/memory" ,
37
37
"//pkg/util/paging" ,
38
+ "//pkg/util/size" ,
38
39
"//pkg/util/tiflash" ,
39
40
"//pkg/util/tiflashcompute" ,
40
41
"//pkg/util/tracing" ,
Original file line number Diff line number Diff line change @@ -19,6 +19,7 @@ import (
19
19
"fmt"
20
20
"math"
21
21
"net"
22
+ "runtime"
22
23
"strconv"
23
24
"strings"
24
25
"sync"
@@ -50,6 +51,7 @@ import (
50
51
"github.com/pingcap/tidb/pkg/util/logutil"
51
52
"github.com/pingcap/tidb/pkg/util/memory"
52
53
"github.com/pingcap/tidb/pkg/util/paging"
54
+ "github.com/pingcap/tidb/pkg/util/size"
53
55
"github.com/pingcap/tidb/pkg/util/tracing"
54
56
"github.com/pingcap/tidb/pkg/util/trxevents"
55
57
"github.com/pingcap/tipb/go-tipb"
@@ -822,6 +824,10 @@ func (worker *copIteratorWorker) run(ctx context.Context) {
822
824
})
823
825
worker .wg .Done ()
824
826
}()
827
+ // 16KB ballast helps grow the stack to the requirement of copIteratorWorker.
828
+ // This reduces the `morestack` call during the execution of `handleTask`, thus improvement the efficiency of TiDB.
829
+ // TODO: remove ballast after global pool is applied.
830
+ ballast := make ([]byte , 16 * size .KB )
825
831
for task := range worker .taskCh {
826
832
respCh := worker .respChan
827
833
if respCh == nil {
@@ -840,6 +846,7 @@ func (worker *copIteratorWorker) run(ctx context.Context) {
840
846
return
841
847
}
842
848
}
849
+ runtime .KeepAlive (ballast )
843
850
}
844
851
845
852
// open starts workers and sender goroutines.
You can’t perform that action at this time.
0 commit comments