forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit4ce4c76
Shrink memory contexts struct sizes
Here we reduce the block size fields in AllocSetContext, GenerationContextand SlabContext from Size down to uint32. Ever sincec6e0fe1, blocksfor non-dedicated palloc chunks can no longer be larger than 1GB, sothere's no need to store the various block size fields as 64-bit values.32 bits are enough to store 2^30.Here we also further reduce the memory context struct sizes by getting ridof the 'keeper' field which stores a pointer to the context's keeperblock. All the context types which have this field always allocate thekeeper block in the same allocation as the memory context itself, so thekeeper block always comes right at the end of the context struct. Addsome macros to calculate that address rather than storing it in thecontext.Overall, in AllocSetContext and GenerationContext, this saves 20 bytes on64-bit builds which for ALLOCSET_SMALL_SIZES can sometimes mean thedifference between having to allocate a 2nd block and storing all therequired allocations on the keeper block alone. Such contexts are usedin relcache to store cache entries for indexes, of which there can bea large number in a single backend.Author: Melih MutluReviewed-by: David RowleyDiscussion:https://postgr.es/m/CAGPVpCSOW3uJ1QJmsMR9_oE3X7fG_z4q0AoU4R_w+2RzvroPFg@mail.gmail.com1 parentb63a552 commit4ce4c76
3 files changed
+60
-48
lines changedLines changed: 24 additions & 20 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
156 | 156 |
| |
157 | 157 |
| |
158 | 158 |
| |
159 |
| - | |
160 |
| - | |
161 |
| - | |
162 |
| - | |
163 |
| - | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
164 | 163 |
| |
165 | 164 |
| |
166 | 165 |
| |
| |||
241 | 240 |
| |
242 | 241 |
| |
243 | 242 |
| |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
244 | 250 |
| |
245 | 251 |
| |
246 | 252 |
| |
| |||
417 | 423 |
| |
418 | 424 |
| |
419 | 425 |
| |
420 |
| - | |
| 426 | + | |
421 | 427 |
| |
422 | 428 |
| |
423 | 429 |
| |
| |||
453 | 459 |
| |
454 | 460 |
| |
455 | 461 |
| |
456 |
| - | |
| 462 | + | |
457 | 463 |
| |
458 | 464 |
| |
459 | 465 |
| |
| |||
465 | 471 |
| |
466 | 472 |
| |
467 | 473 |
| |
468 |
| - | |
469 |
| - | |
470 | 474 |
| |
471 | 475 |
| |
472 | 476 |
| |
473 | 477 |
| |
474 |
| - | |
475 |
| - | |
476 |
| - | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
477 | 481 |
| |
478 | 482 |
| |
479 | 483 |
| |
| |||
544 | 548 |
| |
545 | 549 |
| |
546 | 550 |
| |
547 |
| - | |
| 551 | + | |
548 | 552 |
| |
549 | 553 |
| |
550 | 554 |
| |
551 | 555 |
| |
552 | 556 |
| |
553 | 557 |
| |
554 | 558 |
| |
555 |
| - | |
| 559 | + | |
556 | 560 |
| |
557 | 561 |
| |
558 | 562 |
| |
559 | 563 |
| |
560 | 564 |
| |
561 |
| - | |
| 565 | + | |
562 | 566 |
| |
563 | 567 |
| |
564 | 568 |
| |
| |||
614 | 618 |
| |
615 | 619 |
| |
616 | 620 |
| |
617 |
| - | |
| 621 | + | |
618 | 622 |
| |
619 | 623 |
| |
620 | 624 |
| |
| |||
663 | 667 |
| |
664 | 668 |
| |
665 | 669 |
| |
666 |
| - | |
| 670 | + | |
667 | 671 |
| |
668 | 672 |
| |
669 | 673 |
| |
670 | 674 |
| |
671 | 675 |
| |
672 | 676 |
| |
673 |
| - | |
| 677 | + | |
674 | 678 |
| |
675 | 679 |
| |
676 | 680 |
| |
| |||
1547 | 1551 |
| |
1548 | 1552 |
| |
1549 | 1553 |
| |
1550 |
| - | |
| 1554 | + | |
1551 | 1555 |
| |
1552 | 1556 |
| |
1553 | 1557 |
| |
| |||
1557 | 1561 |
| |
1558 | 1562 |
| |
1559 | 1563 |
| |
1560 |
| - | |
| 1564 | + | |
1561 | 1565 |
| |
1562 | 1566 |
| |
1563 | 1567 |
| |
|
Lines changed: 23 additions & 19 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
61 | 61 |
| |
62 | 62 |
| |
63 | 63 |
| |
64 |
| - | |
65 |
| - | |
66 |
| - | |
67 |
| - | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
68 | 68 |
| |
69 | 69 |
| |
70 | 70 |
| |
71 | 71 |
| |
72 | 72 |
| |
73 | 73 |
| |
74 |
| - | |
75 | 74 |
| |
76 | 75 |
| |
77 | 76 |
| |
| |||
120 | 119 |
| |
121 | 120 |
| |
122 | 121 |
| |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
123 | 130 |
| |
124 | 131 |
| |
125 | 132 |
| |
| |||
214 | 221 |
| |
215 | 222 |
| |
216 | 223 |
| |
217 |
| - | |
| 224 | + | |
218 | 225 |
| |
219 | 226 |
| |
220 | 227 |
| |
| |||
228 | 235 |
| |
229 | 236 |
| |
230 | 237 |
| |
231 |
| - | |
232 |
| - | |
233 |
| - | |
234 | 238 |
| |
235 |
| - | |
236 |
| - | |
237 |
| - | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
238 | 242 |
| |
239 | 243 |
| |
240 | 244 |
| |
| |||
294 | 298 |
| |
295 | 299 |
| |
296 | 300 |
| |
297 |
| - | |
| 301 | + | |
298 | 302 |
| |
299 | 303 |
| |
300 | 304 |
| |
301 | 305 |
| |
302 | 306 |
| |
303 | 307 |
| |
304 |
| - | |
| 308 | + | |
305 | 309 |
| |
306 | 310 |
| |
307 | 311 |
| |
| |||
440 | 444 |
| |
441 | 445 |
| |
442 | 446 |
| |
443 |
| - | |
444 |
| - | |
| 447 | + | |
| 448 | + | |
445 | 449 |
| |
446 |
| - | |
| 450 | + | |
447 | 451 |
| |
448 | 452 |
| |
449 | 453 |
| |
| |||
594 | 598 |
| |
595 | 599 |
| |
596 | 600 |
| |
597 |
| - | |
| 601 | + | |
598 | 602 |
| |
599 | 603 |
| |
600 | 604 |
| |
| |||
691 | 695 |
| |
692 | 696 |
| |
693 | 697 |
| |
694 |
| - | |
| 698 | + | |
695 | 699 |
| |
696 | 700 |
| |
697 | 701 |
| |
|
Lines changed: 13 additions & 9 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
104 | 104 |
| |
105 | 105 |
| |
106 | 106 |
| |
107 |
| - | |
108 |
| - | |
109 |
| - | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
110 | 110 |
| |
111 | 111 |
| |
112 | 112 |
| |
| |||
314 | 314 |
| |
315 | 315 |
| |
316 | 316 |
| |
317 |
| - | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
318 | 320 |
| |
319 | 321 |
| |
320 | 322 |
| |
| |||
330 | 332 |
| |
331 | 333 |
| |
332 | 334 |
| |
333 |
| - | |
| 335 | + | |
334 | 336 |
| |
335 | 337 |
| |
336 | 338 |
| |
| |||
347 | 349 |
| |
348 | 350 |
| |
349 | 351 |
| |
| 352 | + | |
| 353 | + | |
350 | 354 |
| |
351 | 355 |
| |
352 | 356 |
| |
| |||
374 | 378 |
| |
375 | 379 |
| |
376 | 380 |
| |
377 |
| - | |
378 |
| - | |
379 |
| - | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
380 | 384 |
| |
381 | 385 |
| |
382 | 386 |
| |
| |||
506 | 510 |
| |
507 | 511 |
| |
508 | 512 |
| |
509 |
| - | |
| 513 | + | |
510 | 514 |
| |
511 | 515 |
| |
512 | 516 |
| |
|
0 commit comments
Comments
(0)