Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
76a96102
Commit
76a96102
authored
Feb 15, 2004
by
Sridhar Samudrala
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[SCTP] Revert back to use kmalloc() for ssnmap allocs of sizes < 128K.
parent
ef55e903
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
9 deletions
+20
-9
net/sctp/ssnmap.c
net/sctp/ssnmap.c
+20
-9
No files found.
net/sctp/ssnmap.c
View file @
76a96102
...
@@ -40,6 +40,7 @@
...
@@ -40,6 +40,7 @@
#include <net/sctp/sctp.h>
#include <net/sctp/sctp.h>
#include <net/sctp/sm.h>
#include <net/sctp/sm.h>
#define MAX_KMALLOC_SIZE 131072
/* Storage size needed for map includes 2 headers and then the
/* Storage size needed for map includes 2 headers and then the
* specific needs of in or out streams.
* specific needs of in or out streams.
...
@@ -56,11 +57,14 @@ static inline size_t sctp_ssnmap_size(__u16 in, __u16 out)
...
@@ -56,11 +57,14 @@ static inline size_t sctp_ssnmap_size(__u16 in, __u16 out)
struct
sctp_ssnmap
*
sctp_ssnmap_new
(
__u16
in
,
__u16
out
,
int
gfp
)
struct
sctp_ssnmap
*
sctp_ssnmap_new
(
__u16
in
,
__u16
out
,
int
gfp
)
{
{
struct
sctp_ssnmap
*
retval
;
struct
sctp_ssnmap
*
retval
;
int
order
;
int
size
;
order
=
get_order
(
sctp_ssnmap_size
(
in
,
out
));
size
=
sctp_ssnmap_size
(
in
,
out
);
retval
=
(
struct
sctp_ssnmap
*
)
__get_free_pages
(
gfp
,
order
);
if
(
size
<=
MAX_KMALLOC_SIZE
)
retval
=
kmalloc
(
size
,
gfp
);
else
retval
=
(
struct
sctp_ssnmap
*
)
__get_free_pages
(
gfp
,
get_order
(
size
));
if
(
!
retval
)
if
(
!
retval
)
goto
fail
;
goto
fail
;
...
@@ -73,7 +77,10 @@ struct sctp_ssnmap *sctp_ssnmap_new(__u16 in, __u16 out, int gfp)
...
@@ -73,7 +77,10 @@ struct sctp_ssnmap *sctp_ssnmap_new(__u16 in, __u16 out, int gfp)
return
retval
;
return
retval
;
fail_map:
fail_map:
free_pages
((
unsigned
long
)
retval
,
order
);
if
(
size
<=
MAX_KMALLOC_SIZE
)
kfree
(
retval
);
else
free_pages
((
unsigned
long
)
retval
,
get_order
(
size
));
fail:
fail:
return
NULL
;
return
NULL
;
}
}
...
@@ -109,9 +116,13 @@ void sctp_ssnmap_clear(struct sctp_ssnmap *map)
...
@@ -109,9 +116,13 @@ void sctp_ssnmap_clear(struct sctp_ssnmap *map)
void
sctp_ssnmap_free
(
struct
sctp_ssnmap
*
map
)
void
sctp_ssnmap_free
(
struct
sctp_ssnmap
*
map
)
{
{
if
(
map
&&
map
->
malloced
)
{
if
(
map
&&
map
->
malloced
)
{
free_pages
((
unsigned
long
)
map
,
int
size
;
get_order
(
sctp_ssnmap_size
(
map
->
in
.
len
,
map
->
out
.
len
)));
size
=
sctp_ssnmap_size
(
map
->
in
.
len
,
map
->
out
.
len
);
if
(
size
<=
MAX_KMALLOC_SIZE
)
kfree
(
map
);
else
free_pages
((
unsigned
long
)
map
,
get_order
(
size
));
SCTP_DBG_OBJCNT_DEC
(
ssnmap
);
SCTP_DBG_OBJCNT_DEC
(
ssnmap
);
}
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment