TS-3883: Fix loose alignment problem (regression). (cherry picked from commit a33b8d602ffd3470d1688ebe2d1489c4cdf52dd1)
Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/31deeceb Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/31deeceb Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/31deeceb Branch: refs/heads/6.0.x Commit: 31deeceb07fa0bb87656bd08df19a4f5b8dd05b3 Parents: afd9a4c Author: Alan M. Carroll <[email protected]> Authored: Mon Nov 2 14:23:03 2015 -0600 Committer: Bryan Call <[email protected]> Committed: Wed Dec 2 14:32:00 2015 -0800 ---------------------------------------------------------------------- lib/ts/ink_queue.cc | 4 ++++ 1 file changed, 4 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/trafficserver/blob/31deeceb/lib/ts/ink_queue.cc ---------------------------------------------------------------------- diff --git a/lib/ts/ink_queue.cc b/lib/ts/ink_queue.cc index e100fa8..c57fe34 100644 --- a/lib/ts/ink_queue.cc +++ b/lib/ts/ink_queue.cc @@ -96,6 +96,10 @@ ink_freelist_init(InkFreeList **fl, const char *name, uint32_t type_size, uint32 f->name = name; /* quick test for power of 2 */ ink_assert(!(alignment & (alignment - 1))); + // It is never useful to have alignment requirement looser than a page size + // so clip it. This makes the item alignment checks in the actual allocator simpler. + if (alignment > ats_pagesize()) + alignment = ats_pagesize(); f->alignment = alignment; // Make sure we align *all* the objects in the allocation, not just the first one f->type_size = INK_ALIGN(type_size, alignment);
